Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
49e14ed8
Commit
49e14ed8
authored
Aug 24, 2016
by
theos
Browse files
Fixed references to paradict in the endomorphic operator.
Moved unitary property to LinearOperator.
parent
d57b2f02
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty/operators/endomorphic_operator/endomorphic_operator.py
View file @
49e14ed8
...
...
@@ -11,7 +11,7 @@ class EndomorphicOperator(LinearOperator):
# ---Overwritten properties and methods---
def
inverse_times
(
self
,
x
,
spaces
=
None
,
types
=
None
):
if
self
.
paradict
[
'
symmetric
'
]
and
self
.
paradict
[
'
unitary
'
]
:
if
self
.
symmetric
and
self
.
unitary
:
return
self
.
times
(
x
,
spaces
,
types
)
else
:
return
super
(
EndomorphicOperator
,
self
).
inverse_times
(
...
...
@@ -20,10 +20,8 @@ class EndomorphicOperator(LinearOperator):
types
=
types
)
def
adjoint_times
(
self
,
x
,
spaces
=
None
,
types
=
None
):
if
self
.
paradict
[
'
symmetric
'
]
:
if
self
.
symmetric
:
return
self
.
times
(
x
,
spaces
,
types
)
elif
self
.
paradict
[
'unitary'
]:
return
self
.
inverse_times
(
x
,
spaces
,
types
)
else
:
return
super
(
EndomorphicOperator
,
self
).
adjoint_times
(
x
=
x
,
...
...
@@ -31,10 +29,8 @@ class EndomorphicOperator(LinearOperator):
types
=
types
)
def
adjoint_inverse_times
(
self
,
x
,
spaces
=
None
,
types
=
None
):
if
self
.
paradict
[
'
symmetric
'
]
:
if
self
.
symmetric
:
return
self
.
inverse_times
(
x
,
spaces
,
types
)
elif
self
.
paradict
[
'unitary'
]:
return
self
.
times
(
x
,
spaces
,
types
)
else
:
return
super
(
EndomorphicOperator
,
self
).
adjoint_inverse_times
(
x
=
x
,
...
...
@@ -42,10 +38,8 @@ class EndomorphicOperator(LinearOperator):
types
=
types
)
def
inverse_adjoint_times
(
self
,
x
,
spaces
=
None
,
types
=
None
):
if
self
.
paradict
[
'
symmetric
'
]
:
if
self
.
symmetric
:
return
self
.
inverse_times
(
x
,
spaces
,
types
)
elif
self
.
paradict
[
'unitary'
]:
return
self
.
times
(
x
,
spaces
,
types
)
else
:
return
super
(
EndomorphicOperator
,
self
).
inverse_adjoint_times
(
x
=
x
,
...
...
@@ -68,10 +62,6 @@ class EndomorphicOperator(LinearOperator):
def
symmetric
(
self
):
raise
NotImplementedError
@
abc
.
abstractproperty
def
unitary
(
self
):
raise
NotImplementedError
def
trace
(
self
):
pass
...
...
nifty/operators/linear_operator/linear_operator.py
View file @
49e14ed8
...
...
@@ -60,6 +60,10 @@ class LinearOperator(object):
def
implemented
(
self
):
return
self
.
_implemented
@
abc
.
abstractproperty
def
unitary
(
self
):
raise
NotImplementedError
def
__call__
(
self
,
*
args
,
**
kwargs
):
return
self
.
times
(
*
args
,
**
kwargs
)
...
...
@@ -81,6 +85,9 @@ class LinearOperator(object):
return
y
def
adjoint_times
(
self
,
x
,
spaces
=
None
,
types
=
None
):
if
self
.
unitary
:
return
self
.
inverse_times
(
x
,
spaces
,
types
)
spaces
,
types
=
self
.
_check_input_compatibility
(
x
,
spaces
,
types
)
if
not
self
.
implemented
:
...
...
@@ -89,6 +96,9 @@ class LinearOperator(object):
return
y
def
adjoint_inverse_times
(
self
,
x
,
spaces
=
None
,
types
=
None
):
if
self
.
unitary
:
return
self
.
times
(
x
,
spaces
,
types
)
spaces
,
types
=
self
.
_check_input_compatibility
(
x
,
spaces
,
types
)
y
=
self
.
_adjoint_inverse_times
(
x
,
spaces
,
types
)
...
...
@@ -97,6 +107,9 @@ class LinearOperator(object):
return
y
def
inverse_adjoint_times
(
self
,
x
,
spaces
=
None
,
types
=
None
):
if
self
.
unitary
:
return
self
.
times
(
x
,
spaces
,
types
)
spaces
,
types
=
self
.
_check_input_compatibility
(
x
,
spaces
,
types
)
y
=
self
.
_inverse_adjoint_times
(
x
,
spaces
,
types
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment