Skip to content
GitLab
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
ac09f9cf
Commit
ac09f9cf
authored
May 01, 2020
by
Martin Reinecke
Browse files
simpler way of building the metric
parent
076151e3
Pipeline
#74156
passed with stages
in 29 minutes and 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty6/operators/energy_operators.py
View file @
ac09f9cf
...
...
@@ -299,10 +299,7 @@ class StudentTEnergy(EnergyOperator):
res
=
(((
self
.
_theta
+
1
)
/
2
)
*
(
x
**
2
/
self
.
_theta
).
ptw
(
"log1p"
)).
sum
()
if
not
x
.
want_metric
:
return
res
if
isinstance
(
self
.
_theta
,
Field
):
met
=
makeOp
((
self
.
_theta
+
1
)
/
(
self
.
_theta
+
3
))
else
:
met
=
ScalingOperator
(
self
.
domain
,
(
self
.
_theta
+
1
)
/
(
self
.
_theta
+
3
))
met
=
makeOp
((
self
.
_theta
+
1
)
/
(
self
.
_theta
+
3
),
self
.
domain
)
return
res
.
add_metric
(
met
)
...
...
nifty6/sugar.py
View file @
ac09f9cf
...
...
@@ -345,7 +345,7 @@ def makeOp(input, dom=None):
if
np
.
isscalar
(
input
):
if
not
isinstance
(
dom
,
(
DomainTuple
,
MultiDomain
)):
raise
TypeError
(
"need proper `dom` argument"
)
return
SalingOperator
(
dom
,
input
)
return
S
c
alingOperator
(
dom
,
input
)
if
dom
is
not
None
:
if
not
dom
==
input
.
domain
:
raise
ValueError
(
"domain mismatch"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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