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

Matrix multiply ignores strides #223

Closed
mateogianolio opened this issue Aug 10, 2021 · 0 comments
Closed

Matrix multiply ignores strides #223

mateogianolio opened this issue Aug 10, 2021 · 0 comments
Labels

Comments

@mateogianolio
Copy link
Owner

Reproducible example:

const x = range(0, 9).reshape(3, 3);

x.multiply(x)
/* array([
  [ 15, 18, 21 ],
  [ 42, 54, 66 ],
  [ 69, 90, 111 ]
], dtype=float64) */

x.T.multiply(x)
/* array([
  [ 15, 18, 21 ],
  [ 42, 54, 66 ],
  [ 69, 90, 111 ]
], dtype=float64)
... should be ...
array([
  [ 45, 54, 63 ],
  [ 54, 66, 78 ],
  [ 63, 78, 93 ]
], dtype=float64) */

Temporary workaround:

x.T.copy().multiply(x)

Proposed fix is to call copy() in multiply to normalise strides before performing the operation.

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

No branches or pull requests

1 participant