ATSuite C++  v1.0
Scientific C++ routines originally developed by Alexis Tantet
Classes | Typedefs | Functions
atspectrum.hpp File Reference

Get spectrum of sparse matrices using ARPACK++. More...

#include <cstdlib>
#include <cstdio>
#include <vector>
#include <Eigen/Sparse>
#include <arpack++/arlnsmat.h>
#include <arpack++/arlssym.h>
#include <ATSuite/atio.hpp>

Go to the source code of this file.

Classes

class  configAR
 Utility class used to give configuration options to ARPACK++. More...
 

Typedefs

typedef SparseMatrix< double, RowMajor > SpMatCSR
 Eigen sparse CSR matrix of double type.
 
typedef SparseMatrix< double, ColMajor > SpMatCSC
 Eigen sparse CSC matrix of double type.
 

Functions

ARluNonSymMatrix< double, double > * pajek2AR (FILE *fp)
 Scans an ARPACK++ nonsymmetric matrix from a Pajek file. More...
 
ARluNonSymMatrix< double, double > * Eigen2AR (SpMatCSC *TEigen)
 Converts an Eigen CSC matrix to an ARPACK++ nonsymmetric CSC matrix. More...
 
ARluNonSymMatrix< double, double > * Eigen2AR (SpMatCSR *TEigenCSR)
 Converts an Eigen CSR matrix to an ARPACK++ nonsymmetric CSC matrix. More...
 
ARluSymMatrix< double > * Eigen2ARSym (SpMatCSC *TEigen)
 Converts an Eigen CSC matrix to an ARPACK++ symmetric CSC matrix. More...
 
ARluSymMatrix< double > * Eigen2ARSym (SpMatCSR *TEigenCSR)
 Converts an Eigen CSR matrix to an ARPACK++ symmetric CSC matrix. More...
 
ARluNonSymMatrix< double, double > * Compressed2AR (FILE *fp)
 Scans an ARPACK++ nonsymmetric matrix from a file in compressed format. More...
 
int getSpectrum (ARluNonSymMatrix< double, double > *P, int nev, configAR cfgAR, double *EigValReal, double *EigValImag, double *EigVec)
 Get spectrum of a nonsymmetric matrix using ARPACK++. More...
 
void writeSpectrum (FILE *fEigVal, FILE *fEigVec, double *EigValReal, double *EigValImag, double *EigVec, int nev, size_t N)
 Write complex eigenvalues and eigenvectors from ARPACK++. More...
 

Detailed Description

ATSuite functions to get spectrum of sparse matrices using ARPACK++. Also includes reading and conversion routines to ARPACK++ CSC matrices.

Definition in file atspectrum.hpp.

Function Documentation

ARluNonSymMatrix< double, double > * Compressed2AR ( FILE *  fp)

Scans an ARPACK++ LU nonsymmetric CSC matrix (see ARPACK++ documentation) from a matrix file in compressed format (see atio.hpp documentation).

Parameters
[in]fpDescriptor of the file to which to scan.
Returns
ARPACK++ LU nonsymmetric matrix scanned.

Definition at line 129 of file atspectrum.hpp.

ARluNonSymMatrix< double, double > * Eigen2AR ( SpMatCSC TEigen)

Converts an Eigen CSC matrix to ARPACK++ LU nonsymmetric CSC matrix.

Parameters
[in]TEigenEigen matrix from which to convert.
Returns
ARPACK++ LU nonsymmetrix CSC matrix converted.

Definition at line 168 of file atspectrum.hpp.

Referenced by Eigen2AR().

ARluNonSymMatrix< double, double > * Eigen2AR ( SpMatCSR TEigenCSR)

Converts an Eigen CSR matrix to an ARPACK++ LU nonsymmetric CSC matrix.

Parameters
[in]TEigenCSREigen matrix from which to convert.
Returns
ARPACK++ LU nonsymmetrix CSC matrix converted.

Definition at line 203 of file atspectrum.hpp.

References CSR2CSC(), and Eigen2AR().

ARluSymMatrix< double > * Eigen2ARSym ( SpMatCSC TEigen)

Converts an Eigen CSC matrix to ARPACK++ LU symmetric matrix.

Parameters
[in]TEigenEigen matrix from which to convert.
Returns
ARPACK++ LU symmetrix CSC matrix converted.

Definition at line 224 of file atspectrum.hpp.

Referenced by Eigen2ARSym().

ARluSymMatrix< double > * Eigen2ARSym ( SpMatCSR TEigenCSR)

Converts an Eigen CSR matrix to ARPACK++ LU symmetric matrix.

Parameters
[in]TEigenCSREigen matrix from which to convert.
Returns
ARPACK++ LU symmetrix CSC matrix converted.

Definition at line 287 of file atspectrum.hpp.

References CSR2CSC(), and Eigen2ARSym().

int getSpectrum ( ARluNonSymMatrix< double, double > *  P,
int  nev,
configAR  cfgAR,
double *  EigValReal,
double *  EigValImag,
double *  EigVec 
)

Get spectrum of a nonsymmetric matrix using ARPACK++.

Parameters
[in]PARPACK++ CSC sparse matrix from which to calculate the spectrum.
[in]nevNumber of eigenvalues and eigenvectors to find.
[in]cfgARConfiguration options passed as a configAR object.
[out]EigValRealReal part of found eigenvalues.
[out]EigValImagImaginary part of found eigenvalues.
[out]EigVecFound eigenvectors.
Returns
Number of eigenvalues and eigenvectors found.

Definition at line 314 of file atspectrum.hpp.

References configAR::AutoShift_, configAR::maxit_, configAR::ncv_, configAR::resid_, configAR::tol_, and configAR::which_.

ARluNonSymMatrix< double, double > * pajek2AR ( FILE *  fp)

Scans an ARPACK++ LU nonsymmetric CSC matrix (see ARPACK++ documentation) from a Pajek file (see Pajek documentation).

Parameters
[in]fpDescriptor of the file to which to scan.
Returns
ARPACK++ LU nonsymmetric matrix scanned.

Definition at line 79 of file atspectrum.hpp.

void writeSpectrum ( FILE *  fEigVal,
FILE *  fEigVec,
double *  EigValReal,
double *  EigValImag,
double *  EigVec,
int  nev,
size_t  N 
)

Write complex eigenvalues and eigenvectors obtained as arrays from ARPACK++.

Parameters
[in]fEigValFile descriptor for eigenvalues.
[in]fEigVecFile descriptor for eigenvectors.
[in]EigValRealArray of eigenvalues real parts.
[in]EigValImagArray of eigenvalues imaginary parts.
[in]EigVecArray of eigenvectors.
[in]nevNumber of eigenvalues and eigenvectors.
[in]NLength of the eigenvectors.

Definition at line 344 of file atspectrum.hpp.