44 #include "AbstractLinAlgPack_MatrixOpNonsing.hpp"
45 #include "AbstractLinAlgPack_VectorSpace.hpp"
46 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
47 #include "Teuchos_Assert.hpp"
49 namespace AbstractLinAlgPack {
51 MatrixOpNonsing::mat_mwons_mut_ptr_t
57 MatrixOpNonsing::mat_mwons_ptr_t
66 ,
bool allow_replacement
79 ,
"MatrixOp::calc_norm(...): Error, This default implemenation can only "
80 "compute the one norm or the infinity norm!"
92 w = (do_trans ? space_cols :
space_rows).create_member(),
93 zeta = (do_trans ? space_cols :
space_rows).create_member(),
95 const index_type max_iter = 5;
96 value_type w_nrm = 0.0;
97 for( index_type k = 0; k <= max_iter; ++k ) {
99 sign( *w, zeta.get() );
101 value_type z_j = 0.0;
104 const value_type zTx =
dot(*z,*x);
106 if( ::fabs(z_j) <= zTx ) {
115 return MatNorm( w_nrm * M_nrm.value ,requested_norm_type );
120 MatrixOpNonsing::mat_mut_ptr_t
126 MatrixOpNonsing::mat_ptr_t
134 MatrixOpNonsing::mat_mns_mut_ptr_t
140 MatrixOpNonsing::mat_mns_ptr_t
virtual const VectorSpace & space_rows() const =0
Vector space for vectors that are compatible with the rows of the matrix.
mat_mns_mut_ptr_t clone_mns()
Returns this->clone_mwons().
void sign(const Vector &v, VectorMutable *z)
Compute the sign of each element in an input vector.
friend void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
The induced infinity norm ||M||inf, i.e. max abs row sum.
Abstract interface for objects that represent a space for mutable coordinate vectors.
Returned form calc_norm().
Thrown if a method is not implemented.
void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
v_lhs = inv(op(M_rhs1)) * v_rhs2
const MatNorm calc_norm(EMatNormType requested_norm_type=MAT_NORM_1, bool allow_replacement=false) const
Compute a norm of this matrix.
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
virtual index_type dim() const =0
Return the dimmension of the vector space.
The induced one norm ||M||1, i.e. max abs col sum.
EMatNormType
Type of matrix norm.
virtual mat_mwons_mut_ptr_t clone_mwons()
Clone the non-const matrix object (if supported).
const MatNorm calc_cond_num(EMatNormType requested_norm_type=MAT_NORM_1, bool allow_replacement=false) const
Compute an estimate of the condition number of this matrix.
virtual const VectorSpace & space_cols() const =0
Vector space for vectors that are compatible with the columns of the matrix.
void max_abs_ele(const Vector &v, value_type *max_v_j, index_type *max_j)
Compute the maximum element in a vector.
Abstract base class for all nonsingular polymorphic matrices that can be used to compute matrix-vecto...
mat_mut_ptr_t clone()
Returns this->clone_mwons().