cyclops-community / ctf

Cyclops Tensor Framework: parallel arithmetic on multidimensional arrays
Other
199 stars 53 forks source link

norm2() returns wrong result for a complex vector #79

Closed yuchenpang closed 4 years ago

yuchenpang commented 4 years ago
import ctf
a = ctf.zeros(2, dtype=complex) # 'dtype=complex' is necessary to reproduce
a[0] = 1.0
print(a.norm2()) # 1.0
a *= 2.0
print(a) # array([2.+0.j, 0.+0.j])
print(a.norm2()) # 4.0 (should be 2.0)

This is found when using Python interface. Haven't tried to reproduce it in C++ interface yet.