libflame revision_anchor
FLA_macro_defs.h
Go to the documentation of this file.
00001 /*
00002    libflame
00003    An object-based infrastructure for developing high-performance
00004    dense linear algebra libraries.
00005 
00006    Copyright (C) 2011, The University of Texas
00007 
00008    libflame is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU Lesser General Public License as
00010    published by the Free Software Foundation; either version 2.1 of
00011    the License, or (at your option) any later version.
00012 
00013    libflame is distributed in the hope that it will be useful, but
00014    WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016    Lesser General Public License for more details.
00017 
00018    You should have received a copy of the GNU Lesser General Public
00019    License along with libflame; if you did not receive a copy, see
00020    http://www.gnu.org/licenses/.
00021 
00022    For more information, please contact us at flame@cs.utexas.edu or
00023    send mail to:
00024 
00025    Field G. Van Zee and/or
00026    Robert A. van de Geijn
00027    The University of Texas at Austin
00028    Department of Computer Sciences
00029    1 University Station C0500
00030    Austin TX 78712
00031 */
00032 
00033 
00034 
00035 // --- Miscellaneous macro definitions -----------------------------------------
00036 
00037 #undef  NULL
00038 #define NULL 0
00039 
00040 
00041 
00042 // --- Type-related macro definitions ------------------------------------------
00043 
00044 // FLA_Bool
00045 #undef  TRUE
00046 #undef  FALSE
00047 #define TRUE  1
00048 #define FALSE 0
00049 
00050 // FLA_Error (non-specific)
00051 #define FLA_SUCCESS           (-1)
00052 #define FLA_FAILURE           (-2)
00053 
00054 // FLA_Quadrant
00055 #define FLA_TL                 11
00056 #define FLA_TR                 12
00057 #define FLA_BL                 21
00058 #define FLA_BR                 22
00059 
00060 // FLA_Datatype
00061 #define FLA_FLOAT             100
00062 #define FLA_DOUBLE            101
00063 #define FLA_COMPLEX           102
00064 #define FLA_DOUBLE_COMPLEX    103
00065 #define FLA_INT               104
00066 #define FLA_CONSTANT          105
00067 
00068 // FLA_Elemtype
00069 #define FLA_MATRIX            150
00070 #define FLA_SCALAR            151
00071 
00072 // FLA_Side
00073 #define FLA_TOP               200
00074 #define FLA_BOTTOM            201
00075 #define FLA_LEFT              210
00076 #define FLA_RIGHT             211
00077 #define FLA_SIDE_MASK         0x1
00078 
00079 // FLA_Uplo
00080 #define FLA_LOWER_TRIANGULAR  300
00081 #define FLA_UPPER_TRIANGULAR  301
00082 #define FLA_UPLO_MASK         0x1
00083 
00084 // FLA_Trans
00085 #define FLA_NO_TRANSPOSE      400
00086 #define FLA_TRANSPOSE         401
00087 #define FLA_CONJ_TRANSPOSE    402
00088 #define FLA_CONJ_NO_TRANSPOSE 403
00089 #define FLA_TRANS_MASK        0x3
00090 
00091 // FLA_Conj
00092 #define FLA_NO_CONJUGATE      450
00093 #define FLA_CONJUGATE         451
00094 
00095 // FLA_Diag
00096 #define FLA_UNIT_DIAG         500
00097 #define FLA_NONUNIT_DIAG      501
00098 #define FLA_ZERO_DIAG         502
00099 #define FLA_DIAG_MASK         0x3
00100 
00101 // FLA_Dimension
00102 #define FLA_DIMENSION_M       600
00103 #define FLA_DIMENSION_K       601
00104 #define FLA_DIMENSION_N       602
00105 #define FLA_DIMENSION_MIN     603
00106 
00107 // FLA_Dimension_index
00108 #define FLA_DIM_M_INDEX         0
00109 #define FLA_DIM_K_INDEX         1
00110 #define FLA_DIM_N_INDEX         2
00111 #define FLA_DIM_MIN_INDEX       3
00112 #define FLA_DIM_INDEX_MASK    0x3
00113 
00114 // FLA_Pivot_type
00115 #define FLA_NATIVE_PIVOTS     700
00116 #define FLA_LAPACK_PIVOTS     701
00117 
00118 // FLA_Direct
00119 #define FLA_FORWARD           800
00120 #define FLA_BACKWARD          801
00121 
00122 // FLA_Store
00123 #define FLA_COLUMNWISE        900
00124 #define FLA_ROWWISE           901
00125 
00126 // FLA_Matrix_type
00127 #define FLA_FLAT             1000
00128 #define FLA_HIER             1001
00129 
00130 // FLA_Precision
00131 #define FLA_SINGLE_PRECISION 1100
00132 #define FLA_DOUBLE_PRECISION 1101
00133 
00134 // FLA_Domain
00135 #define FLA_REAL_DOMAIN      1200
00136 #define FLA_COMPLEX_DOMAIN   1201
00137 
00138 // FLA_Inv    
00139 #define FLA_NO_INVERSE       1300
00140 #define FLA_INVERSE          1301
00141 
00142 // FLA_Evd_type
00143 #define FLA_EVD_WITHOUT_VECTORS 1400
00144 #define FLA_EVD_WITH_VECTORS    1401
00145 
00146 // FLA_Svd_type
00147 #define FLA_SVD_VECTORS_ALL           1500
00148 #define FLA_SVD_VECTORS_MIN_COPY      1501
00149 #define FLA_SVD_VECTORS_MIN_OVERWRITE 1502
00150 #define FLA_SVD_VECTORS_NONE          1503
00151 
00152 // FLAME threading model
00153 #define FLA_OPENMP              1
00154 #define FLA_PTHREADS            2
00155 
00156 // FLAME internal error checking level
00157 #define FLA_FULL_ERROR_CHECKING 2
00158 #define FLA_MIN_ERROR_CHECKING  1
00159 #define FLA_NO_ERROR_CHECKING   0
00160 
00161 // FLA_Datatype_index
00162 #define FLA_S_INDEX             0
00163 #define FLA_D_INDEX             1
00164 #define FLA_C_INDEX             2
00165 #define FLA_Z_INDEX             3
00166 #define FLA_DTYPE_INDEX_MASK  0x3
00167 
00168 // Default blocksize if none are available.
00169 #ifndef FLA_DEFAULT_M_BLOCKSIZE
00170   #define FLA_DEFAULT_M_BLOCKSIZE  128
00171 #endif
00172 #ifndef FLA_DEFAULT_K_BLOCKSIZE
00173   #define FLA_DEFAULT_K_BLOCKSIZE  128
00174 #endif
00175 #ifndef FLA_DEFAULT_N_BLOCKSIZE
00176   #define FLA_DEFAULT_N_BLOCKSIZE  128
00177 #endif
00178 
00179 // QR and LQ factorizations typically has an inner blocksize that corresponds
00180 // to the length of the S (or T) block Householder matrix. For consistency, we
00181 // define the ratio of the inner blocksize to the outer blocksize here, as it
00182 // is used in several places. Note that other operations have analagous inner
00183 // blocksizes, which we also define in terms of the outer storage blocksize,
00184 // or in some cases such as Hessenberg, tridiagonal, and bidiagonal reductions,
00185 // in terms of the system-wide default blocksize.
00186 #define FLA_QR_INNER_TO_OUTER_B_RATIO      (0.25)
00187 #define FLA_LQ_INNER_TO_OUTER_B_RATIO      (0.25)
00188 #define FLA_LU_INNER_TO_OUTER_B_RATIO      (0.25)
00189 #define FLA_UDDATE_INNER_TO_OUTER_B_RATIO  (0.25)
00190 #define FLA_HESS_INNER_TO_OUTER_B_RATIO    (0.25)
00191 #define FLA_TRIDIAG_INNER_TO_OUTER_B_RATIO (0.25)
00192 #define FLA_BIDIAG_INNER_TO_OUTER_B_RATIO  (0.25)
00193 
00194 
00195 
00196 // --- Error-related macro definitions -----------------------------------------
00197 
00198 // Useful when determining the relative index base of the error codes.
00199 #define FLA_ERROR_CODE_MIN                    (-10)
00200 
00201 // FLA_Error values.
00202 #define FLA_INVALID_SIDE                      (-10)
00203 #define FLA_INVALID_UPLO                      (-11)
00204 #define FLA_INVALID_TRANS                     (-12)
00205 #define FLA_INVALID_TRANS_GIVEN_DATATYPE      (-13)
00206 #define FLA_INVALID_CONJ                      (-14)
00207 #define FLA_INVALID_DIRECT                    (-15)
00208 #define FLA_INVALID_STOREV                    (-16)
00209 #define FLA_INVALID_DATATYPE                  (-17)
00210 #define FLA_INVALID_INTEGER_DATATYPE          (-18)
00211 #define FLA_INVALID_REAL_DATATYPE             (-19)
00212 #define FLA_INVALID_COMPLEX_DATATYPE          (-20)
00213 #define FLA_OBJECT_NOT_INTEGER                (-21)
00214 #define FLA_OBJECT_NOT_REAL                   (-22)
00215 #define FLA_OBJECT_NOT_COMPLEX                (-23)
00216 #define FLA_OBJECT_NOT_SQUARE                 (-24)
00217 #define FLA_OBJECT_NOT_SCALAR                 (-25)
00218 #define FLA_OBJECT_NOT_VECTOR                 (-26)
00219 #define FLA_INCONSISTENT_DATATYPES            (-27)
00220 #define FLA_NONCONFORMAL_DIMENSIONS           (-28)
00221 #define FLA_UNEQUAL_VECTOR_DIMS               (-29)
00222 #define FLA_INVALID_HESSENBERG_INDICES        (-30)
00223 #define FLA_NULL_POINTER                      (-32)
00224 #define FLA_SPECIFIED_OBJ_DIM_MISMATCH        (-33)
00225 #define FLA_INVALID_PIVOT_TYPE                (-35)
00226 #define FLA_MALLOC_RETURNED_NULL_POINTER      (-37)
00227 #define FLA_OBJECT_BASE_BUFFER_MISMATCH       (-38)
00228 #define FLA_OBJECTS_NOT_VERTICALLY_ADJ        (-39)
00229 #define FLA_OBJECTS_NOT_HORIZONTALLY_ADJ      (-40)
00230 #define FLA_ADJACENT_OBJECT_DIM_MISMATCH      (-41)
00231 #define FLA_OBJECTS_NOT_VERTICALLY_ALIGNED    (-42)
00232 #define FLA_OBJECTS_NOT_HORIZONTALLY_ALIGNED  (-43)
00233 #define FLA_INVALID_FLOATING_DATATYPE         (-44)
00234 #define FLA_OBJECT_NOT_FLOATING_POINT         (-45)
00235 #define FLA_INVALID_BLOCKSIZE_VALUE           (-46)
00236 #define FLA_OPEN_RETURNED_ERROR               (-47)
00237 #define FLA_LSEEK_RETURNED_ERROR              (-48)
00238 #define FLA_CLOSE_RETURNED_ERROR              (-49)
00239 #define FLA_UNLINK_RETURNED_ERROR             (-50)
00240 #define FLA_READ_RETURNED_ERROR               (-51)
00241 #define FLA_WRITE_RETURNED_ERROR              (-52)
00242 #define FLA_INVALID_QUADRANT                  (-53)
00243 #define FLA_NOT_YET_IMPLEMENTED               (-54)
00244 #define FLA_EXPECTED_NONNEGATIVE_VALUE        (-55)
00245 #define FLA_SUPERMATRIX_NOT_ENABLED           (-56)
00246 #define FLA_UNDEFINED_ERROR_CODE              (-57)
00247 #define FLA_INVALID_DIAG                      (-58)
00248 #define FLA_INCONSISTENT_OBJECT_PRECISION     (-59)
00249 #define FLA_INVALID_BLOCKSIZE_OBJ             (-60)
00250 #define FLA_VECTOR_DIM_BELOW_MIN              (-61)
00251 #define FLA_PTHREAD_CREATE_RETURNED_ERROR     (-63)
00252 #define FLA_PTHREAD_JOIN_RETURNED_ERROR       (-64)
00253 #define FLA_INVALID_ISGN_VALUE                (-65)
00254 #define FLA_CHOL_FAILED_MATRIX_NOT_SPD        (-67)
00255 #define FLA_INVALID_ELEMTYPE                  (-68)
00256 #define FLA_POSIX_MEMALIGN_FAILED             (-69)
00257 #define FLA_INVALID_SUBMATRIX_DIMS            (-70)
00258 #define FLA_INVALID_SUBMATRIX_OFFSET          (-71)
00259 #define FLA_OBJECT_NOT_SCALAR_ELEMTYPE        (-72)
00260 #define FLA_OBJECT_NOT_MATRIX_ELEMTYPE        (-73)
00261 #define FLA_ENCOUNTERED_NON_POSITIVE_NTHREADS (-74)
00262 #define FLA_INVALID_CONJ_GIVEN_DATATYPE       (-75)
00263 #define FLA_INVALID_COMPLEX_TRANS             (-76)
00264 #define FLA_INVALID_REAL_TRANS                (-77)
00265 #define FLA_INVALID_BLAS_TRANS                (-78)
00266 #define FLA_INVALID_NONCONSTANT_DATATYPE      (-79)
00267 #define FLA_OBJECT_NOT_NONCONSTANT            (-80)
00268 #define FLA_OBJECT_DATATYPES_NOT_EQUAL        (-82)
00269 #define FLA_DIVIDE_BY_ZERO                    (-83)
00270 #define FLA_OBJECT_ELEMTYPES_NOT_EQUAL        (-84)
00271 #define FLA_INVALID_PIVOT_INDEX_RANGE         (-85)
00272 #define FLA_HOUSEH_PANEL_MATRIX_TOO_SMALL     (-86)
00273 #define FLA_INVALID_OBJECT_LENGTH             (-87)
00274 #define FLA_INVALID_OBJECT_WIDTH              (-88)
00275 #define FLA_INVALID_ERROR_CHECKING_LEVEL      (-89)
00276 #define FLA_ATTEMPTED_OVER_REPART_2X2         (-90)
00277 #define FLA_ATTEMPTED_OVER_REPART_2X1         (-91)
00278 #define FLA_ATTEMPTED_OVER_REPART_1X2         (-92)
00279 #define FLA_EXTERNAL_LAPACK_NOT_IMPLEMENTED   (-93)
00280 #define FLA_INVALID_ROW_STRIDE                (-94)
00281 #define FLA_INVALID_COL_STRIDE                (-95)
00282 #define FLA_INVALID_STRIDE_COMBINATION        (-96)
00283 #define FLA_INVALID_VECTOR_DIM                (-97)
00284 #define FLA_EXPECTED_ROW_VECTOR               (-98)
00285 #define FLA_EXPECTED_COL_VECTOR               (-99)
00286 #define FLA_INVALID_INVERSE                   (-100)
00287 #define FLA_MALLOC_GPU_RETURNED_NULL_POINTER  (-101)
00288 #define FLA_INVALID_EVD_TYPE                  (-102)
00289 #define FLA_INVALID_SVD_TYPE                  (-103)
00290 
00291 // Necessary when computing whether an error code is defined.
00292 #define FLA_ERROR_CODE_MAX                    (-103)
00293 
00294 // Internal string matrix limits.
00295 #define FLA_MAX_NUM_ERROR_MSGS                 150
00296 #define FLA_MAX_ERROR_MSG_LENGTH               200
00297 
00298 // Error code translation and output macro definition.
00299 #define FLA_Check_error_code( code ) \
00300         FLA_Check_error_code_helper( code, __FILE__, __LINE__ )
00301 
00302 
00303 
00304 // --- Common functions implemented as macros ----------------------------------
00305 
00306 #undef min
00307 #define min( x, y ) ( (x) < (y) ? (x) : (y) )
00308 
00309 #undef max
00310 #define max( x, y ) ( (x) > (y) ? (x) : (y) )
00311 
00312 
00313 
00314 // --- Other macro definitions -------------------------------------------------
00315 
00316 #define FLA_NEGATE( a ) \
00317         ( a.base == FLA_ONE.base ? FLA_MINUS_ONE : FLA_ONE )
00318 
00319 
00320 
00321 // --- Pass-through macros for BLIS --------------------------------------------
00322 
00323 #ifdef FLA_ENABLE_CBLAS_INTERFACES
00324   #define BLIS_ENABLE_CBLAS_INTERFACES
00325 #endif
00326 
00327 #ifdef FLA_ENABLE_WINDOWS_BUILD
00328   #define BLIS_ENABLE_WINDOWS_BUILD
00329 #endif
00330 
00331 #ifdef FLA_ENABLE_UPPERCASE_F77
00332   #define BLIS_ENABLE_UPPERCASE_F77
00333 #endif
00334