1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/*
ARPACK++ v1.2 2/18/2000
c++ interface to ARPACK code.
MODULE RNSymVSl.h
Template functions that exemplify how to print information
about the singular value decomposition obtained using the
ARrcNonSymStdEig function.
ARPACK Authors
Richard Lehoucq
Danny Sorensen
Chao Yang
Dept. of Computational & Applied Mathematics
Rice University
Houston, Texas
*/
#ifndef RNSYMVSL_H
#define RNSYMVSL_H
#include <math.h>
#include "blas1c.h"
#include "lapackc.h"
#include "matprod.h"
#include "arrsnsym.h"
template<class ARFLOAT>
void Solution(ARrcNonSymStdEig<ARFLOAT> &Prob)
/*
Prints singular values and singular vectors of nonsymmetric
real matrices on standard "cout" stream.
*/
{
int i, nconv;
nconv = Prob.ConvergedEigenvalues();
std::cout << std::endl << std::endl << "Testing ARPACK++ class ARrcNonSymStdEig \n";
std::cout << "Singular value decomposition problem: (A'*A)*x - lambda*x" << std::endl;
std::cout << "Dimension of the system : " << Prob.GetN() << std::endl;
std::cout << "Number of 'requested' singular values: " << Prob.GetNev() << std::endl;
std::cout << "Number of 'converged' singular values: " << nconv << std::endl;
std::cout << "Number of Arnoldi vectors generated : " << Prob.GetNcv() << std::endl;
std::cout << std::endl;
if (Prob.EigenvaluesFound()) {
// Printing singular values.
std::cout << "Singular values:" << std::endl;
for (i=0; i<nconv; i++) {
std::cout << " sigma[" << (i+1) << "]: ";
std::cout << sqrt(Prob.EigenvalueReal(i)) << std::endl;
}
std::cout << std::endl;
}
} // Solution
#endif // RNSYMVSL_H
|