Commit ecbc4221 authored by Marco Selig's avatar Marco Selig

field's L2-norm generalized to Lq-norm.

parent 0c38434c
......@@ -5897,17 +5897,27 @@ class field(object):
x = self.domain.calc_weight(x,power=1)
return self.domain.calc_dot(self.val,x)
def norm(self): ## TODO: extend to L^q norm
def norm(self,q=None):
"""
Computes the L2-norm of the field values.
Computes the Lq-norm of the field values.
Parameters
----------
q : scalar
Parameter q of the Lq-norm (default: 2).
Returns
-------
norm : scalar
The L2-norm of the field values.
The Lq-norm of the field values.
"""
return np.sqrt(self.dot(x=self.val))
if(q is None):
return np.sqrt(self.dot(x=self.val))
else:
return self.dot(x=self.val**(q-1))**(1/q)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def pseudo_dot(self,x=1,**kwargs):
"""
......
......@@ -36,11 +36,8 @@
homogeneity and isotropy. Fields which are only statistically homogeneous
can also be created using the diagonal operator routine.
At the moment, NIFTy offers one additional routine for power spectrum
manipulation, the smooth_power function to smooth a power spectrum with a
Gaussian convolution kernel. This can be necessary in cases where power
spectra are reconstructed and reused in an iterative algorithm, where
too much statistical variation might severely effect the results.
At the moment, NIFTY offers several additional routines for power spectrum
manipulation.
"""
......
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