@@ -130,7 +130,7 @@ int create_double_matrix_from_array(shape_uint shape[2], double* array, shape_ui
130
130
return 0 ;
131
131
}
132
132
133
- int_cmat slice_int_matrix (int_cmat mat , shape_uint slice0 [2 ], shape_uint slice1 [2 ]) {
133
+ int_cmat slice_int_matrix (int_cmat mat , shape_int slice0 [2 ], shape_int slice1 [2 ]) {
134
134
int_cmat empty_mat ;
135
135
empty_mat .data = NULL ;
136
136
empty_mat .arena = NULL ;
@@ -169,7 +169,7 @@ int_cmat slice_int_matrix(int_cmat mat, shape_uint slice0[2], shape_uint slice1[
169
169
return new_mat ;
170
170
}
171
171
172
- float_cmat slice_float_matrix (float_cmat mat , shape_uint slice0 [2 ], shape_uint slice1 [2 ]) {
172
+ float_cmat slice_float_matrix (float_cmat mat , shape_int slice0 [2 ], shape_int slice1 [2 ]) {
173
173
float_cmat empty_mat ;
174
174
empty_mat .data = NULL ;
175
175
empty_mat .arena = NULL ;
@@ -208,7 +208,7 @@ float_cmat slice_float_matrix(float_cmat mat, shape_uint slice0[2], shape_uint s
208
208
return new_mat ;
209
209
}
210
210
211
- double_cmat slice_double_matrix (double_cmat mat , shape_uint slice0 [2 ], shape_uint slice1 [2 ]) {
211
+ double_cmat slice_double_matrix (double_cmat mat , shape_int slice0 [2 ], shape_int slice1 [2 ]) {
212
212
//printf("slice double\n");
213
213
double_cmat empty_mat ;
214
214
empty_mat .data = NULL ;
@@ -248,7 +248,7 @@ double_cmat slice_double_matrix(double_cmat mat, shape_uint slice0[2], shape_uin
248
248
return new_mat ;
249
249
}
250
250
251
- int create_slice_double_matrix_contiguous (double_cmat * dst , double_cmat mat , shape_uint slice0 [2 ], shape_uint slice1 [2 ]) {
251
+ int create_slice_double_matrix_contiguous (double_cmat * dst , double_cmat mat , shape_int slice0 [2 ], shape_int slice1 [2 ]) {
252
252
//printf("slice conting\n");
253
253
// dst = mat[slice0, slice1]
254
254
if (slice0 [1 ] < 0 ) {
@@ -301,7 +301,7 @@ int create_double_contiguous_from_slice(double_cmat *dest, double_cmat *src) {
301
301
return 0 ;
302
302
}
303
303
304
- int assign_int_slice (int_cmat m1 , int_cmat m2 , shape_uint slice0 [2 ], shape_uint slice1 [2 ]) {
304
+ int assign_int_slice (int_cmat m1 , int_cmat m2 , shape_int slice0 [2 ], shape_int slice1 [2 ]) {
305
305
if (slice0 [1 ] < 0 ) {
306
306
slice0 [1 ] += m1 .shape [0 ];
307
307
}
@@ -320,7 +320,7 @@ int assign_int_slice(int_cmat m1, int_cmat m2, shape_uint slice0[2], shape_uint
320
320
return 0 ;
321
321
}
322
322
323
- int assign_float_slice (float_cmat m1 , float_cmat m2 , shape_uint slice0 [2 ], shape_uint slice1 [2 ]) {
323
+ int assign_float_slice (float_cmat m1 , float_cmat m2 , shape_int slice0 [2 ], shape_int slice1 [2 ]) {
324
324
if (slice0 [1 ] < 0 ) {
325
325
slice0 [1 ] += m1 .shape [0 ];
326
326
}
@@ -339,7 +339,7 @@ int assign_float_slice(float_cmat m1, float_cmat m2, shape_uint slice0[2], shape
339
339
return 0 ;
340
340
}
341
341
342
- int assign_double_slice (double_cmat m1 , double_cmat m2 , shape_uint slice0 [2 ], shape_uint slice1 [2 ]) {
342
+ int assign_double_slice (double_cmat m1 , double_cmat m2 , shape_int slice0 [2 ], shape_int slice1 [2 ]) {
343
343
//printf("assign slice\n");
344
344
// assign m2 to a slice of m1 defined by slice0(x) and slice1(y)
345
345
// m1[slice0, slice1] = m2
@@ -718,8 +718,8 @@ int main() {
718
718
}
719
719
create_double_matrix_from_array (pairint {2 , 3 }, double_array2 , 6 , pairint {0 , 0 }, & array_double2 );
720
720
print_double_matrix (array_double2 );
721
- shape_uint slice_double_lr0 [2 ] = {1 , 3 };
722
- shape_uint slice_double_lr1 [2 ] = {1 , -1 };
721
+ shape_int slice_double_lr0 [2 ] = {1 , 3 };
722
+ shape_int slice_double_lr1 [2 ] = {1 , -1 };
723
723
double_cmat slice_double2 = slice_double_matrix (array_double2 , slice_double_lr0 , slice_double_lr1 );
724
724
print_double_matrix (slice_double2 );
725
725
free_double_matrix (array_double2 );
0 commit comments