Mercurial > hg > what-is-octave
view FEMTEC2013/examples/embedded.cc @ 8:50abddcc3409 default tip
Presentation delivered by cdf at OctConf 2013.
author | Carlo de Falco <cdf@users.sourceforge.net> |
---|---|
date | Mon, 22 Jul 2013 21:54:27 +0200 |
parents | 60233b0075a9 |
children |
line wrap: on
line source
#include <iostream> #include <octave/oct.h> #include <octave/octave.h> #include <octave/parse.h> int main (void) { string_vector octave_argv (2); octave_argv(0) = "embedded"; octave_argv(1) = "-q"; octave_main (2, octave_argv.c_str_vec (), 1); octave_value_list out = feval ("version", octave_value_list (), 1); std::cout << out(0).string_value () << std::endl; 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); ColumnVector b (4, 1.0); out = feval ("mldivide", octave_value (A), octave_value (b), 1); return 0; }