Opened 2 years ago
Closed 21 months ago
#3728 closed Bug (Fixed)
_ArrayTranspose does not create 1D array from 2D array
Reported by: | Nine | Owned by: | Melba23 |
---|---|---|---|
Milestone: | 3.3.15.3 | Component: | Standard UDFs |
Version: | 3.3.14.5 | Severity: | None |
Keywords: | Cc: |
Attachments (0)
Change History (8)
comment:1 Changed 2 years ago by Jos
comment:2 Changed 2 years ago by jchd18
The problem with (mathematical) vectors is that not all languages differentiate between row- and column-vectors. I mean AutoIt has to use 2D to represent a column vector.
Given some 1D data [1, 2, 3] as input, its transpose is forcibly 2D, namely [[1], [2], [3]] and this clearly changes the dimension order.
Transposing again that output isn't stable, since the function currently exchanges dimension 1 & 2, returning [[1, 2, 3]].
It could be considered sensible to ignore dimensions whose value is 1, but this gives way to another complaint: if my original input is 2D like [[1], [2], [3]], then transposing it twice isn't stable and doesn't respect the original dimension order, giving [1, 2, 3] which is 1D only.
So, either way the implementation of Transpose choose, it will make half of AutoIt users angry.
I don't know how to solve that dilemna.
Agreed, the second example of this help topic is misleading in this respect. Note that outside pure mathematical application or language (Mapple, Mathematica, Octave, MatLab, R, ...) it's quite rare to have to take utter care of vector organisation (row or column).
Adding an explicit note about this in the help would only confuse 99% of users, I'm afraid.
comment:3 Changed 2 years ago by Nine
I would then suggest to add a second optional parameter to force 2D into 1D. By default false, so no script breaking. True would provide a !D array under all circumstances.
comment:4 Changed 2 years ago by jchd18
Another option is to leave any 1D input untouched and return the same 1D array (without error).
People needing to differentiate between $A[1][5] (i.e. a row of Excell with values in the first 5 columns) and $A[5][1] (i.e. a column of Excell with values in the first 5 rows) will have to explicitely provide 2D arrays in one of the forms above.
All in all I believe this is what we should do about the question, but others may have a diverging opinion.
comment:5 Changed 21 months ago by Jon
- Component changed from AutoIt to Standard UDFs
comment:6 Changed 21 months ago by Jpm
- Owner set to Jos
- Status changed from new to assigned
comment:7 Changed 21 months ago by Melba23
- Owner changed from Jos to Melba23
comment:8 Changed 21 months ago by Melba23
- Milestone set to 3.3.15.3
- Resolution set to Fixed
- Status changed from assigned to closed
Fixed by revision [12303] in version: 3.3.15.3
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Please read the guidelines for bug reports again and be complete in your report!
--quote--
Bug Report Guidelines
You must provide a short test script that reproduces the problem. The script should be no more than the bare minimum code necessary to reproduce the problem.
Test the reproduction script with both the latest stable and latest beta versions of AutoIt. Check the links to ensure you have the latest versions, AutoIt is updated frequently.
Please choose the correct version and component for the ticket.
-- unquote
Thanks
Jos