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
ift
NIFTy
Commits
221486b1
Commit
221486b1
authored
Sep 24, 2016
by
theos
Browse files
Merge branch 'master' into NIFTy3_temp
# Conflicts: # lm/__init__.py # lm/nifty_lm.py # rg/nifty_fft.py
parents
c65a30a8
45ec5251
Changes
3
Show whitespace changes
Inline
Side-by-side
nifty/config/nifty_about.py
View file @
221486b1
...
@@ -23,9 +23,20 @@ from sys import stdout as so
...
@@ -23,9 +23,20 @@ from sys import stdout as so
import
os
import
os
import
inspect
import
inspect
import
d2o
import
keepers
from
nifty
import
__version__
from
nifty
import
__version__
MPI
=
d2o
.
config
.
dependency_injector
[
keepers
.
get_Configuration
(
'D2O'
)[
'mpi_module'
]]
comm
=
MPI
.
COMM_WORLD
size
=
comm
.
size
rank
=
comm
.
rank
class
switch
(
object
):
class
switch
(
object
):
"""
"""
.. __ __ __
.. __ __ __
...
@@ -256,7 +267,7 @@ class notification(switch):
...
@@ -256,7 +267,7 @@ class notification(switch):
current
=
inspect
.
stack
()[
i
][
3
]
current
=
inspect
.
stack
()[
i
][
3
]
return
result
[
1
:]
return
result
[
1
:]
def
cstring
(
self
,
subject
):
def
cstring
(
self
,
subject
):
"""
"""
Casts an object to a string and augments that with a colour code.
Casts an object to a string and augments that with a colour code.
...
@@ -272,10 +283,11 @@ class notification(switch):
...
@@ -272,10 +283,11 @@ class notification(switch):
String augmented with a color code.
String augmented with a color code.
"""
"""
if
rank
==
0
:
return
self
.
ccode
+
str
(
self
.
_get_caller
())
+
':
\n
'
+
\
return
self
.
ccode
+
str
(
self
.
_get_caller
())
+
':
\n
'
+
\
str
(
subject
)
+
self
.
_code
+
'
\n
'
str
(
subject
)
+
self
.
_code
+
'
\n
'
def
cflush
(
self
,
subject
):
def
cflush
(
self
,
subject
):
"""
"""
Flushes an object in its colour coded sting representation to the
Flushes an object in its colour coded sting representation to the
standard output (*without* line break).
standard output (*without* line break).
...
@@ -291,11 +303,11 @@ class notification(switch):
...
@@ -291,11 +303,11 @@ class notification(switch):
None
None
"""
"""
if
(
self
.
status
)
:
if
self
.
status
and
rank
==
0
:
so
.
write
(
self
.
cstring
(
subject
))
so
.
write
(
self
.
cstring
(
subject
))
so
.
flush
()
so
.
flush
()
def
cprint
(
self
,
subject
):
def
cprint
(
self
,
subject
):
"""
"""
Flushes an object in its colour coded sting representation to the
Flushes an object in its colour coded sting representation to the
standard output (*with* line break).
standard output (*with* line break).
...
@@ -311,7 +323,7 @@ class notification(switch):
...
@@ -311,7 +323,7 @@ class notification(switch):
None
None
"""
"""
if
(
self
.
status
)
:
if
self
.
status
and
rank
==
0
:
so
.
write
(
self
.
cstring
(
subject
)
+
"
\n
"
)
so
.
write
(
self
.
cstring
(
subject
)
+
"
\n
"
)
so
.
flush
()
so
.
flush
()
...
...
nifty/operators/nifty_minimization.py
View file @
221486b1
...
@@ -857,7 +857,11 @@ class quasi_newton_minimizer(object):
...
@@ -857,7 +857,11 @@ class quasi_newton_minimizer(object):
step_length
=
0
step_length
=
0
for
i
in
xrange
(
limii
):
for
i
in
xrange
(
limii
):
if
self
.
callback
is
not
None
:
if
self
.
callback
is
not
None
:
self
.
callback
(
self
.
x
,
i
)
try
:
self
.
callback
(
self
.
x
,
f_k
,
i
)
except
StopIteration
:
self
.
note
.
cprint
(
"
\n
Callback function stopped minization."
)
break
# compute the the gradient for the current x
# compute the the gradient for the current x
gradient
=
self
.
fprime
(
self
.
x
)
gradient
=
self
.
fprime
(
self
.
x
)
...
...
nifty/operators/nifty_operators.py
View file @
221486b1
...
@@ -3383,8 +3383,8 @@ class propagator_operator(operator):
...
@@ -3383,8 +3383,8 @@ class propagator_operator(operator):
raise
ValueError
(
about
.
_errors
.
cstring
(
raise
ValueError
(
about
.
_errors
.
cstring
(
"ERROR: At least M or N must be given."
))
"ERROR: At least M or N must be given."
))
def
_multiply
(
self
,
x
,
W
=
None
,
spam
=
None
,
reset
=
None
,
note
=
Fals
e
,
def
_multiply
(
self
,
x
,
W
=
None
,
spam
=
None
,
reset
=
None
,
note
=
Tru
e
,
x0
=
None
,
tol
=
1E-
4
,
clevel
=
1
,
limii
=
None
,
**
kwargs
):
x0
=
None
,
tol
=
1E-
3
,
clevel
=
1
,
limii
=
1000
,
**
kwargs
):
if
W
is
None
:
if
W
is
None
:
W
=
self
.
S
W
=
self
.
S
...
...
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