Dear Pantxo,
Thank you so much for your helpful reply in
http://octave.1599824.n4.nabble.com/mldivide-function-in-C-API-td4664414.html#a4664422
about my question in Fmldivide. I tried your suggestion as follow.
----------------
#include <iostream>
#include <octave/oct.h>
#include <octave/builtin-defun-decls.h>
int main (void) {
octave_value_list input;
octave_value_list retval;
Matrix A(4,4);
for (octave_idx_type i = 0; i < 4; i++)
for (octave_idx_type j = 0; j < 4; j++)
A(i,j) = 1.0 / (static_cast<double> (i) +static_cast<double> ( j ) +
1.0 ) ;
ColumnVector b(4,1.0);
input.append(A);
input.append(b);
retval=Fmldivide(input);
// retval=Fmldivide(ovl(A,b));
ColumnVector sol =input(0).column_vector_value();
std::cout << "A = " << std::endl << A<< std::endl
<< "b = " << std::endl << b << std::endl
<< "sol = " << std::endl << sol << std::endl;
return 0;
}
----------------
But when I type
$ mkoctfile --link-stand-alone main.cpp
$ ./a.out
it shows: Segmentation fault: 11.
Both retval=Fmldivide(input);
and retval=Fmldivide(ovl(A,b));
give the same error.
Can you please help me? Thank you so much!
_____________________________________
Sent from http://octave.1599824.n4.nabble.com