DenseLinAlgPack: Concreate C++ Classes for Dense Blas-Compatible Linear Algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DenseLinAlgPack_AssertOp.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 LIN_ALG_PACK_ASSERT_OP_H
43 #define LIN_ALG_PACK_ASSERT_OP_H
44 
45 #include "DenseLinAlgPack_Types.hpp"
46 
47 namespace DenseLinAlgPack {
48 
49 #ifdef LINALGPACK_CHECK_RHS_SIZES
50 
51 
52 /* * @name Assertion functions for linear algebra operations.
53  *
54  * These functions check the sizes of the linear algebra
55  * expressions and throw a std::length_error if
56  * the sizes do not match. These functions
57  * only perform there operations if #LINALGPACK_CHECK_RHS_SIZES#
58  * is defined.
59  */
60 // @{
61 
62 /* * @name Level 1 BLAS
63  */
64 // @{
65 
67 void Vp_V_assert_sizes(size_type v_lhs_size, size_type v_rhs_size);
68 
70 void VopV_assert_sizes(size_type v_rhs1_size, size_type v_rhs2_size);
71 
73 void Mp_M_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs
74  , size_type m_rhs_rows, size_type m_rhs_cols, BLAS_Cpp::Transp trans_rhs);
75 
77 void MopM_assert_sizes(size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1
78  , size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2);
79 
80 // end Level 1 BLAS
81 // @}
82 
83 /* * @name Level 2 BLAS
84  */
85 // @{
86 
88 void MtV_assert_sizes(size_type m_rhs1_rows, size_type m_rhs1_cols
89  , BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size);
90 
92 void Vp_MtV_assert_sizes(size_type v_lhs_size, size_type m_rhs1_rows
93  , size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size);
94 
95 // end Level 2 BLAS
96 // @}
97 
98 /* * @name Level 3 BLAS
99  */
100 // @{
101 
103 void MtM_assert_sizes(
104  size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1
105  , size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2);
106 
108 void Mp_MtM_assert_sizes(
109  size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs
110  , size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1
111  , size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2);
112 
113 // end Level 3 BLAS
114 // @}
115 
116 
117 // @}
118 
119 #else
120 
121 // inline definitions that do nothing
122 
123 inline
124 void Vp_V_assert_sizes(size_type v_lhs_size, size_type v_rhs_size)
125 {}
126 
127 inline
128 void VopV_assert_sizes(size_type v_rhs1_size, size_type v_rhs2_size)
129 {}
130 
131 inline
132 void Mp_M_assert_sizes(size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs
133  , size_type m_rhs_rows, size_type m_rhs_cols, BLAS_Cpp::Transp trans_rhs)
134 {}
135 
136 inline
137 void MopM_assert_sizes(size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1
138  , size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2)
139 {}
140 
141 inline
142 void MtV_assert_sizes(size_type m_rhs1_rows, size_type m_rhs1_cols
143  , BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
144 {}
145 
146 inline
147 void Vp_MtV_assert_sizes(size_type v_lhs_size, size_type m_rhs1_rows
148  , size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1, size_type v_rhs2_size)
149 {}
150 
151 inline
152 void MtM_assert_sizes(
153  size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1
154  , size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2)
155 {}
156 
157 inline
158 void Mp_MtM_assert_sizes(
159  size_type m_lhs_rows, size_type m_lhs_cols, BLAS_Cpp::Transp trans_lhs
160  , size_type m_rhs1_rows, size_type m_rhs1_cols, BLAS_Cpp::Transp trans_rhs1
161  , size_type m_rhs2_rows, size_type m_rhs2_cols, BLAS_Cpp::Transp trans_rhs2)
162 {}
163 
164 #endif
165 
166 } // end namespace DenseLinAlgPack
167 
168 #endif // LIN_ALG_PACK_ASSERT_OP_H
size_t size_type
Transp