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
Neel Shah
NIFTy
Commits
aa3cdd2c
Commit
aa3cdd2c
authored
Mar 01, 2019
by
Martin Reinecke
Browse files
small tweaks
parent
6d63329f
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/scaling_operator.py
View file @
aa3cdd2c
...
@@ -35,14 +35,6 @@ class ScalingOperator(EndomorphicOperator):
...
@@ -35,14 +35,6 @@ class ScalingOperator(EndomorphicOperator):
-----
-----
:class:`Operator` supports the multiplication with a scalar. So one does
:class:`Operator` supports the multiplication with a scalar. So one does
not need instantiate :class:`ScalingOperator` explicitly in most cases.
not need instantiate :class:`ScalingOperator` explicitly in most cases.
Formally, this operator always supports all operation modes (times,
adjoint_times, inverse_times and inverse_adjoint_times), even if `factor`
is 0 or infinity. It is the user's responsibility to apply the operator
only in appropriate ways (e.g. call inverse_times only if `factor` is
nonzero).
This shortcoming will hopefully be fixed in the future.
"""
"""
def
__init__
(
self
,
factor
,
domain
):
def
__init__
(
self
,
factor
,
domain
):
...
@@ -52,7 +44,10 @@ class ScalingOperator(EndomorphicOperator):
...
@@ -52,7 +44,10 @@ class ScalingOperator(EndomorphicOperator):
raise
TypeError
(
"Scalar required"
)
raise
TypeError
(
"Scalar required"
)
self
.
_factor
=
factor
self
.
_factor
=
factor
self
.
_domain
=
makeDomain
(
domain
)
self
.
_domain
=
makeDomain
(
domain
)
self
.
_capability
=
self
.
_all_ops
if
self
.
_factor
==
0.
:
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
else
:
self
.
_capability
=
self
.
_all_ops
def
apply
(
self
,
x
,
mode
):
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
self
.
_check_input
(
x
,
mode
)
...
...
nifty5/operators/sum_operator.py
View file @
aa3cdd2c
...
@@ -23,6 +23,7 @@ from ..sugar import domain_union
...
@@ -23,6 +23,7 @@ from ..sugar import domain_union
from
..utilities
import
indent
from
..utilities
import
indent
from
.block_diagonal_operator
import
BlockDiagonalOperator
from
.block_diagonal_operator
import
BlockDiagonalOperator
from
.linear_operator
import
LinearOperator
from
.linear_operator
import
LinearOperator
from
.simple_linear_operators
import
NullOperator
class
SumOperator
(
LinearOperator
):
class
SumOperator
(
LinearOperator
):
...
@@ -59,6 +60,8 @@ class SumOperator(LinearOperator):
...
@@ -59,6 +60,8 @@ class SumOperator(LinearOperator):
negnew
+=
[
not
n
for
n
in
op
.
_neg
]
negnew
+=
[
not
n
for
n
in
op
.
_neg
]
else
:
else
:
negnew
+=
list
(
op
.
_neg
)
negnew
+=
list
(
op
.
_neg
)
elif
isinstance
(
op
,
NullOperator
):
pass
else
:
else
:
opsnew
.
append
(
op
)
opsnew
.
append
(
op
)
negnew
.
append
(
ng
)
negnew
.
append
(
ng
)
...
...
Write
Preview
Supports
Markdown
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