20 #ifndef GEOS_LINEARALGEBRA_UTILITIES_ARNOLDI_HPP_
21 #define GEOS_LINEARALGEBRA_UTILITIES_ARNOLDI_HPP_
23 #include "denseLinearAlgebra/interfaces/blaslapack/BlasLapackLA.hpp"
36 template<
typename VECTOR >
41 localIndex const mInternal = std::min( numGlobalRows, m );
48 V[0].create( numLocalRows, op.
comm() );
49 V[0].set( 1.0 / sqrt(
static_cast< real64 >( numGlobalRows ) ) );
54 V[j+1].create( numLocalRows, op.
comm() );
55 op.
apply( V[j], V[j+1] );
59 H( i, j ) = V[i].dot( V[j+1] );
60 V[j+1].axpy( -H( i, j ), V[i] );
62 H( j+1, j ) = V[j+1].norm2();
63 V[j+1].scale( 1.0 / H( j+1, j ) );
68 H.resize( mInternal, mInternal );
72 BlasLapackLA::matrixEigenvalues( H, lambda );
78 lambdaMax = std::max( std::abs( lambda[i] ), lambdaMax );
Abstract base class for linear operators.
virtual globalIndex numGlobalRows() const =0
Get the number of global rows.
virtual localIndex numLocalRows() const =0
Get the number of local rows.
virtual void apply(Vector const &src, Vector &dst) const =0
Apply operator to a vector, dst = this(src).
virtual MPI_Comm comm() const =0
Get the MPI communicator the matrix was created with.
Array< T, 2, PERMUTATION > array2d
Alias for 2D array.
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
real64 ArnoldiLargestEigenvalue(LinearOperator< VECTOR > const &op, localIndex const m=4)
Function implementing the Arnoldi scheme to compute the largest eigenvalue.
Array< T, 1 > array1d
Alias for 1D array.