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

Iodide needs a Matrix First enviroment. #1

Open
gregglind opened this issue Dec 11, 2018 · 4 comments
Open

Iodide needs a Matrix First enviroment. #1

gregglind opened this issue Dec 11, 2018 · 4 comments

Comments

@gregglind
Copy link

Problem statement: Matrix work in JS stinks.

  1. Manipulating N-dimensional-Matrices is common in scientific computation.
  2. Current Javascript doesn't optimize code affordances for Matrices.
  3. Python / NumPy / SciPy matrix support feels 'bolted-on'.
  4. R, Octave / Matlab have affordances that make Matrix work better.

Features that make N-dimentional-Matrix work awesome

  1. Literals for creating them
  2. Getters / slices / masking
  3. Operators that mimic matrix algebra usage (.*)
  4. Names of useful matrix functions ('ones', 'zeros', 'triangle', 'svd') are 'close' to the surface.
  5. '1-based' indexed.
  6. Numerical precision, complex numbers, etc.
  7. Fast performance of matrix operations on Floats, ints, etc.
@gregglind
Copy link
Author

gregglind commented Dec 11, 2018

Proposed solution: Babel and TC39 work

Use Babel with transforms.

  1. Literals: create a matrix literal babel transform
  2. Slices: https://github.com/tc39/proposal-slice-notation
  3. Operators: https://github.com/keithamus/ecmascript-operator-overloading-proposal
  4. (Don't have a good solution. Littering the code with Matrix.ones seems terrible. See also the math object. We could pre load a lot more into the 'env', as with Node, or WebExtensions, or Window. This also has risks. Eslinting can help with a 'no-reassign-matrix' work.
  5. (I actually hate 1 based indexing)
  6. Wrap up LAPACK and friends.

@hamilton hamilton transferred this issue from pyodide/pyodide Dec 11, 2018
@hamilton
Copy link
Contributor

hamilton commented Dec 11, 2018

Thanks for the issue @gregglind! We've talked internally about making a babel mode for scientific computing needs (matrix stuff like broadcasting, precision, complex numbers, etc.) that connects to some library w/ an API, but not enough bandwidth right now to implement it. What you're proposing on a high-level matches a lot of what we've talked about on private channels.

WATLab syntax was something we were looking at earlier this year. @bcolloran has some strong thoughts about what this might all look like, so I'll let him chime in.

Layer-wise, we'll need:

  1. transpilation (get the syntax to solve the work flow issues)
  2. pure JS API
  3. backend of some sort (arrow? js typed arrays? etc.)

These clearly seem related, but could also be viewed as modular concerns.

@hamilton hamilton transferred this issue from iodide-project/iodide Dec 12, 2018
@hamilton
Copy link
Contributor

I've transferred this issue to our new repo, iodide-transpiler, to track progress.

@guidocalvano
Copy link

I also would prefer 0 based indexing. Numpy actually does not feel bolted on at all to me. In fact I greatly prefer it to both R and Matlab. Perhaps using webgl would be simpler way to accelerate matrix multiplication on gpu. This person accomplished it with a few hundred lines of code:

http://watmough.github.io/webgl-matrix-demo/
https://github.com/watmough/webgl-matrix-demo/blob/master/gpu_matrix.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants