44 #include "RTOp_SparseSubVector.h"
46 void RTOp_sparse_sub_vector(
47 RTOp_index_type global_offset, RTOp_index_type sub_dim
48 ,RTOp_index_type sub_nz,
const RTOp_value_type values[], ptrdiff_t values_stride
49 ,
const RTOp_index_type indices[], ptrdiff_t indices_stride
50 ,ptrdiff_t local_offset,
int is_sorted
58 ( sub_nz && ( values != NULL && indices != NULL && indices_stride != 0 && sub_nz <= sub_dim ) )
59 || !sub_nz || ( sub_nz == sub_dim && indices == NULL )
63 sub_vec->global_offset = global_offset;
64 sub_vec->sub_dim = sub_dim;
65 sub_vec->sub_nz = sub_nz;
66 sub_vec->values = values;
67 sub_vec->values_stride = values_stride;
69 sub_vec->indices_stride = indices_stride;
70 sub_vec->local_offset = local_offset;
71 sub_vec->is_sorted = is_sorted;
76 sub_vec->global_offset = 0;
79 sub_vec->values = NULL;
80 sub_vec->values_stride = 0;
82 sub_vec->indices_stride = 0;
83 sub_vec->local_offset = 0;
84 sub_vec->is_sorted = 0;
87 void RTOp_sparse_sub_vector_from_dense(
92 spc_sub_vec->global_offset = sub_vec->global_offset;
93 spc_sub_vec->sub_dim = sub_vec->sub_dim;
94 spc_sub_vec->sub_nz = sub_vec->sub_dim;
95 spc_sub_vec->values = sub_vec->values;
96 spc_sub_vec->values_stride = sub_vec->values_stride;
98 spc_sub_vec->indices_stride = 0;
99 spc_sub_vec->local_offset = 0;
100 spc_sub_vec->is_sorted = 0;
const RTOp_index_type * indices