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

outer product calculation error #10906

Closed
shuiyiwensi opened this issue Apr 15, 2018 · 2 comments
Closed

outer product calculation error #10906

shuiyiwensi opened this issue Apr 15, 2018 · 2 comments
Labels
57 - Close? Issues which may be closable unless discussion continued

Comments

@shuiyiwensi
Copy link

according to this and this the outer product of a b and outer product a.T b.T should not be the same

but when I do this
import numpy as np
a = np.array([[1], [2], [3]])
b = np.array([[4], [5], [6]])
col_result=np.outer(a, b)
row_result=np.outer(a.T, b.T)
print(col_result)
print(row_result)

the result are equal

@eric-wieser
Copy link
Member

np.outer is weird by design. From the docs, "Input is flattened if not already 1-dimensional". Your 2D input is flattened to 1D first.

Are you after np.multiply.outer(a, b), which produces a four dimensional array similar but not identical to this answer in your link

@mattip mattip added the 57 - Close? Issues which may be closable unless discussion continued label Apr 18, 2018
@mattip
Copy link
Member

mattip commented Aug 8, 2018

@shuiyiwensi did you resolve the issue? I am closing, please reopen with a new example if you feel something is still unclear.

@mattip mattip closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
57 - Close? Issues which may be closable unless discussion continued
Projects
None yet
Development

No branches or pull requests

3 participants