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
d1b9f160
Commit
d1b9f160
authored
Mar 11, 2020
by
Philipp Arras
Browse files
Fix
parent
1c7629b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty6/library/special_distributions.py
View file @
d1b9f160
...
...
@@ -40,15 +40,17 @@ class _InterpolationOperator(Operator):
def
apply
(
self
,
x
):
self
.
_check_input
(
x
)
val
=
(
np
.
clip
(
x
.
val
,
self
.
_xmin
,
self
.
_xmax
)
-
self
.
_xmin
)
/
self
.
_d
lin
=
isinstance
(
x
,
Linearization
)
xval
=
x
.
val
.
val
if
lin
else
x
.
val
val
=
(
np
.
clip
(
xval
,
self
.
_xmin
,
self
.
_xmax
)
-
self
.
_xmin
)
/
self
.
_d
fi
=
np
.
floor
(
val
).
astype
(
int
)
w
=
val
-
fi
res
=
self
.
_inv_table_func
((
1
-
w
)
*
self
.
_table
[
fi
]
+
w
*
self
.
_table
[
fi
+
1
])
resfld
=
Field
(
self
.
_domain
,
res
)
if
not
isinstance
(
x
,
Linearization
)
:
if
not
lin
:
return
resfld
jac
=
makeOp
(
Field
(
self
.
_domain
,
self
.
_deriv
[
fi
]
*
res
))
return
Linearization
(
resfld
,
jac
)
return
x
.
new
(
resfld
,
jac
)
def
InverseGammaOperator
(
domain
,
alpha
,
q
,
delta
=
0.001
):
...
...
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