Invert a matrix!!!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Invert a matrix!!!

TimYee
Hi,

I got stuck while trying to invert a matrix.

#include <iostream>
#include <ql/quantlib.hpp>

using namespace std;
using namespace QuantLib;

int main()
{
  Matrix M(3,3,0);
  int n=M.rows();

  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      if(i==j) M[i][j]=2;

  Matrix N = inverse(M);

  cout<<N;

return 0;
}

I thought inverse should be a function which should return a inverted matrix after giving a matrix to it. To play safe, I include <ql/quantlib.hpp>, but the compiler still says 'inverse' was not declared in the scope as below.

try.cpp:22: error: ‘inverse’ was not declared in this scope

Anybody could help me with this would be highly appreciated!!!

Tim


通过 Live.com 查看资讯、娱乐信息和您关心的其他信息! 立即尝试!
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users