From 08e2e788ebfaa70c16e954ae9bf0fdc7d80626c6 Mon Sep 17 00:00:00 2001
From: Marco Selig <mselig@ncg-02.MPA-Garching.MPG.DE>
Date: Wed, 17 Dec 2014 08:22:16 +0100
Subject: [PATCH] enforce value copying fiexed; cg residual reset.

---
 nifty_core.py  | 10 +++++-----
 nifty_tools.py |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/nifty_core.py b/nifty_core.py
index 3b6b96cd5..ec0186af8 100644
--- a/nifty_core.py
+++ b/nifty_core.py
@@ -514,7 +514,7 @@ class _about(object): ## nifty support class for global settings
 
         """
         ## version
-        self._version = "0.9.2"
+        self._version = "0.9.3"
 
         ## switches and notifications
         self._errors = notification(default=True,ccode=notification._code)
@@ -1238,7 +1238,7 @@ class space(object):
                 if(self.datatype is not x.domain.datatype):
                     raise TypeError(about._errors.cstring("ERROR: inequal data types ( '"+str(np.result_type(self.datatype))+"' <> '"+str(np.result_type(x.domain.datatype))+"' )."))
                 else:
-                    x = np.copy(x.val,order='C')
+                    x = np.copy(x.val)
             else:
                 raise ValueError(about._errors.cstring("ERROR: inequal domains."))
         else:
@@ -2527,7 +2527,7 @@ class rg_space(space):
                 if(self.datatype is not x.domain.datatype):
                     raise TypeError(about._errors.cstring("ERROR: inequal data types ( '"+str(np.result_type(self.datatype))+"' <> '"+str(np.result_type(x.domain.datatype))+"' )."))
                 else:
-                    x = x.val
+                    x = np.copy(x.val)
             else:
                 raise ValueError(about._errors.cstring("ERROR: inequal domains."))
         else:
@@ -3561,7 +3561,7 @@ class lm_space(space):
                 if(self.datatype is not x.domain.datatype):
                     raise TypeError(about._errors.cstring("ERROR: inequal data types ( '"+str(np.result_type(self.datatype))+"' <> '"+str(np.result_type(x.domain.datatype))+"' )."))
                 else:
-                    x = x.val
+                    x = np.copy(x.val)
             else:
                 raise ValueError(about._errors.cstring("ERROR: inequal domains."))
         else:
@@ -5513,7 +5513,7 @@ class nested_space(space):
                 if(self.datatype is not x.domain.datatype):
                     raise TypeError(about._errors.cstring("ERROR: inequal data types ( '"+str(np.result_type(self.datatype))+"' <> '"+str(np.result_type(x.domain.datatype))+"' )."))
                 else:
-                    x = x.val
+                    x = np.copy(x.val)
             elif(self.nest[-1]==x.domain):
                 if(self.datatype is not x.domain.datatype):
                     raise TypeError(about._errors.cstring("ERROR: inequal data types ( '"+str(np.result_type(self.datatype))+"' <> '"+str(np.result_type(x.domain.datatype))+"' )."))
diff --git a/nifty_tools.py b/nifty_tools.py
index 5a4667cf4..582fdee05 100644
--- a/nifty_tools.py
+++ b/nifty_tools.py
@@ -749,7 +749,7 @@ class conjugate_gradient(object):
         gamma = r.dot(d)
         if(gamma==0):
             return self.x,clevel+1
-        delta_ = self.b.norm**(-1)#np.absolute(gamma)**(-0.5) ## independent
+        delta_ = np.absolute(gamma)**(-0.5)
 
         convergence = 0
         ii = 1
@@ -815,7 +815,7 @@ class conjugate_gradient(object):
         gamma = r.dot(d)
         if(gamma==0):
             return self.x,clevel+1
-        delta_ = self.b.norm**(-1)#np.absolute(gamma)**(-0.5) ## independent
+        delta_ = np.absolute(gamma)**(-0.5)
 
         convergence = 0
         ii = 1
-- 
GitLab