Commit 4a3fa523 authored by Ultima's avatar Ultima
Browse files

Finished rework of probing classes.

Finished operator and diagonal_operator.
parent 988981a0
......@@ -18,6 +18,7 @@ operators/*
!operators/nifty_explicit.py
!operators/nifty_operators.py
!operators/nifty_probing.py
!operators/nifty_probing_old.py
rg/*
......
......@@ -912,17 +912,14 @@ class space(object):
else:
return mars
def __eq__(self,x): ## __eq__ : self == x
def __eq__(self, x): ## __eq__ : self == x
if isinstance(x, type(self)):
return self._identifier() == x._identifier()
else:
return False
def __ne__(self,x): ## __ne__ : self <> x
if(isinstance(x,space)):
if(not isinstance(x,type(self)))or(np.any(self.para!=x.para))or(self.discrete!=x.discrete)or(np.any(self.vol!=x.vol))or(np.any(self._meta_vars()!=x._meta_vars())): ## data types are ignored
return True
return False
def __ne__(self, x):
return not self.__eq__(x)
def __lt__(self,x): ## __lt__ : self < x
if(isinstance(x,space)):
......@@ -1165,6 +1162,8 @@ class point_space(space):
"argmax" : _argmax,
"argmax_flat" : np.argmax,
"conjugate" : np.conjugate,
"sum" : np.sum,
"prod" : np.prod,
"None" : lambda y: y}
......@@ -2648,7 +2647,7 @@ class field(object):
The space wherein the operator output lives (default: domain).
"""
def __init__(self,domain,val=None,target=None,**kwargs):
def __init__(self, domain, val=None, target=None, **kwargs):
"""
Sets the attributes for a field class instance.
......@@ -2878,6 +2877,7 @@ class field(object):
new_field.set_val(new_val = self.domain.calc_weight(self.get_val(),
power = power))
return new_field
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......
......@@ -54,7 +54,7 @@ from nifty_operators import operator,\
diagonal_operator,\
identity,\
vecvec_operator
from nifty_probing import probing
from nifty_probing_old import probing
##-----------------------------------------------------------------------------
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -254,6 +254,8 @@ class rg_space(point_space):
"argmax" : lambda y: getattr(y, 'argmax')(),
"argmax_flat" : lambda y: getattr(y, 'argmax_flat')(),
"conjugate" : lambda y: getattr(y, 'conjugate')(),
"sum" : lambda y: getattr(y, 'sum')(),
"prod" : lambda y: getattr(y, 'prod')(),
"None" : lambda y: y}
return translation[op](x, **kwargs)
......
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