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) 2009, 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 // --- Miscellaneous macro definitions -----------------------------------------
00034 
00035 #undef  NULL
00036 #define NULL 0
00037 
00038 // --- Type-related macro definitions ------------------------------------------
00039 
00040 // FLA_Bool
00041 #define TRUE  1
00042 #define FALSE 0
00043 
00044 // WARNING: If any of the values below are changed, the corresponding
00045 // Fortran definitions may need to be changed in FLAMEf.h as well! 
00046 
00047 // FLA_Error (non-specific)
00048 #define FLA_SUCCESS             0
00049 #define FLA_FAILURE           (-1)
00050 
00051 // FLA_Quadrant
00052 #define FLA_TL                 11
00053 #define FLA_TR                 12
00054 #define FLA_BL                 21
00055 #define FLA_BR                 22
00056 
00057 // FLA_Datatype
00058 #define FLA_FLOAT             100
00059 #define FLA_DOUBLE            101
00060 #define FLA_COMPLEX           102
00061 #define FLA_DOUBLE_COMPLEX    103
00062 #define FLA_INT               104
00063 #define FLA_CONSTANT          105
00064 #define FLA_OBJ               106  // for internal use only!
00065 
00066 // FLA_Elemtype
00067 #define FLA_MATRIX            150
00068 #define FLA_SCALAR            151
00069 
00070 // FLA_Side
00071 #define FLA_TOP               200
00072 #define FLA_BOTTOM            201
00073 #define FLA_LEFT              210
00074 #define FLA_RIGHT             211
00075 #define FLA_SIDE_MASK         0x1
00076 
00077 // FLA_Uplo
00078 #define FLA_LOWER_TRIANGULAR  300
00079 #define FLA_UPPER_TRIANGULAR  301
00080 #define FLA_UPLO_MASK         0x1
00081 
00082 // FLA_Trans
00083 #define FLA_NO_TRANSPOSE      400
00084 #define FLA_TRANSPOSE         401
00085 #define FLA_CONJ_TRANSPOSE    402
00086 #define FLA_CONJ_NO_TRANSPOSE 403
00087 #define FLA_TRANS_MASK        0x3
00088 
00089 // FLA_Conj
00090 #define FLA_NO_CONJUGATE      450
00091 #define FLA_CONJUGATE         451
00092 
00093 // FLA_Diag
00094 #define FLA_UNIT_DIAG         500
00095 #define FLA_NONUNIT_DIAG      501
00096 #define FLA_ZERO_DIAG         502
00097 #define FLA_DIAG_MASK         0x3
00098 
00099 // FLA_Dimension
00100 #define FLA_DIMENSION_M       600
00101 #define FLA_DIMENSION_K       601
00102 #define FLA_DIMENSION_N       602
00103 #define FLA_DIMENSION_MIN     603
00104 
00105 // FLA_Dimension_index
00106 #define FLA_DIM_M_INDEX         0
00107 #define FLA_DIM_K_INDEX         1
00108 #define FLA_DIM_N_INDEX         2
00109 #define FLA_DIM_MIN_INDEX       3
00110 #define FLA_DIM_INDEX_MASK    0x3
00111 
00112 // FLA_Pivot_type
00113 #define FLA_NATIVE_PIVOTS     700
00114 #define FLA_LAPACK_PIVOTS     701
00115 
00116 // FLA_Direct
00117 #define FLA_FORWARD           800
00118 #define FLA_BACKWARD          801
00119 
00120 // FLA_Store
00121 #define FLA_COLUMNWISE        900
00122 #define FLA_ROWWISE           901
00123 
00124 // FLA_Matrix_type
00125 #define FLA_FLAT             1000
00126 #define FLA_HIER             1001
00127 
00128 // FLA_Precision
00129 #define FLA_SINGLE_PRECISION 1100
00130 #define FLA_DOUBLE_PRECISION 1101
00131 
00132 // FLA_Domain
00133 #define FLA_REAL_DOMAIN      1200
00134 #define FLA_COMPLEX_DOMAIN   1201
00135 
00136 
00137 // FLAME threading model
00138 #define FLA_OPENMP              1
00139 #define FLA_PTHREADS            2
00140 
00141 // FLAME internal error checking level
00142 #define FLA_FULL_ERROR_CHECKING 2
00143 #define FLA_MIN_ERROR_CHECKING  1
00144 #define FLA_NO_ERROR_CHECKING   0
00145 
00146 // FLA_Datatype_index
00147 #define FLA_S_INDEX             0
00148 #define FLA_D_INDEX             1
00149 #define FLA_C_INDEX             2
00150 #define FLA_Z_INDEX             3
00151 #define FLA_DTYPE_INDEX_MASK  0x3
00152 
00153 // Default blocksize if none are available.
00154 #ifndef FLA_DEFAULT_M_BLOCKSIZE
00155   #define FLA_DEFAULT_M_BLOCKSIZE  128
00156 #endif
00157 #ifndef FLA_DEFAULT_K_BLOCKSIZE
00158   #define FLA_DEFAULT_K_BLOCKSIZE  128
00159 #endif
00160 #ifndef FLA_DEFAULT_N_BLOCKSIZE
00161   #define FLA_DEFAULT_N_BLOCKSIZE  128
00162 #endif
00163 
00164 // QR and LQ factorizations typically has an inner blocksize that corresponds
00165 // to the length of the S (or T) block Householder matrix. For consistency, we
00166 // define the ratio of the inner blocksize to the outer blocksize here, as it
00167 // is used in several places.
00168 #define FLA_QR_INNER_TO_OUTER_B_RATIO (0.25)
00169 #define FLA_LQ_INNER_TO_OUTER_B_RATIO (0.25)
00170 #define FLA_LU_INNER_TO_OUTER_B_RATIO (0.25)
00171 
00172 
00173 // --- Error-related macro definitions -----------------------------------------
00174 
00175 // Useful when determining the relative index base of the error codes.
00176 #define FLA_ERROR_CODE_MIN                    (-10)
00177 
00178 // FLA_Error values.
00179 #define FLA_INVALID_SIDE                      (-10)
00180 #define FLA_INVALID_UPLO                      (-11)
00181 #define FLA_INVALID_TRANS                     (-12)
00182 #define FLA_INVALID_TRANS_GIVEN_DATATYPE      (-13)
00183 #define FLA_INVALID_CONJ                      (-14)
00184 #define FLA_INVALID_DIRECT                    (-15)
00185 #define FLA_INVALID_STOREV                    (-16)
00186 #define FLA_INVALID_DATATYPE                  (-17)
00187 #define FLA_INVALID_INTEGER_DATATYPE          (-18)
00188 #define FLA_INVALID_REAL_DATATYPE             (-19)
00189 #define FLA_INVALID_COMPLEX_DATATYPE          (-20)
00190 #define FLA_OBJECT_NOT_INTEGER                (-21)
00191 #define FLA_OBJECT_NOT_REAL                   (-22)
00192 #define FLA_OBJECT_NOT_COMPLEX                (-23)
00193 #define FLA_OBJECT_NOT_SQUARE                 (-24)
00194 #define FLA_OBJECT_NOT_SCALAR                 (-25)
00195 #define FLA_OBJECT_NOT_VECTOR                 (-26)
00196 #define FLA_INCONSISTENT_DATATYPES            (-27)
00197 #define FLA_NONCONFORMAL_DIMENSIONS           (-28)
00198 #define FLA_UNEQUAL_VECTOR_LENGTHS            (-29)
00199 #define FLA_INVALID_HESSENBERG_INDICES        (-30)
00200 #define FLA_INVALID_VECTOR_LENGTH             (-31)
00201 #define FLA_NULL_POINTER                      (-32)
00202 #define FLA_SPECIFIED_OBJ_DIM_MISMATCH        (-33)
00203 #define FLA_SPECIFIED_OBJ_LDIM_MISMATCH       (-34)
00204 #define FLA_INVALID_PIVOT_TYPE                (-35)
00205 #define FLA_MALLOC_RETURNED_NULL_POINTER      (-37)
00206 #define FLA_OBJECT_BASE_BUFFER_MISMATCH       (-38)
00207 #define FLA_OBJECTS_NOT_VERTICALLY_ADJ        (-39)
00208 #define FLA_OBJECTS_NOT_HORIZONTALLY_ADJ      (-40)
00209 #define FLA_ADJACENT_OBJECT_DIM_MISMATCH      (-41)
00210 #define FLA_OBJECTS_NOT_VERTICALLY_ALIGNED    (-42)
00211 #define FLA_OBJECTS_NOT_HORIZONTALLY_ALIGNED  (-43)
00212 #define FLA_INVALID_FLOATING_DATATYPE         (-44)
00213 #define FLA_OBJECT_NOT_FLOATING_POINT         (-45)
00214 #define FLA_INVALID_BLOCKSIZE_VALUE           (-46)
00215 #define FLA_OPEN_RETURNED_ERROR               (-47)
00216 #define FLA_LSEEK_RETURNED_ERROR              (-48)
00217 #define FLA_CLOSE_RETURNED_ERROR              (-49)
00218 #define FLA_UNLINK_RETURNED_ERROR             (-50)
00219 #define FLA_READ_RETURNED_ERROR               (-51)
00220 #define FLA_WRITE_RETURNED_ERROR              (-52)
00221 #define FLA_INVALID_QUADRANT                  (-53)
00222 #define FLA_NOT_YET_IMPLEMENTED               (-54)
00223 #define FLA_EXPECTED_NONNEGATIVE_VALUE        (-55)
00224 #define FLA_SUPERMATRIX_NOT_ENABLED           (-56)
00225 #define FLA_UNDEFINED_ERROR_CODE              (-57)
00226 #define FLA_INVALID_DIAG                      (-58)
00227 #define FLA_INCONSISTENT_OBJECT_PRECISION     (-59)
00228 #define FLA_INVALID_BLOCKSIZE_OBJ             (-60)
00229 #define FLA_VECTOR_LENGTH_BELOW_MIN           (-61)
00230 #define FLA_PTHREAD_CREATE_RETURNED_ERROR     (-63)
00231 #define FLA_PTHREAD_JOIN_RETURNED_ERROR       (-64)
00232 #define FLA_INVALID_ISGN_VALUE                (-65)
00233 #define FLA_CHOL_FAILED_MATRIX_NOT_SPD        (-67)
00234 #define FLA_INVALID_ELEMTYPE                  (-68)
00235 #define FLA_POSIX_MEMALIGN_FAILED             (-69)
00236 #define FLA_INVALID_SUBMATRIX_DIMS            (-70)
00237 #define FLA_INVALID_SUBMATRIX_OFFSET          (-71)
00238 #define FLA_OBJECT_NOT_SCALAR_ELEMTYPE        (-72)
00239 #define FLA_OBJECT_NOT_MATRIX_ELEMTYPE        (-73)
00240 #define FLA_ENCOUNTERED_NON_POSITIVE_NTHREADS (-74)
00241 #define FLA_INVALID_CONJ_GIVEN_DATATYPE       (-75)
00242 #define FLA_INVALID_COMPLEX_TRANS             (-76)
00243 #define FLA_INVALID_REAL_TRANS                (-77)
00244 #define FLA_INVALID_BLAS_TRANS                (-78)
00245 #define FLA_INVALID_NONCONSTANT_DATATYPE      (-79)
00246 #define FLA_OBJECT_NOT_NONCONSTANT            (-80)
00247 #define FLA_INVALID_M_GIVEN_LDIM              (-81)
00248 #define FLA_OBJECT_DATATYPES_NOT_EQUAL        (-82)
00249 #define FLA_DIVIDE_BY_ZERO                    (-83)
00250 #define FLA_OBJECT_ELEMTYPES_NOT_EQUAL        (-84)
00251 #define FLA_INVALID_PIVOT_INDEX_RANGE         (-85)
00252 #define FLA_HOUSEH_PANEL_MATRIX_TOO_SMALL     (-86)
00253 #define FLA_INVALID_OBJECT_LENGTH             (-87)
00254 #define FLA_INVALID_OBJECT_WIDTH              (-88)
00255 #define FLA_INVALID_ERROR_CHECKING_LEVEL      (-89)
00256 #define FLA_ATTEMPTED_OVER_REPART_2X2         (-90)
00257 #define FLA_ATTEMPTED_OVER_REPART_2X1         (-91)
00258 #define FLA_ATTEMPTED_OVER_REPART_1X2         (-92)
00259 
00260 
00261 // Necessary when computing whether an error code is defined.
00262 #define FLA_ERROR_CODE_MAX                    (-92)
00263 
00264 // Internal string matrix limits.
00265 #define FLA_MAX_NUM_ERROR_MSGS                 150
00266 #define FLA_MAX_ERROR_MSG_LENGTH               200
00267 
00268 // Error code translation and output macro definition.
00269 #define FLA_Check_error_code( code ) \
00270         FLA_Check_error_code_helper( code, __FILE__, __LINE__ )
00271 
00272 
00273 
00274 // --- Common functions implemented as macros ----------------------------------
00275 
00276 #undef min
00277 #define min( x, y ) ( (x) < (y) ? (x) : (y) )
00278 
00279 #undef max
00280 #define max( x, y ) ( (x) > (y) ? (x) : (y) )
00281 
00282 
00283 
00284 // --- Other macro definitions -------------------------------------------------
00285 
00286 #define FLA_NEGATE( a ) \
00287         ( a.base == FLA_ONE.base ? FLA_MINUS_ONE : FLA_ONE )
00288 
00289 #define FLA_TRANS_MAP_TO_NC( trans ) \
00290         ( trans == FLA_NO_TRANSPOSE || trans == FLA_CONJ_NO_TRANSPOSE ? trans : \
00291           ( trans == FLA_TRANSPOSE ? FLA_NO_TRANSPOSE : FLA_CONJ_NO_TRANSPOSE ))
00292 
00293 #define FLA_TRANS_MAP_TO_NT( trans ) \
00294         ( trans == FLA_NO_TRANSPOSE || trans == FLA_TRANSPOSE ? trans : \
00295           ( trans == FLA_CONJ_NO_TRANSPOSE ? FLA_NO_TRANSPOSE : FLA_TRANSPOSE ))
00296 

Generated on Mon Jul 6 05:45:48 2009 for libflame by  doxygen 1.5.9