Boost logo

Ublas :

Subject: Re: [ublas] Newbie getting started
From: pem (pemryan_at_[hidden])
Date: 2012-04-11 12:33:46

me too have no experience on the usage of numeric bindings.
once I called lapack routine like this:

#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>

extern "C" void dgetri_(const int* n, double* a, const int* lda,
const int* ipiv, double* work, const int* lwork, int* info);

int main() {

matrix<double> A(2,2);
A(0,0) = ...;

vector<int> ipiv(2);
ipiv(0) = ...;

int n = A.size2();
int lda = n;
int lwork = n*n;
vector<double> work(lwork);
const int* ipiv_ = &[0];
double* work_ = &[0];
double* A_ = &[0];

int info;
dgetri_(&n, A_, &lda, ipiv_, work_, &lwork, &info);


simply link with lapack would get it work.
note that by default ublas matrix is column major and there are options for row major.

if you need to call many routines of lapack, I think it's more efficicent to use the numric bindings you find in sanbox.




Ryan Ren

·¢¼þÈË£º Ushtarador
·¢ËÍʱ¼ä£º 2012-04-11 22:45:07
ÊÕ¼þÈË£º ublas
Ö÷Ì⣺ [ublas] Newbie getting started
Hey there,
I am trying to calculate eigenvalues of small, dense matrices. Since the
project is already using boost, I am trying to get LAPACK working, but since
i am not very experienced, I am stuck at the moment. I've been searching for
hours now, but noboy seems to have such basic problems.
I now have:
- The library file LAPACK.lib
- A Visual Studio 2008 project where I would like to calculate eigenvalues
of a boost matrix
I also added the svn repository
to the boost-directory on my harddisk, but I am not sure if I did something
Could someone please give me step-by-step instructions how to proceed now?