Mercurial > hg > what-is-octave
diff PoliMI2012/examples/standalone.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 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/PoliMI2012/examples/standalone.cc @@ -0,0 +1,21 @@ +#include <iostream> +#include <octave/oct.h> + +int main (void) +{ + + 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); + ColumnVector x = A.solve (b); + + std::cout << "A = " << std::endl << A << std::endl + << "b = " << std::endl << b << std::endl + << "x = " << std::endl << x << std::endl; + + return 0; +}