19 #ifndef GEOSX_LINEARALGEBRA_SOLVERS_ARNOLDI_HPP_ 20 #define GEOSX_LINEARALGEBRA_SOLVERS_ARNOLDI_HPP_ 32 template<
typename MATRIX,
typename VECTOR >
42 void set( MATRIX
const & matrix, MPI_Comm
const comm )
54 return m_matrix->numGlobalRows();
63 return m_matrix->numGlobalCols();
72 return m_matrix->numLocalRows();
89 void apply( VECTOR
const & x, VECTOR & y )
const override 91 m_matrix->gemv( 1.0, x, 0.0, y,
false );
92 m_matrix->gemv( 1.0, y, 0.0, y,
true );
98 MATRIX
const * m_matrix;
110 template<
typename Operator >
113 using Vector =
typename Operator::Vector;
124 V[0].createWithLocalSize( numLocalRows, op.getComm() );
125 V[0].set( 1.0 /
sqrt( static_cast< real64 >( numGlobalRows ) ) );
130 V[j+1].createWithLocalSize( numLocalRows, op.getComm() );
131 op.apply( V[j], V[j+1] );
135 H( i, j ) = V[i].dot( V[j+1] );
136 V[j+1].axpy( -H( i, j ), V[i] );
138 H( j+1, j ) = V[j+1].norm2();
139 V[j+1].scale( 1.0 / H( j+1, j ) );
144 H.
resize( mInternal, mInternal );
154 lambdaMax = (
std::abs( lambda[i] ) > lambdaMax ) ?
std::abs( lambda[i] ) : lambdaMax;
162 #endif //GEOSX_LINEARALGEBRA_SOLVERS_ARNOLDI_HPP_ localIndex numLocalRows() const
Returns the local number of rows.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
NormalOperator Simple class to apply the operator A^T * A to a vector.
float sqrt(float const x)
MPI_Comm const & getComm() const
Returns the communicator.
double real64
64-bit floating point type.
real64 ArnoldiLargestEigenvalue(Operator const &op, localIndex const m=4)
Function implementing the Arnoldi scheme to compute the largest eigenvalue.
void apply(VECTOR const &x, VECTOR &y) const override
Applies the matrix and its transpose to a vector.
globalIndex numGlobalRows() const override
Returns the global number of rows.
static void matrixEigenvalues(MatRowMajor< real64 const > const &A, Vec< std::complex< real64 > > const &lambda)
Computes the eigenvalues of A.
void resize(int const numDims, DIMS_TYPE const *const dims)
Resize the dimensions of the Array to match the given dimensions.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Abstract base class for linear operators.
VECTOR Vector
Alias for template parameter.
globalIndex numGlobalCols() const override
Returns the global number of columns.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...