summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-03-15 16:36:41 +0000
committerEdoardo Pasca <edo.paskino@gmail.com>2019-03-15 16:36:41 +0000
commit071f9b65e552ba338fa35e0798116a6ccd00802a (patch)
tree535c4959184b4678d51062bf248be68a120ed13a
parentb404c63042a496611de3ed03ca24d4b705feca7d (diff)
downloadframework-071f9b65e552ba338fa35e0798116a6ccd00802a.tar.gz
framework-071f9b65e552ba338fa35e0798116a6ccd00802a.tar.bz2
framework-071f9b65e552ba338fa35e0798116a6ccd00802a.tar.xz
framework-071f9b65e552ba338fa35e0798116a6ccd00802a.zip
squared_norm returns dot with self
-rwxr-xr-xWrappers/Python/ccpi/framework/framework.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Wrappers/Python/ccpi/framework/framework.py b/Wrappers/Python/ccpi/framework/framework.py
index 029a80d..499a2cd 100755
--- a/Wrappers/Python/ccpi/framework/framework.py
+++ b/Wrappers/Python/ccpi/framework/framework.py
@@ -755,10 +755,11 @@ class DataContainer(object):
return self.as_array().sum(*args, **kwargs)
def squared_norm(self):
'''return the squared euclidean norm of the DataContainer viewed as a vector'''
- shape = self.shape
- size = reduce(lambda x,y:x*y, shape, 1)
- y = numpy.reshape(self.as_array(), (size, ))
- return numpy.dot(y, y.conjugate())
+ #shape = self.shape
+ #size = reduce(lambda x,y:x*y, shape, 1)
+ #y = numpy.reshape(self.as_array(), (size, ))
+ #return numpy.dot(y, y.conjugate())
+ return self.dot(self)
def norm(self):
'''return the euclidean norm of the DataContainer viewed as a vector'''
return numpy.sqrt(self.squared_norm())