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
2866d426
Commit
2866d426
authored
Jul 22, 2018
by
Philipp Arras
Browse files
Cosmetics
parent
c8773202
Changes
15
Hide whitespace changes
Inline
Side-by-side
nifty5/domains/domain.py
View file @
2866d426
...
...
@@ -27,6 +27,7 @@ from ..utilities import NiftyMetaBase
class
Domain
(
NiftyMetaBase
()):
"""The abstract class repesenting a (structured or unstructured) domain.
"""
def
__init__
(
self
):
self
.
_hash
=
None
...
...
nifty5/library/los_response.py
View file @
2866d426
...
...
@@ -132,6 +132,7 @@ class LOSResponse(LinearOperator):
every calling MPI task (i.e. the full LOS information has to be provided on
every task).
"""
def
__init__
(
self
,
domain
,
starts
,
ends
,
sigmas_low
=
None
,
sigmas_up
=
None
):
super
(
LOSResponse
,
self
).
__init__
()
...
...
nifty5/minimization/relaxed_newton.py
View file @
2866d426
...
...
@@ -29,6 +29,7 @@ class RelaxedNewton(DescentMinimizer):
The descent direction is determined by weighting the gradient at the
current parameter position with the inverse local metric.
"""
def
__init__
(
self
,
controller
,
line_searcher
=
None
):
if
line_searcher
is
None
:
line_searcher
=
LineSearchStrongWolfe
(
...
...
nifty5/minimization/steepest_descent.py
View file @
2866d426
...
...
@@ -28,5 +28,6 @@ class SteepestDescent(DescentMinimizer):
Also known as 'gradient descent'. This algorithm simply follows the
functional's gradient for minimization.
"""
def
get_descent_direction
(
self
,
energy
):
return
-
energy
.
gradient
nifty5/minimization/vl_bfgs.py
View file @
2866d426
...
...
@@ -106,6 +106,7 @@ class _InformationStore(object):
yy : numpy.ndarray
2D circular buffer of scalar products between different elements of y.
"""
def
__init__
(
self
,
max_history_length
,
x0
,
gradient
):
self
.
max_history_length
=
max_history_length
self
.
s
=
[
None
]
*
max_history_length
...
...
nifty5/models/binary_helpers.py
View file @
2866d426
...
...
@@ -35,6 +35,7 @@ def _joint_position(model1, model2):
class
ScalarMul
(
Model
):
"""Class representing a model multiplied by a scalar factor."""
def
__init__
(
self
,
factor
,
model
):
super
(
ScalarMul
,
self
).
__init__
(
model
.
position
)
# TODO -> floating
...
...
@@ -53,6 +54,7 @@ class ScalarMul(Model):
class
Add
(
Model
):
"""Class representing the sum of two models."""
def
__init__
(
self
,
position
,
model1
,
model2
):
super
(
Add
,
self
).
__init__
(
position
)
...
...
@@ -83,6 +85,7 @@ class Add(Model):
class
Mul
(
Model
):
"""Class representing the pointwise product of two models."""
def
__init__
(
self
,
position
,
model1
,
model2
):
super
(
Mul
,
self
).
__init__
(
position
)
...
...
nifty5/models/constant.py
View file @
2866d426
...
...
@@ -39,6 +39,7 @@ class Constant(Model):
- Position has no influence on value.
- The Jacobian is a null matrix.
"""
def
__init__
(
self
,
position
,
constant
):
super
(
Constant
,
self
).
__init__
(
position
)
self
.
_constant
=
constant
...
...
nifty5/models/model.py
View file @
2866d426
...
...
@@ -47,6 +47,7 @@ class Model(NiftyMetaBase()):
one automatically gets the value and Jacobian of the model. The 'at' method
creates a new instance of the class.
"""
def
__init__
(
self
,
position
):
self
.
_position
=
position
...
...
nifty5/models/multi_model.py
View file @
2866d426
...
...
@@ -27,6 +27,7 @@ from .model import Model
class
MultiModel
(
Model
):
""" """
def
__init__
(
self
,
model
,
key
):
# TODO Rewrite it such that it takes a dictionary as input.
# (just like MultiFields).
...
...
nifty5/models/variable.py
View file @
2866d426
...
...
@@ -31,6 +31,7 @@ class Variable(Model):
position : Field or MultiField
The current position in parameter space.
"""
def
__init__
(
self
,
position
):
super
(
Variable
,
self
).
__init__
(
position
)
...
...
nifty5/operators/null_operator.py
View file @
2866d426
...
...
@@ -34,6 +34,7 @@ class NullOperator(LinearOperator):
target : DomainTuple or MultiDomain
output domain
"""
def
__init__
(
self
,
domain
,
target
):
from
..sugar
import
makeDomain
self
.
_domain
=
makeDomain
(
domain
)
...
...
nifty5/operators/qht_operator.py
View file @
2866d426
...
...
@@ -42,6 +42,7 @@ class QHTOperator(LinearOperator):
The index of the domain on which the operator acts.
target[space] must be a nonharmonic LogRGSpace.
"""
def
__init__
(
self
,
target
,
space
=
0
):
self
.
_target
=
DomainTuple
.
make
(
target
)
self
.
_space
=
infer_space
(
self
.
_target
,
space
)
...
...
nifty5/operators/scaling_operator.py
View file @
2866d426
...
...
@@ -111,4 +111,4 @@ class ScalingOperator(EndomorphicOperator):
fct
=
1.
/
np
.
sqrt
(
fct
)
if
from_inverse
else
np
.
sqrt
(
fct
)
cls
=
Field
if
isinstance
(
self
.
_domain
,
DomainTuple
)
else
MultiField
return
cls
.
from_random
(
random_type
=
"normal"
,
domain
=
self
.
_domain
,
std
=
fct
,
dtype
=
dtype
)
random_type
=
"normal"
,
domain
=
self
.
_domain
,
std
=
fct
,
dtype
=
dtype
)
nifty5/operators/selection_operator.py
View file @
2866d426
...
...
@@ -35,6 +35,7 @@ class SelectionOperator(LinearOperator):
key : :class:`str`
String identifier of the wanted subdomain
"""
def
__init__
(
self
,
domain
,
key
):
self
.
_domain
=
MultiDomain
.
make
(
domain
)
self
.
_key
=
key
...
...
nifty5/utilities.py
View file @
2866d426
...
...
@@ -89,7 +89,7 @@ def get_slice_list(shape, axes):
slice_list
=
[
next
(
it_iter
)
if
axis
else
slice
(
None
,
None
)
for
axis
in
axes_select
]
]
yield
slice_list
else
:
yield
[
slice
(
None
,
None
)]
...
...
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