diff options
author | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-23 09:34:31 +0100 |
---|---|---|
committer | epapoutsellis <epapoutsellis@gmail.com> | 2019-04-23 09:34:31 +0100 |
commit | ac8fd7c768aef99003b1da8618edee9949411573 (patch) | |
tree | 19eee515bffd6523507f58e7876de7a73e5f961a /Wrappers | |
parent | 9d5b84a8ca28cf87fe5d8772b277183f919a9bbc (diff) | |
download | framework-ac8fd7c768aef99003b1da8618edee9949411573.tar.gz framework-ac8fd7c768aef99003b1da8618edee9949411573.tar.bz2 framework-ac8fd7c768aef99003b1da8618edee9949411573.tar.xz framework-ac8fd7c768aef99003b1da8618edee9949411573.zip |
test add dot method
Diffstat (limited to 'Wrappers')
-rwxr-xr-x | Wrappers/Python/ccpi/framework/BlockDataContainer.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Wrappers/Python/ccpi/framework/BlockDataContainer.py b/Wrappers/Python/ccpi/framework/BlockDataContainer.py index 386cd87..823a1bd 100755 --- a/Wrappers/Python/ccpi/framework/BlockDataContainer.py +++ b/Wrappers/Python/ccpi/framework/BlockDataContainer.py @@ -270,6 +270,7 @@ class BlockDataContainer(object): def squared_norm(self): y = numpy.asarray([el.squared_norm() for el in self.containers]) return y.sum() + def norm(self): return numpy.sqrt(self.squared_norm()) @@ -442,9 +443,12 @@ class BlockDataContainer(object): '''Inline truedivision''' return self.__idiv__(other) +# def dot(self, other): +# +# tmp = [ self.containers[i].dot(other.containers[i]) for i in range(self.shape[0])] +# return sum(tmp) - - + if __name__ == '__main__': @@ -456,6 +460,7 @@ if __name__ == '__main__': BG = BlockGeometry(ig, ig) U = BG.allocate('random_int') + V = BG.allocate('random_int') print ("test sum BDC " ) @@ -468,10 +473,10 @@ if __name__ == '__main__': z1 = sum(U**2).sqrt().as_array() numpy.testing.assert_array_equal(z, z1) - - z2 = U.pnorm(2) + zzz = U.dot(V) + |