Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Array/Matrix From Function #2153

Closed
fweth opened this issue Mar 31, 2021 · 3 comments · Fixed by #2155
Closed

Feature Request: Array/Matrix From Function #2153

fweth opened this issue Mar 31, 2021 · 3 comments · Fixed by #2155

Comments

@fweth
Copy link

fweth commented Mar 31, 2021

Something like NumPy's fromfunction would be cool, specify a shape and a function to create an array or a matrix. E.g. math.fromFunction((x, y) => x * y, [3, 3]) would return [[0, 0, 0], [0, 1, 2], [0, 2, 4]].

@josdejong
Copy link
Owner

That is a really nice idea!

Anyone interested in implementing this function?

@HK-SHAO
Copy link
Contributor

HK-SHAO commented Apr 2, 2021

Really cool!

josdejong added a commit that referenced this issue May 9, 2021
* made dense and sparse matrices iterable, fixed #1184

* added matrixFromFunction, fixes #2153

* added tests for matrixFromFunction

* added matrixFromRows

* added matrixFromColumns

* added rows() and columns() for dense matrix

* improved sparse documentation a tiny bit

* fix linting issues

* added matrixFromRow/Column to seealso of row and column

* removed unnecessary duplication from matrixFromRows/Columns

* added babel runtime

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
@josdejong
Copy link
Owner

Published in v9.4.0

joshhansen pushed a commit to LearnSomethingTeam/mathjs that referenced this issue Sep 16, 2021
* made dense and sparse matrices iterable, fixed josdejong#1184

* added matrixFromFunction, fixes josdejong#2153

* added tests for matrixFromFunction

* added matrixFromRows

* added matrixFromColumns

* added rows() and columns() for dense matrix

* improved sparse documentation a tiny bit

* fix linting issues

* added matrixFromRow/Column to seealso of row and column

* removed unnecessary duplication from matrixFromRows/Columns

* added babel runtime

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants