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

nc::linalg::pinv doesn't support non square matrix #215

Open
siferati opened this issue Sep 3, 2024 · 0 comments
Open

nc::linalg::pinv doesn't support non square matrix #215

siferati opened this issue Sep 3, 2024 · 0 comments

Comments

@siferati
Copy link

siferati commented Sep 3, 2024

Description

nc::linalg::pinv results in error when calling it with non square matrix.

File: /usr/local/include/NumCpp/NdArray/NdArrayCore.hpp
	Function: dot
	Line: 2751
	Error: shapes of [2, 9] and [2, 9] are not consistent.
Input:
[[0.11111111 1.        ]
 [0.22222222 1.        ]
 [0.33333333 1.        ]
 [0.44444444 1.        ]
 [0.55555556 1.        ]
 [0.66666667 1.        ]
 [0.77777778 1.        ]
 [0.88888889 1.        ]
 [1.         1.        ]]

Expected output (i.e. result of Python numpy.linalg.pinv):
[[-6.00000000e-01 -4.50000000e-01 -3.00000000e-01 -1.50000000e-01 6.97053522e-17  1.50000000e-01  3.00000000e-01  4.50000000e-01 6.00000000e-01]
 [ 4.44444444e-01  3.61111111e-01  2.77777778e-01  1.94444444e-01 1.11111111e-01  2.77777778e-02 -5.55555556e-02 -1.38888889e-01 -2.22222222e-01]]
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

1 participant