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_MatrixPermAggr.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 MATRIX_PERM_AGGR_H
43 #define MATRIX_PERM_AGGR_H
44 
45 #include "AbstractLinAlgPack_MatrixOp.hpp"
46 
47 namespace AbstractLinAlgPack {
48 
55  : virtual public MatrixOp
56 {
57 public:
58 
61 
64 
66 
69 
72 
76  const mat_ptr_t &mat_orig
77  ,const perm_ptr_t &row_perm
78  ,const perm_ptr_t &col_perm
79  ,const mat_ptr_t &mat_perm
80  );
81 
110  void initialize(
111  const mat_ptr_t &mat_orig
112  ,const perm_ptr_t &row_perm
113  ,const perm_ptr_t &col_perm
114  ,const mat_ptr_t &mat_perm
115  );
116 
121  void set_uninitialized();
122 
124 
127 
129  const mat_ptr_t& mat_orig() const;
131  const perm_ptr_t& row_perm() const;
133  const perm_ptr_t& col_perm() const;
135  const mat_ptr_t& mat_perm() const;
136 
138 
141 
143  size_type rows() const;
145  size_type cols() const;
147  size_type nz() const;
148 
150 
153 
155  const VectorSpace& space_cols() const;
157  const VectorSpace& space_rows() const;
159  MatrixOp::mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const;
161  MatrixOp& operator=(const MatrixOp& M);
163  std::ostream& output(std::ostream& out) const;
164 
165 protected:
166 
168  bool Mp_StM(
169  MatrixOp* mwo_lhs, value_type alpha
170  , BLAS_Cpp::Transp trans_rhs) const;
172  bool Mp_StMtP(
173  MatrixOp* mwo_lhs, value_type alpha
174  , BLAS_Cpp::Transp M_trans
175  , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
176  ) const;
178  bool Mp_StPtM(
179  MatrixOp* mwo_lhs, value_type alpha
180  , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
181  , BLAS_Cpp::Transp M_trans
182  ) const;
184  bool Mp_StPtMtP(
185  MatrixOp* mwo_lhs, value_type alpha
186  ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
187  ,BLAS_Cpp::Transp M_trans
188  ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
189  ) const;
191  void Vp_StMtV(
192  VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
193  , const Vector& v_rhs2, value_type beta) const;
195  void Vp_StMtV(
196  VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
197  , const SpVectorSlice& sv_rhs2, value_type beta) const;
199  void Vp_StPtMtV(
200  VectorMutable* vs_lhs, value_type alpha
201  , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
202  , BLAS_Cpp::Transp M_rhs2_trans
203  , const Vector& v_rhs3, value_type beta) const;
205  void Vp_StPtMtV(
206  VectorMutable* vs_lhs, value_type alpha
207  , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
208  , BLAS_Cpp::Transp M_rhs2_trans
209  , const SpVectorSlice& sv_rhs3, value_type beta) const;
211  value_type transVtMtV(
212  const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2
213  , const Vector& v_rhs3) const;
215  value_type transVtMtV(
216  const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2
217  , const SpVectorSlice& sv_rhs3) const;
219  void syr2k(
220  BLAS_Cpp::Transp M_trans, value_type alpha
221  , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans
222  , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans
223  , value_type beta, MatrixSymOp* symwo_lhs ) const;
225  bool Mp_StMtM(
226  MatrixOp* mwo_lhs, value_type alpha
227  , BLAS_Cpp::Transp trans_rhs1, const MatrixOp& mwo_rhs2
228  , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
230  bool Mp_StMtM(
231  MatrixOp* mwo_lhs, value_type alpha
232  , const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
233  , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
235  bool syrk(
236  BLAS_Cpp::Transp M_trans, value_type alpha
237  , value_type beta, MatrixSymOp* sym_lhs ) const;
238 
240 
241 private:
242 
243 #ifdef DOXYGEN_COMPILE
248 #else
249  mat_ptr_t mat_orig_;
250  perm_ptr_t row_perm_;
251  perm_ptr_t col_perm_;
252  mat_ptr_t mat_perm_;
253 #endif
254 
255 }; // end class MatrixPermAggr
256 
257 // ////////////////////////////////////
258 // Inline members
259 
260 inline
261 const MatrixOp::mat_ptr_t&
263 {
264  return mat_orig_;
265 }
266 
267 inline
270 {
271  return row_perm_;
272 }
273 
274 inline
277 {
278  return col_perm_;
279 }
280 
281 inline
282 const MatrixOp::mat_ptr_t& MatrixPermAggr::mat_perm() const
283 {
284  return mat_perm_;
285 }
286 
287 } // end namespace AbstractLinAlgPack
288 
289 #endif // MATRIX_PERM_AGGR_H
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
value_type transVtMtV(const Vector &v_rhs1, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3) const
bool syrk(BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs) const
Aggregate matrix class for a matrix and its permuted view.
const perm_ptr_t & row_perm() const
void Vp_StMtV(VectorMutable *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
Interface adding operations specific for a symmetric matrix {abstract}.
const mat_ptr_t & mat_orig() const
void initialize(const mat_ptr_t &mat_orig, const perm_ptr_t &row_perm, const perm_ptr_t &col_perm, const mat_ptr_t &mat_perm)
Initialize.
Abstract interface for objects that represent a space for mutable coordinate vectors.
const mat_ptr_t & mat_perm() const
MatrixOp::mat_ptr_t sub_view(const Range1D &row_rng, const Range1D &col_rng) const
bool Mp_StPtM(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans, BLAS_Cpp::Transp M_trans) const
bool Mp_StPtMtP(MatrixOp *mwo_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs2, BLAS_Cpp::Transp P_rhs2_trans) const
Base class for all matrices that support basic matrix operations.
bool Mp_StMtM(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const MatrixOp &mwo_rhs2, BLAS_Cpp::Transp trans_rhs2, value_type beta) const
const perm_ptr_t & col_perm() const
Abstract interface to permutation matrices.
void Vp_StPtMtV(VectorMutable *vs_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, BLAS_Cpp::Transp M_rhs2_trans, const Vector &v_rhs3, value_type beta) const
bool Mp_StMtP(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp M_trans, const GenPermMatrixSlice &P_rhs, BLAS_Cpp::Transp P_rhs_trans) const
Abstract interface for mutable coordinate vectors {abstract}.
std::ostream & output(std::ostream &out) const
bool Mp_StM(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
Transp
void syr2k(BLAS_Cpp::Transp M_trans, value_type alpha, const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, value_type beta, MatrixSymOp *symwo_lhs) const
Concrete matrix type to represent general permutation (mapping) matrices.