Closed tgkolda closed 1 week ago
Hmm, I think there are some hacks we could do to try and infer the variable name so it can print it back. This seems to be a python vs MATLAB difference.
I'd consider the python approach would be for the user to type
Print(f"{Y=}")
When python displays an array, it echos its name, so there is surely a way to do this. In MATLAB, every class has a function called "display" that is called to display the object. It can access some special object called inputname(1)
which we then use in the output. The approach you propose just puts "Y=" before but note that the MATLAB version reuses the name over and over again, in stating the size and printing the frontal slices.
Okay, Bing copilot has informed me that this is impossible. An example where MATLAB is way nice than Python! :-(
In MATLAB Tensor Toolbox, the display function picks up the variable name.
Input:
Output:
In pyttb, however, the tensor is always references as "tensor" and "data", no matter what its name is:
Input:
Output: