-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1D tensor not displayed correctly #340
Comments
This is consistent with our documentation and numpy. We note that we follow the numpy convention for 1D tensors to be a row. Numpy has three flavors of 1D arrays of length N with shape (N,1), (1,N), and (N,) corresponding to explicit row, explicit column and a flexible 1D vector that can serve either. So I think this is conceptually aligned but visually different. Have you run into functional issues because of this or just stylistic? |
In MATLAB, we ensure any 1D tensor (or fiber of a larger tensor) is explicitly a column array. This is partly because MATLAB has no concept of a 1D array. But it's also consistent with the ordering of tensor modes. A row vector is technically a 1 x N tensor, whereas a column vector is an N or N x 1 tensor. This contrast to what you're saying, so I'm a bit confused. |
Also, where is this in the documentation? |
RE: Confusion >>> N = 4
>>> np.ones((N,))
array([1., 1., 1., 1.])
>>> np.ones((N,1))
array([[1.],
[1.],
[1.],
[1.]])
>>> np.ones((1,4))
array([[1., 1., 1., 1.]]) I think unless there is a strong functional reason we've tried to align design choices to numpy style since that is by far the most popular array/scientific computing package in python. We can see if the true 1-D array causes any issues for use or if its mostly just a style difference (unless you already have an example to review) |
Re: Documentation https://pyttb.readthedocs.io/en/stable/tensor.html#pyttb.tensor Above |
Discussion on #350 appears to subsume this so closing here so only tracking in one location |
When I display a 1D tensor, it has a spurious comma in the shape and is printed in row rather than column orientation:
Code:
Output:
Compare to MATLAB:
Output:
The text was updated successfully, but these errors were encountered: