Modify

Opened 5 years ago

Closed 5 years 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:

Description

In the example of _ArrayTranspose, it states that a 2D array with $aArray[1][x] should return a 1D array. It does not, it returns a 2D array with $aArray[x][1].

Attachments (0)

Change History (8)

comment:1 Changed 5 years ago by Jos

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

comment:2 Changed 5 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 5 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 5 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 5 years ago by Jon

  • Component changed from AutoIt to Standard UDFs

comment:6 Changed 5 years ago by Jpm

  • Owner set to Jos
  • Status changed from new to assigned

comment:7 Changed 5 years ago by Melba23

  • Owner changed from Jos to Melba23

comment:8 Changed 5 years 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.

Add Comment

Modify Ticket

Action
as closed The owner will remain Melba23.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.