AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AbstractLinAlgPack_COOMatrixPartitionViewSubclass.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef COO_MATRIX_PARTITION_VIEW_SUBCLASS_H
43 #define COO_MATRIX_PARTITION_VIEW_SUBCLASS_H
44 
45 #include "AbstractLinAlgPack_MatrixOp.hpp"
46 #include "AbstractLinAlgPack_COOMatrixWithPartitionedView.hpp"
47 
48 namespace AbstractLinAlgPack {
49 
50 // Could not derive this class form MatrixWithOpConcreteEncap because the assignment
51 // operator is not defined for the partition class.
52 
57 {
58 public:
59 
62 
65  : trans_(BLAS_Cpp::no_trans)
66  {}
67 
70  : trans_(trans)
71  {}
72 
75  : m_(m), trans_(BLAS_Cpp::no_trans)
76  {}
77 
80  : m_(m), trans_(trans)
81  {}
82 
85  trans_ = trans;
86  }
87 
88  // /////////////////////////////////////////////////////
91 
93  M& m() {
94  return m_;
95  }
96 
98  const M& m() const {
99  return m_;
100  }
101 
102  // end Representation access
104 
105  // /////////////////////////////////////////////////////
106  // Overridden from Matrix
107 
109  size_type rows() const;
110 
112  size_type cols() const;
113 
114  // /////////////////////////////////////////////////////
115  // Overridden from MatrixOp
116 
118  MatrixOp& operator=(const MatrixOp& m);
119 
120  // /////////////////////////////////////////////////////
123 
125  void Mp_StM(DMatrixSlice* gms_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const;
126 
127  // end Level-1 BLAS
129 
130  // ////////////////////////////////////////////////////
133 
135  void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
136  , const DVectorSlice& vs_rhs2, value_type beta) const;
137 
139  void Vp_StMtV(DVectorSlice* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
140  , const SpVectorSlice& sv_rhs2, value_type beta) const;
141 
143  value_type transVtMtV(const DVectorSlice& vs_rhs1, BLAS_Cpp::Transp trans_rhs2
144  , const DVectorSlice& vs_rhs3) const;
145 
147  value_type transVtMtV(const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2
148  , const SpVectorSlice& sv_rhs3) const;
149 
150  // end Level-2 BLAS
152 
153  // ////////////////////////////////////////////////////
156 
158  void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha
159  , BLAS_Cpp::Transp trans_rhs1, const DMatrixSlice& gms_rhs2
160  , BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
161 
163  void Mp_StMtM(DMatrixSlice* gms_lhs, value_type alpha, const DMatrixSlice& gms_rhs1
164  , BLAS_Cpp::Transp trans_rhs1, BLAS_Cpp::Transp trans_rhs2, value_type beta) const;
165 
166  // end Level-3 BLAS
168 
169 private:
170  M m_;
171  BLAS_Cpp::Transp trans_; // for how the matrix if viewed as.
172 
174  using BLAS_Cpp::trans_not;
175  return trans_ == BLAS_Cpp::no_trans ? trans : trans_not(trans);
176  }
177 
178 }; // end class COOMatrixPartitionViewSubclass
179 
180 } // end namespace AbstractLinAlgPack
181 
182 #endif // COO_MATRIX_PARTITION_VIEW_SUBCLASS_H
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 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)
Implementation of MatrixOp abstract interface for COOMatrixWithPartitionedView::partition_type.
void Mp_StM(DMatrixSlice *gms_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
(1) gms_lhs += alpha * op(M_rhs) (BLAS xAXPY)
Base class for all matrices that support basic matrix operations.
Transp trans_not(Transp _trans)
Class for a partition or a set of continous partitions in a partitioned COO matrix.
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)
Transp