Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neel Shah
NIFTy
Commits
de87751b
Commit
de87751b
authored
Apr 02, 2020
by
Philipp Arras
Browse files
Refactor
parent
19ab4fa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty6/multi_field.py
View file @
de87751b
...
@@ -324,20 +324,20 @@ class MultiField(object):
...
@@ -324,20 +324,20 @@ class MultiField(object):
val
=
tuple
(
f
(
v1
,
other
)
for
v1
in
self
.
_val
)
val
=
tuple
(
f
(
v1
,
other
)
for
v1
in
self
.
_val
)
return
MultiField
(
self
.
_domain
,
val
)
return
MultiField
(
self
.
_domain
,
val
)
def
_sinc_withjac
(
self
):
return
self
.
_nontrivial_jac_helper
(
'_sinc_withjac'
)
for
op
in
[
"sinc"
,
"absolute"
]:
ss
=
f
'_
{
op
}
_withjac'
def
_absolute_withjac
(
self
):
def
func
(
ss
):
return
self
.
_nontrivial_jac_helper
(
'_absolute_withjac'
)
def
func2
(
self
):
val
=
self
.
to_dict
()
def
_nontrivial_jac_helper
(
self
,
funcname
):
jac
=
{}
val
=
self
.
to_dict
()
for
kk
,
vv
in
val
.
items
()
:
jac
=
{}
val
[
kk
],
jac
[
kk
]
=
getattr
(
vv
,
ss
)()
for
kk
,
vv
in
val
.
items
():
val
=
MultiField
.
from_dict
(
val
,
self
.
_domain
)
val
[
kk
],
jac
[
kk
]
=
getattr
(
vv
,
funcname
)(
)
jac
=
MultiField
.
from_dict
(
jac
,
self
.
_domain
)
val
=
MultiField
.
from_dict
(
val
,
self
.
_domain
)
return
val
,
jac
jac
=
MultiField
.
from_dict
(
jac
,
self
.
_domain
)
return
func2
return
val
,
jac
setattr
(
MultiField
,
ss
,
func
(
ss
))
for
op
in
[
"__add__"
,
"__radd__"
,
for
op
in
[
"__add__"
,
"__radd__"
,
...
...
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