[Trilinos-Users] Problems with Teuchos_LAPACK::GESVD

Chetan Jhurani chetan.jhurani at gmail.com
Wed Nov 21 15:19:40 MST 2012

LAPACK, and by extension Teuchos, expects matrices as
1-D arrays in memory rather than as arrays of arrays like
it is in your code.  If you have something like this below
for A, U and V, then GESVD should work fine.

  std::vector<double> Avec(m*n);
  for (int i=0; i<m; i++) {
    for (int j=0; j<n; j++){
      Avec[i + m*j] = n*i+j+1;      


> -----Original Message-----
> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-users-bounces at software.sandia.gov]
> On Behalf Of Kemelli C. Estacio-Hiroms
> Sent: Wednesday, November 21, 2012 1:50 PM
> To: trilinos-users at software.sandia.gov
> Subject: [Trilinos-Users] Problems with Teuchos_LAPACK::GESVD
> Hi everyone
> I am not sure if this is the forum where I should post my doubts with
> Teuchos_LAPACK::GESVD, but I will give it a try (and my apologies if I
> am in the wrong place :) )
> I need to encapsulate the function Teuchos_LAPACK::GESVD, for singular
> value decomposition of a matrix in a complex code, and as a first
> step, I wrote a simple code for it.
> However, the results I am getting are not right and even after a good
> amount of looking around, I can't figure out if the bug is mine or at
> Trilinos/Teuchos/Lapack.
> Would anybody, please, give me some insights? I am attacing my simple
> code here, together with the Makefile I am using.
> Thanks a lot!
> Kemelli.
> --
> Kemelli C. Estacio-Hiroms
> Postdoctoral Researcher
> Institute for Computational Engineering and Sciences
> The University of Texas at Austin
> (512) 299-8403
> kemelli at ices.utexas.edu

More information about the Trilinos-Users mailing list