MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_COOMatrixPartitionViewSubclass.cpp
Go to the documentation of this file.
1 #if 0
2 
3 // @HEADER
4 // ***********************************************************************
5 //
6 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
7 // Copyright (2003) Sandia Corporation
8 //
9 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
10 // license for use of this work by or on behalf of the U.S. Government.
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are
14 // met:
15 //
16 // 1. Redistributions of source code must retain the above copyright
17 // notice, this list of conditions and the following disclaimer.
18 //
19 // 2. Redistributions in binary form must reproduce the above copyright
20 // notice, this list of conditions and the following disclaimer in the
21 // documentation and/or other materials provided with the distribution.
22 //
23 // 3. Neither the name of the Corporation nor the names of the
24 // contributors may be used to endorse or promote products derived from
25 // this software without specific prior written permission.
26 //
27 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
28 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
31 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 //
39 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
40 //
41 // ***********************************************************************
42 // @HEADER
43 
50 
51 namespace LinAlgOpPack {
52 
57 
58 } // end namespace LinAlgOpPack
59 
60 namespace AbstractLinAlgPack {
61 
63  return trans_ == BLAS_Cpp::no_trans ? m().rows() : m().cols();
64 }
65 
67  return trans_ == BLAS_Cpp::no_trans ? m().cols() : m().rows();
68 }
69 
70 MatrixOp& COOMatrixPartitionViewSubclass::operator=(const MatrixOp& m) {
71  if(&m == this) return *this; // assignment to self
72  const COOMatrixPartitionViewSubclass *p_m = dynamic_cast<const COOMatrixPartitionViewSubclass*>(&m);
73  if(p_m) {
74  throw std::invalid_argument("COOMatrixPartitionViewSubclass::operator=(const MatrixOp& m)"
75  " : There is not an assignment operator defined for COOMatrixWithPartitionedView::partition_type"
76  ". Only assignment to self can be handeled" );
77  }
78  else {
79  throw std::invalid_argument("COOMatrixPartitionViewSubclass::operator=(const MatrixOp& m)"
80  " : The concrete type of m is not a subclass of COOMatrixPartitionViewSubclass as expected" );
81  }
82  return *this;
83 }
84 
85 // Level-1 BLAS
86 
88  , BLAS_Cpp::Transp trans_rhs) const
89 {
90  AbstractLinAlgPack::Mp_StM(gms_lhs,alpha,m(),op(trans_rhs));
91 }
92 
93 // Level-2 BLAS
94 
96  , BLAS_Cpp::Transp trans_rhs1, const DVectorSlice& vs_rhs2, value_type beta) const
97 {
98  AbstractLinAlgPack::Vp_StMtV(vs_lhs, alpha, m(), op(trans_rhs1), vs_rhs2, beta);
99 }
100 
102  , BLAS_Cpp::Transp trans_rhs1, const SpVectorSlice& sv_rhs2, value_type beta) const
103 {
104  DVector v_rhs2;
105  LinAlgOpPack::assign(&v_rhs2,sv_rhs2);
106  AbstractLinAlgPack::Vp_StMtV(vs_lhs, alpha, m(), op(trans_rhs1), v_rhs2(), beta);
107 }
108 
110  , BLAS_Cpp::Transp trans_rhs2, const DVectorSlice& vs_rhs3) const
111 {
112  DVector tmp;
113  LinAlgOpPack::V_MtV(&tmp,m(),op(trans_rhs2),vs_rhs3);
114  return DenseLinAlgPack::dot(vs_rhs1,tmp());
115 }
116 
118  , BLAS_Cpp::Transp trans_rhs2, const SpVectorSlice& sv_rhs3) const
119 {
120  DVector v_rhs3;
121  LinAlgOpPack::assign(&v_rhs3,sv_rhs3);
122  DVector tmp;
123  LinAlgOpPack::V_MtV(&tmp,m(),op(trans_rhs2),v_rhs3());
124  return dot(sv_rhs1,tmp());
125 }
126 
127 // Level-3 BLAS
128 
130  , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2
131  , BLAS_Cpp::Transp trans_rhs2, value_type beta) const
132 {
133  AbstractLinAlgPack::Mp_StMtM(gms_lhs, alpha, m(), op(trans_rhs1), gms_rhs2, trans_rhs2, beta);
134 }
135 
137  , BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const
138 {
139  AbstractLinAlgPack::Mp_StMtM(gms_lhs, alpha, gms_rhs1, trans_rhs1, m(), op(trans_rhs2), beta);
140 }
141 
142 } // end namespace AbstractLinAlgPack
143 
144 #endif // 0
value_type transVtMtV(const DVectorSlice &vs_rhs1, BLAS_Cpp::Transp trans_rhs2, const DVectorSlice &vs_rhs3) const
(4) result = vs_rhs1' * op(M_rhs2) * vs_rhs3
void Mp_StMtM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta=1.0)
mwo_lhs = alpha * op(mwo_rhs1) * op(mwo_rhs2) + beta * mwo_lhs (right) (xGEMM).
void Vp_StMtV(DVectorSlice *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2, value_type beta) const
(2) vs_lhs = alpha * op(M_rhs1) * vs_rhs2 + beta * vs_lhs (BLAS xGEMV)
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
v_lhs = alpha * v_rhs + v_lhs
void assign(VectorMutable *v_lhs, const V &V_rhs)
v_lhs = V_rhs.
Not transposed.
void Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
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)
void Mp_StM(DMatrixSlice *gms_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
(1) gms_lhs += alpha * op(M_rhs) (BLAS xAXPY)
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
SparseVectorSlice< SparseElement< index_type, value_type > > SpVectorSlice
DenseLinAlgPack::VectorSliceTmpl< value_type > DVectorSlice
void V_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = op(M_rhs1) * V_rhs2.
void Mp_StMtM(DMatrixSlice *gms_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice &gms_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) const
(6) gms_lhs = alpha * op(M_rhs1) * op(gms_rhs2) + beta * gms_lhs (right) (xGEMM)
DenseLinAlgPack::DMatrixSlice DMatrixSlice
Transp
TRANS.
value_type dot(const DVectorSlice &vs_rhs1, const DVectorSlice &vs_rhs2)
result = vs_rhs1' * vs_rhs2 (BLAS xDOT)