1 /*
2 * Copyright (c) 2007, Michael Lehn
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2) Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3) Neither the name of the FLENS development group nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef FLENS_BLAS_LEVEL3_MM_H
34 #define FLENS_BLAS_LEVEL3_MM_H
35
36 #include <cxxblas/cxxblas.h>
37 #include <flens/matrixtypes/matrixtypes.h>
38 #include <flens/typedefs.h>
39
40 namespace flens { namespace blas {
41
42 //== GeneralMatrix - GeneralMatrix products ====================================
43
44 //-- gemm
45 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
46 void
47 mm(Transpose transA, Transpose transB, const ALPHA &alpha,
48 const GeMatrix<MA> &A, const GeMatrix<MB> &B,
49 const BETA &beta, GeMatrix<MC> &C);
50
51 //== TriangularMatrix - GeneralMatrix products =================================
52
53 //-- trmm
54 template <typename ALPHA, typename MA, typename MB>
55 void
56 mm(Side side,
57 Transpose transA, const ALPHA &alpha, const TrMatrix<MA> &A,
58 GeMatrix<MB> &B);
59
60 //== SymmetricMatrix - GeneralMatrix products ==================================
61
62 //-- symm
63 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
64 void
65 mm(Side side,
66 const ALPHA &alpha, const SyMatrix<MA> &A, const GeMatrix<MB> &B,
67 const BETA &beta, GeMatrix<MC> &C);
68
69 //== HermitianMatrix - GeneralMatrix products ==================================
70
71 //-- hemm
72 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
73 void
74 mm(Side side,
75 const ALPHA &alpha, const HeMatrix<MA> &A, const GeMatrix<MB> &B,
76 const BETA &beta, GeMatrix<MC> &C);
77
78
79 //== Forwarding ================================================================
80
81 //-- GeneralMatrix - GeneralMatrix products
82 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
83 typename RestrictTo<IsGeneralMatrix<MA>::value &&
84 IsGeneralMatrix<MB>::value &&
85 !IsClosure<MA>::value &&
86 !IsClosure<MB>::value &&
87 IsSame<MC, typename MC::Impl>::value,
88 void>::Type
89 mm(Transpose transA, Transpose transB, const ALPHA &alpha,
90 const MA &A, const MB &B,
91 const BETA &beta, MC &&C);
92
93 //-- TriangularMatrix - GeneralMatrix products
94 template <typename ALPHA, typename MA, typename MB>
95 typename RestrictTo<IsTriangularMatrix<MA>::value &&
96 IsGeneralMatrix<MB>::value &&
97 !IsClosure<MA>::value &&
98 IsSame<MB, typename MB::Impl>::value,
99 void>::Type
100 mm(Side side, Transpose transA,
101 const ALPHA &alpha, const MA &A, MB &&B);
102
103
104 //-- SymmetricMatrix - GeneralMatrix products
105 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
106 typename RestrictTo<IsSymmetricMatrix<MA>::value &&
107 IsGeneralMatrix<MB>::value &&
108 !IsClosure<MA>::value &&
109 !IsClosure<MB>::value &&
110 IsSame<MC, typename MC::Impl>::value,
111 void>::Type
112 mm(Side side, const ALPHA &alpha, const MA &A, const MB &B,
113 const BETA &beta, MC &&C);
114
115 //-- HermitianMatrix - GeneralMatrix products
116 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
117 typename RestrictTo<IsHermitianMatrix<MA>::value &&
118 IsGeneralMatrix<MB>::value &&
119 !IsClosure<MA>::value &&
120 !IsClosure<MB>::value &&
121 IsSame<MC, typename MC::Impl>::value,
122 void>::Type
123 mm(Side side, const ALPHA &alpha, const MA &A, const MB &B,
124 const BETA &beta, MC &&C);
125
126 } } // namespace blas, flens
127
128 #endif // FLENS_BLAS_LEVEL3_MM_H
2 * Copyright (c) 2007, Michael Lehn
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2) Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * 3) Neither the name of the FLENS development group nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef FLENS_BLAS_LEVEL3_MM_H
34 #define FLENS_BLAS_LEVEL3_MM_H
35
36 #include <cxxblas/cxxblas.h>
37 #include <flens/matrixtypes/matrixtypes.h>
38 #include <flens/typedefs.h>
39
40 namespace flens { namespace blas {
41
42 //== GeneralMatrix - GeneralMatrix products ====================================
43
44 //-- gemm
45 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
46 void
47 mm(Transpose transA, Transpose transB, const ALPHA &alpha,
48 const GeMatrix<MA> &A, const GeMatrix<MB> &B,
49 const BETA &beta, GeMatrix<MC> &C);
50
51 //== TriangularMatrix - GeneralMatrix products =================================
52
53 //-- trmm
54 template <typename ALPHA, typename MA, typename MB>
55 void
56 mm(Side side,
57 Transpose transA, const ALPHA &alpha, const TrMatrix<MA> &A,
58 GeMatrix<MB> &B);
59
60 //== SymmetricMatrix - GeneralMatrix products ==================================
61
62 //-- symm
63 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
64 void
65 mm(Side side,
66 const ALPHA &alpha, const SyMatrix<MA> &A, const GeMatrix<MB> &B,
67 const BETA &beta, GeMatrix<MC> &C);
68
69 //== HermitianMatrix - GeneralMatrix products ==================================
70
71 //-- hemm
72 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
73 void
74 mm(Side side,
75 const ALPHA &alpha, const HeMatrix<MA> &A, const GeMatrix<MB> &B,
76 const BETA &beta, GeMatrix<MC> &C);
77
78
79 //== Forwarding ================================================================
80
81 //-- GeneralMatrix - GeneralMatrix products
82 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
83 typename RestrictTo<IsGeneralMatrix<MA>::value &&
84 IsGeneralMatrix<MB>::value &&
85 !IsClosure<MA>::value &&
86 !IsClosure<MB>::value &&
87 IsSame<MC, typename MC::Impl>::value,
88 void>::Type
89 mm(Transpose transA, Transpose transB, const ALPHA &alpha,
90 const MA &A, const MB &B,
91 const BETA &beta, MC &&C);
92
93 //-- TriangularMatrix - GeneralMatrix products
94 template <typename ALPHA, typename MA, typename MB>
95 typename RestrictTo<IsTriangularMatrix<MA>::value &&
96 IsGeneralMatrix<MB>::value &&
97 !IsClosure<MA>::value &&
98 IsSame<MB, typename MB::Impl>::value,
99 void>::Type
100 mm(Side side, Transpose transA,
101 const ALPHA &alpha, const MA &A, MB &&B);
102
103
104 //-- SymmetricMatrix - GeneralMatrix products
105 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
106 typename RestrictTo<IsSymmetricMatrix<MA>::value &&
107 IsGeneralMatrix<MB>::value &&
108 !IsClosure<MA>::value &&
109 !IsClosure<MB>::value &&
110 IsSame<MC, typename MC::Impl>::value,
111 void>::Type
112 mm(Side side, const ALPHA &alpha, const MA &A, const MB &B,
113 const BETA &beta, MC &&C);
114
115 //-- HermitianMatrix - GeneralMatrix products
116 template <typename ALPHA, typename MA, typename MB, typename BETA, typename MC>
117 typename RestrictTo<IsHermitianMatrix<MA>::value &&
118 IsGeneralMatrix<MB>::value &&
119 !IsClosure<MA>::value &&
120 !IsClosure<MB>::value &&
121 IsSame<MC, typename MC::Impl>::value,
122 void>::Type
123 mm(Side side, const ALPHA &alpha, const MA &A, const MB &B,
124 const BETA &beta, MC &&C);
125
126 } } // namespace blas, flens
127
128 #endif // FLENS_BLAS_LEVEL3_MM_H