help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A continued question on Octave C++


From: Pantxo Diribarne
Subject: Re: A continued question on Octave C++
Date: Mon, 09 Jun 2014 18:23:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Le 08/06/2014 21:15, address@hidden a écrit :
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

Jeremy,

Please, for questions about octave, write to the help mailing list, no to individuals.

See the second example in [1]: to use builtin or dynamically loaded functions in a standalone program, you need to start octave interpreter.

Pantxo

[1] http://www.gnu.org/software/octave/doc/interpreter/Standalone-Programs.html





reply via email to

[Prev in Thread] Current Thread [Next in Thread]