Currently, multiplying an array by a non-ctf scalar, doesn't preserve e.g. single precision:
import ctf
import numpy as np
x = ctf.random.random((2,)).astype(np.float32)
print(x.dtype)
# numpy.float32
test_cs = [
2,
2.,
2j,
]
# left multiply
for c in test_cs:
print(c, (c * x).dtype)
# 2 <class 'numpy.float64'>
# 2.0 <class 'numpy.float64'>
# 2j <class 'numpy.complex128'>
# right multiply
for c in test_cs:
print(c, (x * c).dtype)
# 2 <class 'numpy.float64'>
# 2.0 <class 'numpy.float64'>
# 2j <class 'numpy.complex128'>
I guess one expected behaviour, i.e. matching numpy, is to produce [float32, float32, complex64].
The current behaviour might be intentional but thought I'd note this here in case.
Currently, multiplying an array by a non-ctf scalar, doesn't preserve e.g. single precision:
I guess one expected behaviour, i.e. matching numpy, is to produce
[float32, float32, complex64]
. The current behaviour might be intentional but thought I'd note this here in case.