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
e6732b8a
Commit
e6732b8a
authored
Jan 23, 2020
by
Reimar Leike
Browse files
made energies scalable
parent
f9ca9bad
Pipeline
#67629
passed with stages
in 25 minutes and 42 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty6/operators/linear_operator.py
View file @
e6732b8a
...
...
@@ -174,7 +174,10 @@ class LinearOperator(Operator):
return
self
.
apply
(
x
,
self
.
TIMES
)
from
..linearization
import
Linearization
if
isinstance
(
x
,
Linearization
):
return
x
.
new
(
self
(
x
.
_val
),
self
(
x
.
_jac
))
res
=
x
.
new
(
self
(
x
.
_val
),
self
(
x
.
_jac
))
if
x
.
metric
is
not
None
:
res
=
res
.
add_metric
(
self
(
x
.
metric
))
return
res
return
self
.
__matmul__
(
x
)
def
times
(
self
,
x
):
...
...
nifty6/operators/scaling_operator.py
View file @
e6732b8a
...
...
@@ -98,5 +98,14 @@ class ScalingOperator(EndomorphicOperator):
return
from_random
(
random_type
=
"normal"
,
domain
=
self
.
_domain
,
std
=
self
.
_get_fct
(
from_inverse
),
dtype
=
dtype
)
def
__matmul__
(
self
,
other
):
if
np
.
isreal
(
self
.
_factor
)
and
self
.
_factor
>
0
:
from
.sandwich_operator
import
SandwichOperator
if
isinstance
(
other
,
SandwichOperator
):
sqrt_fac
=
np
.
sqrt
(
self
.
_factor
)
newop
=
ScalingOperator
(
other
.
domain
,
sqrt_fac
)
return
SandwichOperator
.
make
(
newop
,
other
)
return
EndomorphicOperator
.
__matmul__
(
self
,
other
)
def
__repr__
(
self
):
return
"ScalingOperator ({})"
.
format
(
self
.
_factor
)
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