Skip to content

Possible to compute matrix decompositions asynchronously? #2859

Answered by josdejong
pjbarendrecht asked this question in Q&A
Discussion options

You must be logged in to vote

Good question. Yes that is possible. JavaScript is single threaded, but you can run computations in a separate webworker (browser) or child_process/thread (node.js).

There is an example on how to do this: https://mathjs.org/examples/browser/webworkers/index.html

If you use data classes like Matrix, you'll probably need to serialize/deserialize the data as described in the docs on Serialization, that isn't worked out in the example. You can also use a library like https://github.com/josdejong/workerpool to have a request/response API instead of messages.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pjbarendrecht
Comment options

Answer selected by pjbarendrecht
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants