Commit c6b2dea3 authored by Marco Selig's avatar Marco Selig

minor improvement of projection_operator.

parent 6e23c2ab
......@@ -484,7 +484,7 @@ class _about(object): ## nifty support class for global settings
"""
## version
self._version = "0.4.0"
self._version = "0.4.1"
## switches and notifications
self._errors = notification(default=True,ccode=notification._code)
......@@ -9652,7 +9652,7 @@ class projection_operator(operator):
band = int(band)
if(band>self.bands()-1)or(band<0):
raise TypeError(about._errors.cstring("ERROR: invalid band."))
Px = np.zeros(self.domain.dim(split=True),dtype=self.domain.datatype,order='C').flatten(order='C')
Px = np.zeros(self.domain.dim(split=False),dtype=self.domain.datatype,order='C')
Px[self.ind[band]] += x.val.flatten(order='C')[self.ind[band]]
Px = field(self.domain,val=Px,target=x.target)
return Px
......@@ -9664,7 +9664,7 @@ class projection_operator(operator):
bandsup = np.array(bandsup,dtype=np.int)
if(np.any(bandsup>self.bands()-1))or(np.any(bandsup<0)):
raise ValueError(about._errors.cstring("ERROR: invalid input."))
Px = np.zeros(self.domain.dim(split=True),dtype=self.domain.datatype,order='C').flatten(order='C')
Px = np.zeros(self.domain.dim(split=False),dtype=self.domain.datatype,order='C')
x_ = x.val.flatten(order='C')
for bb in bandsup:
Px[self.ind[bb]] += x_[self.ind[bb]]
......
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