sandialabs / pyttb

Python Tensor Toolbox
https://pyttb.readthedocs.io
BSD 2-Clause "Simplified" License
25 stars 13 forks source link

Do we want to support `dtype` for different value types explicitly across the data classes? #274

Open dmdunla opened 1 year ago

dmdunla commented 1 year ago

This is a more general Issue related to the following:

Many of the methods for our data classes implicitly assume the tensor element types are float or boolean. We inherit some dtype differentiation from numpy, as many of our data classes use numpy.ndarray instances to store the data under the hood. However, this is not addressed explicity, except for in a few cases currently (mostly related to #270 in cases where output tensors contain boolean values.)

Do we want explicitly to support dtype in our data classes in a similar way to how numpy supports dtype?

Gabrielcarvfer commented 7 months ago

I have no idea how hard/how much work it is to do this, but it would be much appreciated, especially for complex types. Having a hard time finding a HOSVD implementation (trying to implement search-free PMI search for MIMO, and we need the complex numbers to estimate the angles and phase of the antenna beams). :)

For my specific case, just needed to add a tenmat.complex() call to get a complex numpy array, and replace the Yk = tenmat.double() for Yk = tenmat.complex(), plus replace the matrix Yk.transpose() with numpy.matrix(Yk).getH() for the hermitian transpose.

Your tensor toolbox for MATLAB was my primary option, but not everyone has a license, so this search-free implementation would probably be unused by people using our network simulator.

Thank you very much for both toolboxes.