Update of /cvsroot/lapackpp/lapackpp/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20813/src
Modified Files:
Makefile.am
Added Files:
lasvd.cc
Log Message:
2004-05-04 Christian Stimming <sti...@tu...>
* include/lasvd.h, src/lasvd.cc: Initial work for SVD functions.
--- NEW FILE: lasvd.cc ---
//
// LAPACK++ 1.1 Linear Algebra Package 1.1
// University of Tennessee, Knoxvilee, TN.
// Oak Ridge National Laboratory, Oak Ridge, TN.
// Authors: J. J. Dongarra, E. Greaser, R. Pozo, D. Walker
// (C) 1992-1996 All Rights Reserved
//
// NOTICE
//
// Permission to use, copy, modify, and distribute this software and
// its documentation for any purpose and without fee is hereby granted
// provided that the above copyright notice appear in all copies and
// that both the copyright notice and this permission notice appear in
// supporting documentation.
//
// Neither the Institutions (University of Tennessee, and Oak Ridge National
// Laboratory) nor the Authors make any representations about the suitability
// of this software for any purpose. This software is provided ``as is''
// without express or implied warranty.
//
// LAPACK++ was funded in part by the U.S. Department of Energy, the
// National Science Foundation and the State of Tennessee.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <iostream>
#include "lapack.h"
#include "lapackc.h"
#include "lafnames.h"
#include LA_GEN_MAT_DOUBLE_H
#include LA_VECTOR_DOUBLE_H
#include LA_VECTOR_LONG_INT_H
#include LA_GEN_MAT_COMPLEX_H
#include LA_VECTOR_COMPLEX_H
#include LA_EXCEPTION_H
#include LA_SOLVE_DOUBLE_H
#include LA_UTIL_H
#include "lasvd.h"
using std::min;
#if !LAPACK_USE_GCC3
# ifndef min
# define min(A,B) ((A) < (B) ? (A) : (B) )
# endif
#endif
#ifdef LA_COMPLEX_SUPPORT
// General QR solver
//
// M x N N x nrhs M x nrhs
//
void LaSVD_IP(LaGenMatComplex& A, LaVectorDouble &Sigma, LaGenMatComplex& U, LaGenMatComplex& VT )
{
#ifndef HPPA
const char fname[] = "LaSVD_IP(LaGenMatComplex &A, &X, &B)";
#else
char *fname = NULL; // HP C++ does not support string initalization!
#endif
// let's not worry about non-unit column strides for the moment
if ( A.inc(0) != 1 || A.inc(1) != 1)
throw(LaException(fname, "A is non-contiguous."));
char jobz = 'A';
integer info;
int M = A.size(0);
int N = A.size(1);
integer Ml = M;
integer Nl = N;
integer lda = A.inc(0) * A.gdim(0);
// int nrhs = X.size(1);
// integer nrhsl = nrhs;
if (Sigma.size() != min(M,N))
throw LaException(fname, "Sigma is not of correct size");
if (U.size(0) != U.size(1) || U.size(0) != M)
throw LaException(fname, "U is not of correct size");
if (VT.size(0) != VT.size(1) || VT.size(0) != N)
throw LaException(fname, "U is not of correct size");
//#define MAX3(A,B,C) ((A)>(B) ? ((A)>(C) ? (A) : (C)) : ((B)>(C) ? (B) : (C)))
//#define MIN(A,B) (A < B ? A : B )
//std::cout << "Block size: " << LaEnvBlockSize("DGELSV", A) << std::endl;
//int nb = 32;
// int nb = LaEnvBlockSize("ZGESDD", A);
// integer W = std::min(M,N) + nb * MAX3(M, N, nrhs);
// LaVectorComplex work((int) W);
integer ldu = U.inc(0) * U.gdim(0);
integer ldvt = VT.inc(0) * VT.gdim(0);
F77NAME(zgesdd)(&jobz, &Ml, &Nl, &A(0,0), &lda,
&Sigma(0), &U(0,0), &ldu, &VT(0,0), &ldvt, &info);
if (info != 0) {
throw(LaException(fname, "Internal error in LAPACK: zgesdd()"));
}
}
#endif // LA_COMPLEX_SUPPORT
Index: Makefile.am
===================================================================
RCS file: /cvsroot/lapackpp/lapackpp/src/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d --brief -r1.5 -r1.6
Files /tmp/cvsiQqDMN and /tmp/cvsuTxmfa differ
|