I have only just recently come from being a Windows + Matlab user, to a linux + C++ user (for various reasons), and so there are quite a few things that seem to be beyond me at the moment.
The program I am writing for my research will want to solve a large system of linear equations, and so I turned to lapack++. After a day of trying to get a simple case going, I thought I had done it last night. However today I have not been able to reach the same stage, and have been banging my head against the screen for another day (I think maybe I adjusted something before I left last night then forgot about it)
Anyway, enough background - I will paste in my test case so you can all have a chuckle:
- Code: Select all
include <laslv.h>
#include <fstream>
//g++ -o lapackpptester lapackpptester.cpp -I /usr/local/include/lapackpp/
using namespace std;
int main()
{
double A[4] = {1,2,3,4};
double X[2] = {0,0};
double B[2] = {1,3};
void LaLinearSolve( const LaGenMatDouble& A, LaGenMatDouble& X, const LaGenMatDouble& B );
ofstream myFile("test.dat");
myFile<<"the answer:"<<"\n";
myFile<<X[0]<<"\t"<<X[1]<<"\n";
myFile.close();
}
^^ that is the entirety of the code.
I compile with: g++ -o lapackpptester lapackpptester.cpp -I /usr/local/include/lapackpp/
and I get no errors.
It also runs with no errors, however the X vector has not changed.
Where I think i'm going wrong is the declaration of the vectors as doubles initially, whereas they should be declared in the class of LaGenMatDouble, but I can't get this to work.
I also think I should be including the header file gmd.h as well, though I am not too sure.
Just a couple of notes:
-I am running Ubuntu Linux, 64 Bit.
I installed lapack and blas by going into synaptic package manage and ticking the boxes, that is all.
I downloaded the lapackpp 2.5.5 and followed the instructions for install, ie ./configure, then make, then sudo make install. However when i performed sudo make check it said 1 of 2 tests had failed, yet I do not know how to correct this.
I do hope that I am not too far below the level of typical problems that I am wasting your time, but your help will be greatly appreciated. I will be checking back here every hour or so, so feel free to ask for more information.
if only i could do x=A\b like in my beloved matlab.......

