Skip to content

Ndarray with column-major ordering cuts across array-of-arrays input #268

@rreusser

Description

@rreusser

Checklist

Please ensure the following tasks are completed before filing a bug report.

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.

Description

Description of the issue.

The following code produces an array whose shape does not match what I'd expect:

x = stdlib.array([[1, 2], [3, 4], [5, 6]], { order: 'column-major' })
x.shape
// => [3, 2]

As a matrix, it looks like:

[ 1 4 ]
[ 2 5 ]
[ 3 6 ]

The resulting matrix seems to cut across the array-of-arrays input. If you simply interpret this as a 2 x 3 array instead of 3 x 2, then it matches what I'd expect. I suspect but haven't confirmed that reversing the order of the inferred shape may solve the issue (for 2D and higher dimensionalities). See example and demonstration that reversing may fix here

Related Issues

Does this issue have any related issues?

No.

Questions

Any questions for reviewers?

No.

Other

Any other information relevant to this issue? This may include screenshots, references, stack traces, sample output, and/or implementation notes.

Demo

If relevant, provide a link to a live demo.

For a live demo of the issue, see

Reproduction

What steps are required to reproduce the unexpected output?

See above for code.

Expected Results

What are the expected results?

I expect the inner arrays of array-of-arrays input to show up in the constructed array as either a row or a column, not to be split and spread across multiple columns.

Actual Results

What are the actual results?

shape seems reversed in a manner that spreads inner arrays across multiple columns.

Environments

What environments are affected (e.g., Node v0.4.x, Chrome, IE 11)? If Node.js, include the npm version, operating system, and any other potentially relevant platform information.

The following environments are affected:

  • Usage in Chrome with stdlib-tree.

Metadata

Metadata

Assignees

Labels

BugSomething isn't working.MathIssue or pull request specific to math functionality.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions