MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DenseLinAlgPack_DMatrixAsTriSym.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 GEN_MATRIX_AS_TRI_SYM_H
43 #define GEN_MATRIX_AS_TRI_SYM_H
44 
46 
47 namespace DenseLinAlgPack {
48 
49 /* * @name Packaging arguments for GenMatrixSlices treated as triangular
50  * and symmetric matrices in BLAS-like linear algebra operations.
51  *
52  */
53 
54 // @{
55 
56 // /////////////////////////////////////////////////////////////////////////////////////
58 /* * Aggregate information for a triangular matrix (element-wise) stored in a DMatrix.
59  *
60  * This is the type to be used as lhs and rhs arguments in element-wise
61  * linear algebra operations like assignment and binary arithmetic.
62  */
64 public:
67  : gms_(const_cast<DMatrixSlice&>(gms)), uplo_(uplo)
68  {
69  #ifdef LINALGPACK_CHECK_RHS_SIZES
70  assert_gms_square(gms);
71  #endif
72  }
74  size_type rows() const {
75  return gms_.rows();
76  }
78  size_type cols() const {
79  return gms_.cols();
80  }
83  return gms_;
84  }
86  const DMatrixSlice& gms() const {
87  return gms_;
88  }
90  BLAS_Cpp::Uplo uplo() const {
91  return uplo_;
92  }
95  return this;
96  }
98  const DMatrixSliceTriEle* operator&() const {
99  return this;
100  }
101 
102 private:
105  // Not defined and not to be called
108 }; // end class DMatrixSliceTriEle
109 
110 inline
113 {
114  return DMatrixSliceTriEle(gms, uplo);
115 }
116 
117 inline
120 {
121  return DMatrixSliceTriEle(gms, uplo);
122 }
123 
124 // ////////////////////////////////////////////////////////////////////////////////
126 /* * Aggregate information for a triangular matrix (structure dependent) stored in a DMatrix.
127  *
128  * This is the type to be used as a rhs argument in linear algebra operations
129  * that are structure specific like the BLAS operations.
130  */
132 public:
135  : gms_(const_cast<DMatrixSlice&>(gms)), uplo_(uplo), diag_(diag)
136  {
137  #ifdef LINALGPACK_CHECK_RHS_SIZES
138  assert_gms_square(gms);
139  #endif
140  }
142  size_type rows() const {
143  return gms_.rows();
144  }
146  size_type cols() const {
147  return gms_.cols();
148  }
151  return gms_;
152  }
154  const DMatrixSlice& gms() const {
155  return gms_;
156  }
159  return uplo_;
160  }
163  return diag_;
164  }
167  return this;
168  }
170  const DMatrixSliceTri* operator&() const {
171  return this;
172  }
173 
174 private:
178  // not defined and not to be called
179  DMatrixSliceTri();
181 }; // end class DMatrixSliceTri
182 
183 inline
186 {
187  return DMatrixSliceTri(gms, uplo, diag);
188 }
189 
190 inline
193 {
194  return DMatrixSliceTri(gms, uplo, diag);
195 }
196 
197 // /////////////////////////////////////////////////////////////////////////////////////////
199 /* * Aggregate information for a symmetric matrix stored in a DMatrix.
200  *
201  * This is the type to be used as both lhs and rhs arguments in linear algebra operations.
202  */
204 public:
207  : gms_(const_cast<DMatrixSlice&>(gms)), uplo_(uplo)
208  {
209  #ifdef LINALGPACK_CHECK_RHS_SIZES
210  assert_gms_square(gms);
211  #endif
212  }
214  size_type rows() const {
215  return gms_.rows();
216  }
218  size_type cols() const {
219  return gms_.cols();
220  }
223  return gms_;
224  }
226  const DMatrixSlice& gms() const {
227  return gms_;
228  }
231  return uplo_;
232  }
235  return this;
236  }
237  const DMatrixSliceSym* operator&() const {
238  return this;
239  }
240 
241 private:
244  // not defined and not to be called
245  DMatrixSliceSym();
247 }; // end class DMatrixSliceSym
248 
249 inline
252 {
253  return DMatrixSliceSym(gms, uplo);
254 }
255 
256 inline
259 {
260  return DMatrixSliceSym(gms, uplo);
261 }
262 
263 // @}
264 
265 } // end namespace DenseLinAlgPack
266 
267 #endif // GEN_MATRIX_AS_TRI_SYM_H
DMatrixSliceTriEle(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo)
Teuchos::Ordinal size_type
Typedef for the size type of elements that are used by the library.
void assert_gms_square(const DMatrixSlice &gms)
Assert a matrix is square and throws length_error if it is not (LINALGPACK_CHECK_SLICE_SETUP).
size_type cols() const
Return the number of columns.
const DMatrixSliceTriEle tri_ele(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo)
DMatrixSliceTriEle & operator=(const DMatrixSliceTriEle &)
const DMatrixSliceSym sym(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo)
const DMatrixSliceTri tri(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo, BLAS_Cpp::Diag diag)
DMatrixSliceSym nonconst_sym(DMatrixSlice gms, BLAS_Cpp::Uplo uplo)
Return a symmetric matrix.
DMatrixSliceTriEle * operator&()
Allow address to be taken of rvalue of this object.
DMatrixSliceTri & operator=(const DMatrixSliceTri &)
DenseLinAlgPack::DMatrixSliceTriEle DMatrixSliceTriEle
DMatrixSliceTriEle nonconst_tri_ele(DMatrixSlice gms, BLAS_Cpp::Uplo uplo)
Return a triangular element-wise matrix.
size_type rows() const
Return the number of rows.
DMatrixSliceSym(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo)
DenseLinAlgPack::DMatrixSliceTri DMatrixSliceTri
const DMatrixSliceTriEle * operator&() const
DMatrixSliceTri(const DMatrixSlice &gms, BLAS_Cpp::Uplo uplo, BLAS_Cpp::Diag diag)
DMatrixSliceTri * operator&()
Allow address to be taken of rvalue of this object.
DMatrixSliceSym & operator=(const DMatrixSliceTri &)
DMatrixSliceTri nonconst_tri(DMatrixSlice gms, BLAS_Cpp::Uplo uplo, BLAS_Cpp::Diag diag)
Return a triangular matrix.
DenseLinAlgPack::DMatrixSliceSym DMatrixSliceSym
DMatrixSliceSym * operator&()
Allow address to be taken of rvalue of this object.