Re: Problems with CLAPACK SVD routines on OS X



Robert V. wrote:
Hello,

I apologize if these questions have been addressed before, but I am
new to both C++ and LAPACK.

I am trying to write a program to calculate the SVD of a term-document
matrix. Since I have no experience with Fortran, I thought it best to
do this in C/C++. I am doing my development on an Intel Mac running OS
X 10.4.10.

I am able to get results using Lapack's dgesvd routine, but only when

Great! So your libraries and routine calls are working properly.



The following program is based on the sample above, but it differs in
that I have to allocate my arrays dynamically. Unfortunately, I can't
seem to get it to run without seg faulting during the call to dgesvd:



####
#include <vecLib/vecLib.h>

I am not familiar with this header file. What does it do and why do you
need it?


I wanted to run this code of yours (I have lapack libraries installed on
my Linux system) but I do not have a data file that you are trying to
read. But I couldn't get the program compiled ....



g++ svd_test.cpp -I/usr/local/include -framework vecLib -o svd

.... If I try to compile your program, I get (after excluding fstream and
sstream headers):

$> g++ testsvn.cc ~/lib/lapack_LINUX.a -I~/include/ -o testsvd
testsvn.cc:1:27: error: vecLib/vecLib.h: No such file or directory
testsvn.cc: In function ‘int main(int, char**)’:
testsvn.cc:27: error: variable ‘std::ifstream infile’ has initializer
but incomplete type
testsvn.cc:46: error: variable ‘std::istringstream s’ has initializer
but incomplete type
testsvn.cc:85: error: variable ‘std::istringstream s’ has initializer
but incomplete type
testsvn.cc:91: error: statement cannot resolve address of overloaded
function
testsvn.cc:122: error: ‘dgesvd_’ was not declared in this scope


So, doesn't your g++ compiler not give any warnings or errors at all?
Try with the "-Wall" switch.

Next, can you send us an example date file you are trying out? You don't
need a huge matrix, try with a much smaller one (would help in debugging).

So let us what warnings you get from your compiler and send an example
data file as well and then I will try again.

regards,
->HS



./svd small.matrix
Opening small.matrix
Initializing a 5 x 15513 matrix
Finished initializing...
Initializing LWORK...
Calculating SVD...
Segmentation fault

I suspect that my problem stems from my confusion about row-major vs
column-major matrices, but this is a shot in the dark. Any insight
would be greatly appreciated.

Thanks!
Robert

.



Relevant Pages

  • RE: numerical libraries on integrity
    ... Perhaps some of the LAPACK, BLAS, LINPACK, etc are now meant to be ... Alpha) compiler, as well as Jack Dongarra's unrolling, it will unroll ...
    (comp.os.vms)
  • Re: SMP LAPACK
    ... How well to real Fortran compilers automatically parallelize ... The LAPACK libraries make use of lower level routines from the BLAS ... Note that in using these threaded libraries the compiler doesn't ...
    (sci.math.num-analysis)
  • Re: Who uses clapack?
    ... Something to wrap around the BLAS and LAPACK, ... arround a general purpose vector class along with a dense rectangular Matrix ... work for both real and complex matrices. ... Miccrosoft VC6 or Linux GCC compiler to use it. ...
    (sci.math.num-analysis)
  • Re: Who uses clapack?
    ... Something to wrap around the BLAS and LAPACK, ... arround a general purpose vector class along with a dense rectangular Matrix ... work for both real and complex matrices. ... Miccrosoft VC6 or Linux GCC compiler to use it. ...
    (comp.lang.c)
  • Re: Who uses clapack?
    ... Something to wrap around the BLAS and LAPACK, ... arround a general purpose vector class along with a dense rectangular Matrix ... work for both real and complex matrices. ... Miccrosoft VC6 or Linux GCC compiler to use it. ...
    (comp.lang.fortran)