00001
00007 #if !defined(INC_OSKI_MATMULT_H) && !defined(OSKI_UNBIND)
00008
00009 #define INC_OSKI_MATMULT_H
00010
00011 #include <oski/mangle.h>
00012 #include <oski/matrix.h>
00013 #include <oski/vecview.h>
00014
00015 #if defined(DO_NAME_MANGLING)
00016
00018 #define oski_MatMult_funcpt MANGLE_(oski_MatMult_funcpt)
00019 #define oski_MatReprMult_funcpt MANGLE_(oski_MatReprMult_funcpt)
00020 #define oski_MatMult MANGLE_(oski_MatMult)
00021 #define oski_CheckArgsMatMult MANGLE_(oski_CheckArgsMatMult)
00022 #define oski_traceargs_MatMult_t MANGLE_(oski_traceargs_MatMult_t)
00023 #define oski_MakeArglistMatMult MANGLE_(oski_MakeArglistMatMult)
00024
00025 #endif
00026
00046 #define OSKI_MATMULT_COMPAT_DIMS( m_A, k_A, k_B, n_B, m_C, n_C ) \
00047 ( OSKI_CHECK_MAT_DIMS(m_A, k_A) && OSKI_CHECK_MAT_DIMS(k_B, n_B) \
00048 && OSKI_CHECK_MAT_DIMS(m_C, n_C) \
00049 && ((m_A) == (m_C)) && ((k_A) == (k_B)) && ((n_B) == (n_C)) )
00050
00070 #define OSKI_MATTRANSMULT_COMPAT_DIMS( m_A, k_A, k_B, n_B, m_C, n_C ) \
00071 ( OSKI_CHECK_MAT_DIMS(m_A, k_A) && OSKI_CHECK_MAT_DIMS(k_B, n_B) \
00072 && OSKI_CHECK_MAT_DIMS(m_C, n_C) \
00073 && ((k_A) == (m_C)) && ((m_A) == (k_B)) && ((n_B) == (n_C)) )
00074
00087 #define OSKI_MATMULT_COMPAT_OBJ_DIMS( A, B, C ) \
00088 OSKI_MATMULT_COMPAT_DIMS( (A)->num_rows, (A)->num_cols, \
00089 ((B) == INVALID_VEC) \
00090 || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \
00091 ? (A)->num_cols : (B)->num_rows, \
00092 ((B) == INVALID_VEC) \
00093 || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \
00094 ? (C)->num_cols : (B)->num_cols, \
00095 ((C) == INVALID_VEC) \
00096 || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \
00097 ? (A)->num_rows : (C)->num_rows, \
00098 ((C) == INVALID_VEC) \
00099 || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \
00100 ? (B)->num_cols : (C)->num_cols \
00101 )
00102
00116 #define OSKI_MATTRANSMULT_COMPAT_OBJ_DIMS( A, B, C ) \
00117 OSKI_MATTRANSMULT_COMPAT_DIMS( (A)->num_rows, (A)->num_cols, \
00118 ((B) == INVALID_VEC) \
00119 || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \
00120 ? (A)->num_rows : (B)->num_rows, \
00121 ((B) == INVALID_VEC) \
00122 || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \
00123 ? (C)->num_cols : (B)->num_cols, \
00124 ((C) == INVALID_VEC) \
00125 || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \
00126 ? (A)->num_cols : (C)->num_rows, \
00127 ((C) == INVALID_VEC) \
00128 || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \
00129 ? (B)->num_cols : (C)->num_cols \
00130 )
00131
00132
00140 int
00141 oski_MatMult (const oski_matrix_t A_tunable, oski_matop_t opA,
00142 oski_value_t alpha, const oski_vecview_t x_view,
00143 oski_value_t beta, oski_vecview_t y_view);
00144
00149 int
00150 oski_CheckArgsMatMult (const oski_matrix_t A_tunable,
00151 oski_matop_t opA,
00152 oski_value_t alpha, const oski_vecview_t x_view,
00153 oski_value_t beta, const oski_vecview_t y_view,
00154 const char *caller);
00155
00156
00160 typedef int (*oski_MatMult_funcpt) (const oski_matrix_t A_tunable,
00161 oski_matop_t opA, oski_value_t alpha,
00162 const oski_vecview_t x_view,
00163 oski_value_t beta, oski_vecview_t y_view);
00164
00169 typedef int (*oski_MatReprMult_funcpt) (const void *A,
00170 const oski_matcommon_t * props,
00171 oski_matop_t opA, oski_value_t alpha,
00172 const oski_vecview_t x_view,
00173 oski_value_t beta,
00174 oski_vecview_t y_view);
00175
00183 typedef struct
00184 {
00186
00187 oski_matop_t opA;
00188 oski_index_t num_vecs;
00189 oski_value_t alpha;
00190 oski_storage_t x_orient;
00191 oski_value_t beta;
00192 oski_storage_t y_orient;
00194 }
00195 oski_traceargs_MatMult_t;
00196
00198 void oski_MakeArglistMatMult (oski_matop_t opA,
00199 oski_value_t alpha, const oski_vecview_t x_view,
00200 oski_value_t beta, const oski_vecview_t y_view,
00201 oski_traceargs_MatMult_t * args);
00202
00204 #define GET_XFLOP_MatMult(args) \
00205 (2.0*((const oski_traceargs_MatMult_t *)(args))->num_vecs)
00206
00209 #endif
00210
00211 #if defined(OSKI_UNBIND)
00212 # include <oski/mangle.h>
00213 # include <oski/matrix.h>
00214 # include <oski/vecview.h>
00215 # undef INC_OSKI_MATMULT_H
00216 # undef oski_MatMult_funcpt
00217 # undef oski_MatReprMult_funcpt
00218 # undef oski_MatMult
00219 # undef oski_CheckArgsMatMult
00220 # undef oski_traceargs_MatMult_t
00221 # undef oski_MakeArglistMatMult
00222 # undef OSKI_MATMULT_COMPAT_DIMS
00223 # undef OSKI_MATTRANSMULT_COMPAT_DIMS
00224 # undef OSKI_MATMULT_COMPAT_OBJ_DIMS
00225 # undef OSKI_MATTRANSMULT_COMPAT_OBJ_DIMS
00226 # undef GET_XFLOP_MatMult
00227 #endif
00228
00229