[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using expm in C++

From: loisp
Subject: Using expm in C++
Date: Mon, 6 Feb 2012 14:58:50 -0800 (PST)


I'm writing a C++ program and want to use the Octave function expm()
(exponential of a matrix). Here is the relevant snippet from my code. 

        hamiltonian = Matrix (N+1, N+1);                                        
        for(int i = 0; i < N+1; i++) 
                for(int j = 0; j < N+1; j++) 
                        if((i+1 == j) || (i == j+1))
                                hamiltonian (i, j) = -1;

        hamiltonian = hamiltonian.expm();

When I try to compile my program using mkoctfile I get the following error 

        dmatrix.cpp: In function ‘int main()’:
        dmatrix.cpp:54: error: ‘class Matrix’ has no member named ‘expm’

I was wondering if the classes Matrix and ComplexMatrix provide that
function and if they don't, do you have any work around to suggest? I am
using MacOSX and have Octave installed though fink.

Thanks in advance. 


View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]