Commit 1fb986e3 authored by Marco Selig's avatar Marco Selig
Browse files

comments and real-array-glitch corrected.

parent 5bdcc718
...@@ -1497,7 +1497,7 @@ class space(object): ...@@ -1497,7 +1497,7 @@ class space(object):
## inner product ## inner product
dot = np.dot(np.conjugate(x),y,out=None) dot = np.dot(np.conjugate(x),y,out=None)
if(np.isreal(dot)): if(np.isreal(dot)):
return np.real(dot) return np.asscalar(np.real(dot))
else: else:
return dot return dot
...@@ -2186,7 +2186,7 @@ class rg_space(space): ...@@ -2186,7 +2186,7 @@ class rg_space(space):
Only even numbers of grid points per axis are supported. Only even numbers of grid points per axis are supported.
The basis transformations between position `x` and Fourier mode `k` The basis transformations between position `x` and Fourier mode `k`
rely on (inverse) fast Fourier transformations using the rely on (inverse) fast Fourier transformations using the
:math:`exp(2 \pi i k^\dagger x)`-formulation. :math:`exp(2 \pi i k^\dagger x / N)`-formulation.
Attributes Attributes
---------- ----------
...@@ -2908,12 +2908,12 @@ class rg_space(space): ...@@ -2908,12 +2908,12 @@ class rg_space(space):
## inner product ## inner product
dot = np.dot(np.conjugate(x.flatten(order='C')),y.flatten(order='C'),out=None) dot = np.dot(np.conjugate(x.flatten(order='C')),y.flatten(order='C'),out=None)
if(np.isreal(dot)): if(np.isreal(dot)):
return np.real(dot) return np.asscalar(np.real(dot))
elif(self.para[(np.size(self.para)-1)//2]!=2): elif(self.para[(np.size(self.para)-1)//2]!=2):
## check imaginary part ## check imaginary part
if(np.absolute(dot.imag)>self.epsilon**2*np.absolute(dot.real)): if(np.absolute(dot.imag)>self.epsilon**2*np.absolute(dot.real)):
about.warnings.cprint("WARNING: discarding considerable imaginary part.") about.warnings.cprint("WARNING: discarding considerable imaginary part.")
return np.real(dot) return np.asscalar(np.real(dot))
else: else:
return dot return dot
...@@ -5930,7 +5930,7 @@ class nested_space(space): ...@@ -5930,7 +5930,7 @@ class nested_space(space):
## inner product ## inner product
dot = np.sum(np.conjugate(x)*y,axis=None,dtype=None,out=None) dot = np.sum(np.conjugate(x)*y,axis=None,dtype=None,out=None)
if(np.isreal(dot)): if(np.isreal(dot)):
return np.real(dot) return np.asscalar(np.real(dot))
else: else:
return dot return dot
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment