Describe the bug
nc::linalg::lstsq accepts arguments of mathematically incompatible dimensions(a.k.a. shape):
The function claims to solve system of linear equations of form AX=B , so if dimensions of "A" are (4,3) then dimensions of "B" should be (4,1) but here the function accepts any shape as long as the total number of elements are four, be it (2,2). This is not the case with Numpy library of python.
To Reproduce
#include "NumCpp.hpp"
#include <filesystem>
#include <iostream>
int main()
{
auto a = nc::random::randInt<int>({ 4,3}, 0, 10);
auto b = nc::random::randInt<int>({ 2,2 }, 0, 10);
auto x = nc::linalg::lstsq(a, b);
std::cout<<"a:"<< std::endl;
std::cout<<a<< std::endl;
std::cout<<"b:"<< std::endl;
std::cout<<b<< std::endl;
std::cout<<"x:"<< std::endl;
std::cout<<x<< std::endl;
return 0;
}
Output
Expected behavior
Should throw an error
Describe the bug
nc::linalg::lstsq accepts arguments of mathematically incompatible dimensions(a.k.a. shape):
The function claims to solve system of linear equations of form AX=B , so if dimensions of "A" are (4,3) then dimensions of "B" should be (4,1) but here the function accepts any shape as long as the total number of elements are four, be it (2,2). This is not the case with Numpy library of python.
To Reproduce
Output
Expected behavior
Should throw an error