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
6b54a5ce
Commit
6b54a5ce
authored
Jul 25, 2018
by
Martin Reinecke
Browse files
temporary
parent
9a1c07ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
nifty5/__init__.py
View file @
6b54a5ce
...
...
@@ -54,6 +54,7 @@ from .operators.selection_operator import SelectionOperator
from
.operators.slope_operator
import
SlopeOperator
from
.operators.smoothness_operator
import
SmoothnessOperator
from
.operators.symmetrizing_operator
import
SymmetrizingOperator
from
.operators.vdot_operator
import
VdotOperator
from
.probing.utils
import
probe_with_posterior_samples
,
probe_diagonal
,
\
StatCalculator
...
...
nifty5/operator.py
View file @
6b54a5ce
...
...
@@ -58,7 +58,7 @@ class Linearization(object):
d1
=
makeOp
(
self
.
_val
)
d2
=
makeOp
(
other
.
_val
)
return
Linearization
(
self
.
_val
*
other
.
_val
,
self
.
_jac
*
d2
+
d1
*
other
.
_jac
)
d2
*
self
.
_jac
+
d1
*
other
.
_jac
)
if
isinstance
(
other
,
(
int
,
float
,
complex
)):
# if other == 0:
# return ...
...
...
nifty5/operators/vdot_operator.py
0 → 100644
View file @
6b54a5ce
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-2018 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from
__future__
import
absolute_import
,
division
,
print_function
import
numpy
as
np
from
..compat
import
*
from
..domain_tuple
import
DomainTuple
from
..domains.unstructured_domain
import
UnstructuredDomain
from
.linear_operator
import
LinearOperator
from
..sugar
import
full
class
VdotOperator
(
LinearOperator
):
def
__init__
(
self
,
field
):
super
(
VdotOperator
,
self
).
__init__
()
self
.
_field
=
field
self
.
_target
=
DomainTuple
.
make
(
UnstructuredDomain
(
1
))
@
property
def
domain
(
self
):
return
self
.
_field
.
domain
@
property
def
target
(
self
):
return
self
.
_target
@
property
def
capability
(
self
):
return
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
if
mode
==
self
.
TIMES
:
return
full
(
self
.
_target
,
self
.
_field
.
vdot
(
x
))
return
self
.
_field
*
x
.
to_global_data
()[()]
test/test_operators/test_adjoint.py
View file @
6b54a5ce
...
...
@@ -49,6 +49,13 @@ class Consistency_Tests(unittest.TestCase):
op
=
a
+
b
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
@
expand
(
product
(
_h_spaces
+
_p_spaces
+
_pow_spaces
,
[
np
.
float64
,
np
.
complex128
]))
def
testVdotOperator
(
self
,
sp
,
dtype
):
op
=
ift
.
VdotOperator
(
ift
.
Field
.
from_random
(
"normal"
,
sp
,
dtype
=
dtype
))
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
@
expand
(
product
([(
ift
.
RGSpace
(
10
,
harmonic
=
True
),
4
,
0
),
(
ift
.
RGSpace
((
24
,
31
),
distances
=
(
0.4
,
2.34
),
harmonic
=
True
),
3
,
0
),
...
...
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