Mercurial > hg > what-is-octave
comparison PoliMI2012/examples/embedded.cc @ 4:0a1567794b40
[mq]: folder_reorganization
author | Carlo de Falco <cdf@users.sourceforge.net> |
---|---|
date | Thu, 08 Nov 2012 09:55:34 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:acc25d26e9e5 | 4:0a1567794b40 |
---|---|
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 } |