Mercurial > hg > what-is-octave
comparison FEMTEC2013/examples/embedded.cc @ 6:60233b0075a9
femtec presentation
author | Carlo de Falco <cdf@users.sourceforge.net> |
---|---|
date | Sun, 23 Jun 2013 23:37:41 +0200 |
parents | PoliMI2012/examples/embedded.cc@0a1567794b40 |
children |
comparison
equal
deleted
inserted
replaced
5:f8c352d9af2d | 6:60233b0075a9 |
---|---|
1 #include <iostream> | |
2 #include <octave/oct.h> | |
3 #include <octave/octave.h> | |
4 #include <octave/parse.h> | |
5 | |
6 int main (void) | |
7 { | |
8 string_vector octave_argv (2); | |
9 octave_argv(0) = "embedded"; | |
10 octave_argv(1) = "-q"; | |
11 | |
12 octave_main (2, octave_argv.c_str_vec (), 1); | |
13 | |
14 | |
15 octave_value_list out = feval ("version", octave_value_list (), 1); | |
16 std::cout << out(0).string_value () << std::endl; | |
17 | |
18 Matrix A (4, 4); | |
19 for (octave_idx_type i = 0; i < 4; i++) | |
20 for (octave_idx_type j = 0; j < 4; j++) | |
21 A(i,j) = 1.0 / (static_cast<double> (i) + | |
22 static_cast<double> (j) + 1); | |
23 | |
24 ColumnVector b (4, 1.0); | |
25 | |
26 out = feval ("mldivide", octave_value (A), octave_value (b), 1); | |
27 | |
28 return 0; | |
29 } |