sandialabs / pyttb

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

Update tenmat to updated constructor interface #214

Closed ntjohnson1 closed 7 months ago

ntjohnson1 commented 1 year ago

Follow up to

Follow changes from #182 for ktensor as a guide.

Constructors:

Add methods:

ntjohnson1 commented 1 year ago

Additional topics to cover from the tutorials:

Converting a Tensor to a Matrix and Vice Versa

ntjohnson1 commented 12 months ago

We want to update sptenmat similarly to match

ntjohnson1 commented 11 months ago

Right now our tenmat construction is a little bit of a mess. I suspect we are hitting some weirdness related to fortran layouts again. from_data actually creates a tensor then calls from_tensor as our base case. This is needed because from_tensor actually reshapes the matrix into the original tensor size then reflattens it which seems like it shouldn't be necessary (but we get a variety of failures if we skip that step).

ntjohnson1 commented 11 months ago

Ok. I figured out the decoupling. Currently from_data increased the scope from Matlab to accept any data that could be coerced into the correct shape instead of a matrix that can be unwrapped into a tensor. I should hopefully have a cleaned up version in the next few days.