[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mldivide function in C++ API
From: |
rain |
Subject: |
Re: mldivide function in C++ API |
Date: |
Fri, 6 Jun 2014 13:27:40 -0700 (PDT) |
Hi c.,
I tried your suggestion with the method Matrix::solve:
______________
#include <iostream>
#include <octave/oct.h>
int main (void) {
Matrix A(1000,1000);
for (octave_idx_type i = 0; i < 1000; i++)
for (octave_idx_type j = 0; j < 1000; j++)
A(i,j) = 1.0 / (static_cast<double> (i) +static_cast<double> ( j
) + 1.0 ) ;
ColumnVector b(1000,1.0);
ColumnVector sol=A.solve(b);
std::cout << "A = " << std::endl << A<< std::endl
<< "b = " << std::endl << b << std::endl
<< "sol = " << std::endl << sol << std::endl;
return 0;
}
________________
But for the big size matrix, there is a problem shown as:
_____________
fatal: matrix singular to machine precision, rcond = 7.46938e-23
_____________
So that is the reason I want to know whether backslash is better.
Thank you!
--
View this message in context:
http://octave.1599824.n4.nabble.com/mldivide-function-in-C-API-tp4664414p4664537.html
Sent from the Octave - General mailing list archive at Nabble.com.