Cleaned size checks.

Added functions: zeros, ones, trace, elementWiseProduct and
elementWiseProduct_inplace
renamed functions to be with _inplace when they replace "this".
This commit is contained in:
Samer Afach
2016-10-17 23:24:04 +02:00
parent f65ea9ccbd
commit 03ff1f639a
4 changed files with 120 additions and 102 deletions

View File

@@ -44,6 +44,9 @@ int RunTests()
int main()
{
int len = 3;
Poly::Matrix<double> mat_d = Poly::RandomMatrix<double>(len,len,0,10,std::random_device{}());
Poly::Matrix<double> mat_e = Poly::RandomMatrix<double>(len,len,0,10,std::random_device{}());
RunTests();
std::cout<<"Tests program exited with no errors."<<std::endl;
return 0;

View File

@@ -48,7 +48,7 @@ bool TestInverse(int len, bool print)
if(print) std::cout<<mat_d<<std::endl;
if(print) std::cout<<mat_d.asString(32,'[',']',',')<<std::endl;
int prec = precision_per_type<T>();
auto mat_d_i = mat_d.getInverse();
auto mat_d_i = mat_d.inverse();
PyObject *main = PyImport_AddModule("__main__");
PyRun_SimpleString(std::string("data={}").c_str());
PyRun_SimpleString(std::string("data['a']=np.matrix(" + mat_d.asString(32,'[',']',',') + ",dtype="+python_type_per_type<T>()+")").c_str());