52 #include "MiReleaseResource_ref_count_ptr.h"
53 #include "MiWorkspacePack.h"
82 namespace ConstrainedOptPack {
88 ,
const release_resource_ptr_t& MB_release_resource_ptr
91 ,
const release_resource_ptr_t& UB_release_resource_ptr
97 initialize(n,kd,MB,MB_release_resource_ptr,MB_uplo
98 ,UB,UB_release_resource_ptr,UB_uplo,update_factor,scale);
105 ,
const release_resource_ptr_t& MB_release_resource_ptr
108 ,
const release_resource_ptr_t& UB_release_resource_ptr
118 throw std::invalid_argument(
119 "MatrixSymPosDefBandedChol::initialize(...): Error, "
120 "kd must be 0 if n == 0" );
122 throw std::invalid_argument(
123 "MatrixSymPosDefBandedChol::initialize(...): Error, "
124 "MB must be NULL if n == 0" );
125 if( MB_release_resource_ptr.get() != NULL )
126 throw std::invalid_argument(
127 "MatrixSymPosDefBandedChol::initialize(...): Error, "
128 "MB_release_resource_ptr.get() must be NULL if n == 0" );
130 throw std::invalid_argument(
131 "MatrixSymPosDefBandedChol::initialize(...): Error, "
132 "UB must be NULL if n == 0" );
133 if( UB_release_resource_ptr.get() != NULL )
134 throw std::invalid_argument(
135 "MatrixSymPosDefBandedChol::initialize(...): Error, "
136 "UB_release_resource_ptr.get() must be NULL if n == 0" );
140 throw std::invalid_argument(
141 "MatrixSymPosDefBandedChol::initialize(...): Error, "
142 "kd + 1 can not be larger than n" );
143 if( MB == NULL && UB == NULL )
144 throw std::invalid_argument(
145 "MatrixSymPosDefBandedChol::initialize(...): Error, "
146 "MB and UB can not both be NULL" );
147 if( MB != NULL && ( MB->rows() != kd + 1 || MB->cols() != n ) )
148 throw std::invalid_argument(
149 "MatrixSymPosDefBandedChol::initialize(...): Error, "
150 "MB is not the correct size" );
151 if( UB != NULL && ( UB->rows() != kd + 1 || UB->cols() != n ) )
152 throw std::invalid_argument(
153 "MatrixSymPosDefBandedChol::initialize(...): Error, "
154 "UB is not the correct size" );
174 if(MB)
MB_.bind(*MB);
177 if(UB)
UB_.bind(*UB);
213 ,b,y->raw_ptr(),y->stride());
215 else if(
UB_.rows() ) {
266 Workspace<value_type> t_ws(wss,y->size());
275 ,&t[0], t.size(), &info );
279 std::ostringstream omsg;
281 <<
"MatrixSymPosDefBandedChol::update_factorization(): Error, "
282 <<
"The " << -info <<
" argument passed to xPBTRF(...) is invalid!";
283 throw std::invalid_argument(omsg.str());
293 throw std::logic_error(
"MatrixSymPosDefBandedChol::assert_initialized(): Error, "
294 "not initialized!" );
299 namespace rcp = MemMngPack;
301 namespace rmp = MemMngPack;
304 if(
UB_.rows() == 0) {
307 typedef rmp::ReleaseResource_ref_count_ptr<DMatrix> UB_rel_ptr_t;
309 UB_rel_ptr_ptr_t UB_rel_ptr_ptr =
new UB_rel_ptr_t(
new DMatrix);
310 UB_rel_ptr_ptr->ptr->resize(kd_+1,n_);
311 UB_.bind( (*UB_rel_ptr_ptr->ptr)() );
320 ,
n_,
kd_,
UB_.col_ptr(1),
UB_.max_rows(), &info );
322 std::ostringstream omsg;
324 <<
"MatrixSymPosDefBandedChol::update_factorization(): Error, "
325 <<
"The " << -info <<
" argument passed to xPBTRF(...) is invalid!";
326 throw std::invalid_argument(omsg.str());
329 std::ostringstream omsg;
331 <<
"MatrixSymPosDefBandedChol::update_factorization(): Error, "
332 <<
"The leading minor of order " << info <<
" passed to xPBTRF(...) is not positive definite!";
333 throw std::invalid_argument(omsg.str());
FORTRAN_CONST_CHAR_1_ARG(TRANS)
void Vp_StPtMtV(DVectorSlice *vs_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const DVectorSlice &vs_rhs3, value_type beta) const
AbstractLinAlgPack::size_type size_type
FortranTypes::f_int f_int
BLAS_Cpp::Uplo MB_uplo() const
std::ostream & output(std::ostream &out) const
void Vp_StPtMtV(VectorMutable *v_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const MatrixOp &M_rhs2, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta=1.0)
v_lhs = alpha * op(P_rhs1) * op(M_rhs2) * v_rhs3 + beta * v_rhs
const LAPACK_C_Decl::f_int LAPACK_C_Decl::f_dbl_prec const LAPACK_C_Decl::f_int LAPACK_C_Decl::f_int * INFO
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
release_resource_ptr_t UB_release_resource_ptr_
void assert_initialized() const
#define FORTRAN_CHAR_1_ARG_CALL(ARG_NAME)
void update_factorization() const
void V_InvMtV(DVectorSlice *vs_lhs, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2) const
With throw exception if factorization is not allowed.
std::ostream & output(std::ostream &o, const COOMatrix &coom)
Output stream function for COOMatrix.
#define FORTRAN_FUNC_CALL_UL(UFUNC_NAME, LFUNC_NAME)
void initialize(size_type n=0, size_type kd=0, DMatrixSlice *MB=NULL, const release_resource_ptr_t &MB_release_resource_ptr=NULL, BLAS_Cpp::Uplo MB_uplo=BLAS_Cpp::lower, DMatrixSlice *UB=NULL, const release_resource_ptr_t &UB_release_resource_ptr=NULL, BLAS_Cpp::Uplo UB_uplo=BLAS_Cpp::lower, bool update_factor=false, value_type scale=1.0)
Initialize.
void sbmv(Uplo uplo, f_int n, f_int k, f_dbl_prec alpha, const f_dbl_prec *pa, f_int lda, const f_dbl_prec *x, f_int incx, f_dbl_prec beta, f_dbl_prec *py, f_int incy)
release_resource_ptr_t MB_release_resource_ptr_
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const LAPACK_C_Decl::f_int const LAPACK_C_Decl::f_int const LAPACK_C_Decl::f_dbl_prec const LAPACK_C_Decl::f_int const LAPACK_C_Decl::f_int LAPACK_C_Decl::f_dbl_prec const LAPACK_C_Decl::f_int & LDB
void M_StM(MatrixOp *M_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
gm_lhs = alpha * M_rhs.
BLAS_Cpp::Uplo UB_uplo() const
const LAPACK_C_Decl::f_int const LAPACK_C_Decl::f_int const LAPACK_C_Decl::f_dbl_prec const LAPACK_C_Decl::f_int const LAPACK_C_Decl::f_int LAPACK_C_Decl::f_dbl_prec B[]
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
const f_int f_dbl_prec a[]
FORTRAN_FUNC_DECL_UL(void, MA28AD, ma28ad)(const f_int &n
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
MatrixSymPosDefBandedChol(size_type n=0, size_type kd=0, DMatrixSlice *MB=NULL, const release_resource_ptr_t &MB_release_resource_ptr=NULL, BLAS_Cpp::Uplo MB_uplo=BLAS_Cpp::lower, DMatrixSlice *UB=NULL, const release_resource_ptr_t &UB_release_resource_ptr=NULL, BLAS_Cpp::Uplo UB_uplo=BLAS_Cpp::lower, bool update_factor=false, value_type scale=1.0)
Construct and Initialize.
AbstractLinAlgPack::value_type value_type
void Vp_MtV_assert_sizes(size_type v_lhs_size, size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
v_lhs += op(m_rhs1) * v_rhs2
const f_int const f_int & N
const LAPACK_C_Decl::f_int const LAPACK_C_Decl::f_int & NRHS
DenseLinAlgPack::DMatrixSlice DMatrixSlice
FortranTypes::f_dbl_prec f_dbl_prec
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()