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

Add .scalarDivide to Matrix and Vector classes #79

Open
jbrown1618 opened this issue Sep 3, 2019 · 1 comment
Open

Add .scalarDivide to Matrix and Vector classes #79

jbrown1618 opened this issue Sep 3, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@jbrown1618
Copy link
Owner

jbrown1618 commented Sep 3, 2019

This is not technically a real matrix operation, but it is commonly needed, particularly for scaling. Right now, the approach commonly used is:

const inverse = ops.getMultiplicativeInverse(scaleFactor);
if (inverse === undefined) return someDefault;
return vector.scalarMultiply(inverse);

But this introduces a little bit of numerical error - 10 * (1/3) is less accurate than 10 / 3. We will need to re-implement NumberOperations.divide to get this to work correctly.

In particular, this will make the gauss-jordan equation solver more accurate.

@jbrown1618
Copy link
Owner Author

First attempt resulted in worse accuracy for some operations. This could be a fun investigation for a rainy day.

@jbrown1618 jbrown1618 added the enhancement New feature or request label Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant