00001
00006 #if !defined(INC_OSKI_VECTOR_H) && !defined(OSKI_UNBIND)
00007
00008 #define INC_OSKI_VECTOR_H
00009
00010 #include <oski/mangle.h>
00011
00012 #if defined(DO_MANGLE_NAMES)
00013
00015 #define oski_vecstruct_t MANGLE_(oski_vecstruct_t)
00016
00017 #endif
00018
00039 typedef struct
00040 {
00041 oski_index_t num_rows;
00042 oski_index_t num_cols;
00044 oski_storage_t orient;
00045 oski_index_t stride;
00047 oski_index_t rowinc;
00048 oski_index_t colinc;
00050 oski_value_t *val;
00051 }
00052 oski_vecstruct_t;
00053
00055 #define MAKE_VECSTRUCT_INIT(m, n, orient, stride, rowinc, colinc, val) \
00056 {m, n, orient, stride, rowinc, colinc, val}
00057
00069 #define VECRM_GET(v, i, j, s) (v)[(i)*(s) + (j)]
00070
00082 #define VECCM_GET(v, i, j, s) (v)[(i) + (j)*(s)]
00083
00092 #define VECVIEW_GET(x, i, j) \
00093 (((x)->orient == LAYOUT_ROWMAJ) \
00094 ? VECRM_GET((x)->val, i, j, (x)->stride) \
00095 : VECCM_GET((x)->val, i, j, (x)->stride) \
00096 )
00097
00099 #define IS_VECVIEW_COLVEC(x) ((x)->num_cols == 1)
00100
00102 #define IS_VECVIEW_COLVEC_STRIDE1(x) \
00103 ( \
00104 IS_VECVIEW_COLVEC(x) \
00105 && ( \
00106 (((x)->orient == LAYOUT_ROWMAJ) && ((x)->stride == 1)) \
00107 || (((x)->orient == LAYOUT_COLMAJ)) \
00108 ) \
00109 )
00110
00111 #endif
00112
00113 #if defined(OSKI_UNBIND)
00114 # include <oski/mangle.h>
00115 # undef oski_vecstruct_t
00116 # undef MAKE_VECSTRUCT_INIT
00117 # undef VECRM_GET
00118 # undef VECCM_GET
00119 # undef VECVIEW_GET
00120 # undef IS_VECVIEW_COLVEC
00121 # undef IS_VECVIEW_COLVEC_STRIDE1
00122 #endif
00123
00124