josdejong / josdejong/mathjs

mapping a matrix with matrices

Open
#3,658 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Currently when mapping a function that returns a matrix. The result is a matrix of matrices.

math.matrix([1]).map( a => math.matrix([a]))
// DenseMatrix [DenseMatrix [1]]

Previously it returned a singe matrix. The change was introduced in v13.2.0 at in an attempt to increase performance #3256

This is the issue found at #3654.

The fix is simple, but probably will affect performance, and if the matrix function returns matrices of different sizes it will fail.

I can work in the fix, just please validate if this is an issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the matrix mapping example from this issue and compare it with the behavior before v13.2.0 and the change in #3256. Inspect the matrix map implementation and related regression coverage; done means the expected matrix result is restored while behavior for matrices of different sizes and performance is understood and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.