How do I access the contents of the list of eigenvectors and eigenvectors in the C++ Octave API? -
i'm able write program uses c++ octave api find eigenvectors of matrix. here's example:
#include <iostream> #include <octave/oct.h> using namespace std;  int main() {   int n=5;   matrix l=matrix(n,n,2);    eig eig=eig(l);    cout << eig.eigenvalues() << endl;   cout << eig.eigenvectors() << endl;    return 0; }   which returns
(-5.46156e-18,0) (-3.1176e-32,0) (-4.86443e-49,0) (3.38528e-16,0) (10,0)   (-0.18545,0) (-0.408248,0) (0.707107,0) (-0.31455,0) (0.447214,0)  (-0.18545,0) (-0.408248,0) (-0.707107,0) (-0.31455,0) (0.447214,0)  (-0.18545,0) (0.816497,0) (-6.72931e-17,0) (-0.31455,0) (0.447214,0)  (-0.330948,0) (3.24211e-16,0) (-2.34737e-17,0) (0.830948,0) (0.447214,0)  (0.887298,0) (-1.07469e-15,0) (-6.0809e-33,0) (0.112702,0) (0.447214,0)   from here, access these eigenvalues -5.46156e-18, etc., , eigenvector values -0.18545, etc., floats.  how go doing that?  don't know syntax.
i'll admit i've never used c++ octave api, looking @ documentation, looks overload () match octave/matlab syntax, pretty cool. (and little terrifying, honestly)
for matrix, row, or column 'x', x(i, j) give element in ith row , jth column.  (note zero-indexed, unlike if using matlab or octave itself, one-indexed)
for row or column, can omit unnecessary dimension, x(n) return nth element, either row or column.  
Comments
Post a Comment