The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

Very new user - Lapack++ problem

Open discussion regarding features, bugs, issues, vendors, etc.

Very new user - Lapack++ problem

Postby doug_kit » Mon Nov 30, 2009 5:38 pm

Hello community,

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.......
doug_kit
 
Posts: 2
Joined: Mon Nov 30, 2009 5:05 pm

Re: Very new user - Lapack++ problem

Postby gorcee » Tue Dec 01, 2009 1:55 pm

I am not very familiar with Lapack++, but naively might it have something to do with passing the function arguments as const's?

From my limited knowledge of C++, it seems as though using const in specifying parameters being passed into a function will prevent those parameters from being modified.

Have you tried your code without const in the function parameters?
gorcee
 
Posts: 7
Joined: Mon Nov 30, 2009 1:14 pm

Re: Very new user - Lapack++ problem

Postby doug_kit » Wed Dec 02, 2009 12:40 pm

Thanks for the suggestion, but I have still not got it working.

I have switched to calling the fortran lapack directly and am having slightly better luck.
doug_kit
 
Posts: 2
Joined: Mon Nov 30, 2009 5:05 pm

Re: Very new user - Lapack++ problem

Postby phoebe » Fri Jan 08, 2010 3:23 am

I'm also sharing with the same problem and hope I'll make it work...
I'm also a new user of Lapack++
phoebe
 
Posts: 1
Joined: Fri Jan 08, 2010 3:16 am


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 5 guests