From 071f9b65e552ba338fa35e0798116a6ccd00802a Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Fri, 15 Mar 2019 16:36:41 +0000 Subject: squared_norm returns dot with self --- Wrappers/Python/ccpi/framework/framework.py | 9 +++++---- 1 file 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()) -- cgit v1.2.3