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
ecbc4221
Commit
ecbc4221
authored
Mar 13, 2013
by
Marco Selig
Browse files
field's L2-norm generalized to Lq-norm.
parent
0c38434c
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty_core.py
View file @
ecbc4221
...
...
@@ -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 L
2
-norm of the field values.
The L
q
-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
):
"""
...
...
nifty_power.py
View file @
ecbc4221
...
...
@@ -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.
"""
...
...
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