1 /* fflas_enum.h
2  * Copyright (C) The FFLAS-FFPACK group
3  *
4  * Written by Clement Pernet <Clement.Pernet@imag.fr>
5  *
6  * ========LICENCE========
7  * This file is part of the library FFLAS-FFPACK.
8  *
9  * FFLAS-FFPACK is free software: you can redistribute it and/or modify
10  * it under the terms of the  GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22  * ========LICENCE========
23  *.
24  */
25 #ifndef __FFLASFFPACK_enum_INL
26 #define __FFLASFFPACK_enum_INL
27 
28 namespace FFLAS {
29 
30     /// Storage by row or col ?
31     enum FFLAS_ORDER {
32         FflasRowMajor=101, /**< row major */
33         FflasColMajor=102  /**< col major */
34     };
35     // public:
36     /// Is matrix transposed ?
37     enum FFLAS_TRANSPOSE {
38         FflasNoTrans = 111, /**< Matrix is not transposed */
39         FflasTrans   = 112  /**< Matrix is transposed */
40     };
41     /// Is triangular matrix's shape upper ?
42     enum FFLAS_UPLO {
43         FflasUpper = 121, /**< Triangular matrix is Upper triangular (if \f$i>j\f$ then \f$T_{i,j} = 0\f$)*/
44         FflasLower = 122  /**< Triangular matrix is Lower triangular (if \f$i<j\f$ then \f$T_{i,j} = 0\f$)*/
45     };
46 
47     /// Is the triangular matrix implicitly unit diagonal ?
48     enum FFLAS_DIAG {
49         FflasNonUnit = 131, /**< Triangular matrix has an explicit arbitrary diagonal */
50         FflasUnit    = 132 /**< Triangular matrix has an implicit unit diagonal (\f$T_{i,i} = 1\f$)*/ /**< */
51     };
52 
53     /// On what side ?
54     enum FFLAS_SIDE {
55         FflasLeft  = 141,/**< Operator applied on the left */
56         FflasRight = 142 /**< Operator applied on the rigth*/
57     };
58 
59     /** \p FFLAS_BASE  determines the type of the element representation for Matrix Mult kernel. (deprecated, should not be used) */
60     enum FFLAS_BASE {
61         FflasDouble  = 151,  /**<  to use the double precision BLAS */
62         FflasFloat   = 152,  /**<  to use the single precison BLAS */
63         FflasGeneric = 153   /**< for any other domain, that can not be converted to floating point integers */
64     };
65 }
66 
67 #include <algorithm>
68 
69 namespace FFLAS{ namespace Protected {
70 
71     template <class X, class Y> class AreEqual {
72     public:
73         static const bool value = false;
74     };
75 
76     template <class X> class AreEqual<X, X> {
77     public:
78         static const bool value = true;
79     };
80 } // Protected
81 } // class FFLAS
82 
83 namespace FFLAS {
84 
min3(const T & m,const T & n,const T & k)85     template <class T> const T &min3(const T &m, const T &n, const T &k) { return std::min(m, std::min(n, k)); }
86 
max3(const T & m,const T & n,const T & k)87     template <class T> const T &max3(const T &m, const T &n, const T &k) { return std::max(m, std::min(n, k)); }
88 
min4(const T & m,const T & n,const T & k,const T & l)89     template <class T> const T &min4(const T &m, const T &n, const T &k, const T &l) {
90         return std::min(std::min(m, n), std::min(k, l));
91     }
92 
max4(const T & m,const T & n,const T & k,const T & l)93     template <class T> const T &max4(const T &m, const T &n, const T &k, const T &l) {
94         return std::max(std::max(m, n), std::max(k, l));
95     }
96 
97 } // FFLAS
98 
99 
100 
101 #endif // __FFLASFFPACK_enum_INL
102 /* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
103 // vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
104