MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_MatrixOpSubView.hpp
Go to the documentation of this file.
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 ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H
43 #define ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H
44 
45 #include <iosfwd>
46 
48 #include "Teuchos_RCP.hpp"
50 
51 namespace AbstractLinAlgPack {
52 
63 class MatrixOpSubView : public virtual MatrixOp {
64 public:
65 
67  using MatrixOp::syrk;
68 
71 
74 
79  ,const Range1D& rng_rows = Range1D()
80  ,const Range1D& rng_cols = Range1D()
82  );
83 
117  void initialize(
118  const mat_ptr_t& M_full
119  ,const Range1D& rng_rows = Range1D()
120  ,const Range1D& rng_cols = Range1D()
122  );
123 
125 
128 
130  const mat_ptr_t& M_full_ptr();
132  MatrixOp& M_full();
134  const MatrixOp& M_full() const;
136  Range1D rng_rows() const;
138  Range1D rng_cols() const;
141 
143 
146 
148  size_type rows() const;
150  size_type cols() const;
152  size_type nz() const;
153 
155 
158 
160  const VectorSpace& space_cols() const;
162  const VectorSpace& space_rows() const;
164  MatrixOp::mat_ptr_t sub_view(const Range1D& row_rng, const Range1D& col_rng) const;
166  void zero_out();
168  void Mt_S( value_type alpha );
170  MatrixOp& operator=(const MatrixOp& M);
172  std::ostream& output(std::ostream& out) const;
174  bool Mp_StM(
175  MatrixOp* mwo_lhs, value_type alpha
176  , BLAS_Cpp::Transp trans_rhs) const;
178  bool Mp_StMtP(
179  MatrixOp* mwo_lhs, value_type alpha
181  , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
182  ) const;
184  bool Mp_StPtM(
185  MatrixOp* mwo_lhs, value_type alpha
186  , const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
188  ) const;
190  bool Mp_StPtMtP(
191  MatrixOp* mwo_lhs, value_type alpha
192  ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
194  ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
195  ) const;
197  bool Mp_StM(
198  value_type alpha,const MatrixOp& M_rhs, BLAS_Cpp::Transp trans_rhs);
200  bool Mp_StMtP(
201  value_type alpha
202  ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans
203  ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
204  );
206  bool Mp_StPtM(
207  value_type alpha
208  ,const GenPermMatrixSlice& P_rhs, BLAS_Cpp::Transp P_rhs_trans
209  ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans
210  );
212  bool Mp_StPtMtP(
213  value_type alpha
214  ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
215  ,const MatrixOp& M_rhs, BLAS_Cpp::Transp M_trans
216  ,const GenPermMatrixSlice& P_rhs2, BLAS_Cpp::Transp P_rhs2_trans
217  );
219  void Vp_StMtV(
220  VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
221  , const Vector& v_rhs2, value_type beta) const;
223  void Vp_StMtV(
224  VectorMutable* vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1
225  , const SpVectorSlice& sv_rhs2, value_type beta) const;
227  void Vp_StPtMtV(
228  VectorMutable* vs_lhs, value_type alpha
229  , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
230  , BLAS_Cpp::Transp M_rhs2_trans
231  , const Vector& v_rhs3, value_type beta) const;
233  void Vp_StPtMtV(
234  VectorMutable* vs_lhs, value_type alpha
235  , const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
236  , BLAS_Cpp::Transp M_rhs2_trans
237  , const SpVectorSlice& sv_rhs3, value_type beta) const;
240  const Vector& v_rhs1, BLAS_Cpp::Transp trans_rhs2
241  , const Vector& v_rhs3) const;
244  const SpVectorSlice& sv_rhs1, BLAS_Cpp::Transp trans_rhs2
245  , const SpVectorSlice& sv_rhs3) const;
247  void syr2k(
249  , const GenPermMatrixSlice& P1, BLAS_Cpp::Transp P1_trans
250  , const GenPermMatrixSlice& P2, BLAS_Cpp::Transp P2_trans
251  , value_type beta, MatrixSymOp* symwo_lhs ) const;
253  bool Mp_StMtM(
254  MatrixOp* mwo_lhs, value_type alpha
255  , BLAS_Cpp::Transp trans_rhs1, const MatrixOp& mwo_rhs2
256  , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
258  bool Mp_StMtM(
259  MatrixOp* mwo_lhs, value_type alpha
260  , const MatrixOp& mwo_rhs1, BLAS_Cpp::Transp trans_rhs1
261  , BLAS_Cpp::Transp trans_rhs2, value_type beta ) const;
263  bool Mp_StMtM(
264  value_type alpha
265  ,const MatrixOp& mvw_rhs1, BLAS_Cpp::Transp trans_rhs1
266  ,const MatrixOp& mwo_rhs2,BLAS_Cpp::Transp trans_rhs2
267  ,value_type beta );
269  bool syrk(
271  , value_type beta, MatrixSymOp* sym_lhs ) const;
272 
274 
275 private:
276 
277 #ifdef DOXYGEN_COMPILE
281 #else
282  mat_ptr_t M_full_;
283  Range1D rng_rows_;
284  Range1D rng_cols_;
285  BLAS_Cpp::Transp M_trans_;
286  VectorSpace::space_ptr_t space_cols_;
287  VectorSpace::space_ptr_t space_rows_;
288 #endif
289 
290  //
291  void assert_initialized() const;
292 
293 }; // end class MatrixOpSubView
294 
295 // //////////////////////////////////
296 // Inline members
297 
298 inline
301 {
302  return M_full_;
303 }
304 
305 inline
307 {
308  return *M_full_;
309 }
310 
311 inline
312 const MatrixOp& MatrixOpSubView::M_full() const
313 {
314  return *M_full_;
315 }
316 
317 inline
319 {
320  return rng_rows_;
321 }
322 
323 inline
325 {
326  return rng_rows_;
327 }
328 
329 inline
331 {
332  return M_trans_;
333 }
334 
335 } // end namespace AbstractLinAlgPack
336 
337 #endif // ABSTRACT_LINALG_PACK_MATRIX_WITH_OP_SUB_VIEW_H
bool syrk(BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs) const
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
MatrixOpSubView(const mat_ptr_t &M_full=Teuchos::null, const Range1D &rng_rows=Range1D(), const Range1D &rng_cols=Range1D(), BLAS_Cpp::Transp M_trans=BLAS_Cpp::no_trans)
Calls this->initialize(...)
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
MatrixOp::mat_ptr_t sub_view(const Range1D &row_rng, const Range1D &col_rng) const
bool Mp_StM(MatrixOp *mwo_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs) const
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
Interface adding operations specific for a symmetric matrix {abstract}.
std::ostream & output(std::ostream &out) const
Not transposed.
. One-based subregion index range class.
value_type transVtMtV(const Vector &v_rhs1, BLAS_Cpp::Transp trans_rhs2, const Vector &v_rhs3) const
Abstract interface for objects that represent a space for mutable coordinate vectors.
void initialize(const mat_ptr_t &M_full, const Range1D &rng_rows=Range1D(), const Range1D &rng_cols=Range1D(), BLAS_Cpp::Transp M_trans=BLAS_Cpp::no_trans)
Initialize the view of a matrix.
Standard subclass for representing a sub, possibly transposed, view of a matrix.
std::ostream * out
const LAPACK_C_Decl::f_int & M
Base class for all matrices that support basic matrix operations.
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
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
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
Abstract interface for mutable coordinate vectors {abstract}.
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
friend void syrk(const MatrixOp &mwo_rhs, BLAS_Cpp::Transp M_trans, value_type alpha, value_type beta, MatrixSymOp *sym_lhs)
Transp
TRANS.
void Vp_StMtV(VectorMutable *vs_lhs, value_type alpha, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta) const
Concrete matrix type to represent general permutation (mapping) matrices.