Opened 5 months ago

Last modified 4 months ago

## #3728 new Bug

# _ArrayTranspose does not create 1D array from 2D array

Reported by: | Nine | Owned by: | |
---|---|---|---|

Milestone: | Component: | AutoIt | |

Version: | 3.3.14.5 | Severity: | None |

Keywords: | Cc: |

### Attachments (0)

### Change History (4)

### comment:1 Changed 5 months ago by Jos

### comment:2 Changed 5 months 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

**and this clearly changes the dimension order.**

`[[1], [2], [3]]`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

**which is 1D only.**

`[1, 2, 3]`
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 4 months 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 4 months 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.

### 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.

**Note:**See TracTickets for help on using tickets.

Please read the guidelines for bug reports again and be complete in your report!

--quote--

Bug Report GuidelinesYou 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