@@ -50,6 +50,8 @@ int create_float_matrix(int shape[2], float_cmat* p_new_mat) {
50
50
}
51
51
52
52
int create_double_matrix (int shape [2 ], double_cmat * p_new_mat ) {
53
+ //printf("create mat\n");
54
+ //printf("shape %d %d\n", shape[0], shape[1]);
53
55
// create a matrix with 0.0 in shape [shape[0], shape[1]]
54
56
int N = shape [0 ] * shape [1 ];
55
57
(* p_new_mat ).data = (double * * )malloc (shape [0 ] * sizeof (double * ));
@@ -66,6 +68,7 @@ int create_double_matrix(int shape[2], double_cmat* p_new_mat) {
66
68
for (int j = 0 ; j < N ; j ++ ) {
67
69
(* p_new_mat ).arena [j ] = 0.0 ;
68
70
}
71
+ //printf("create mat finished\n");
69
72
return 0 ;
70
73
}
71
74
@@ -205,6 +208,7 @@ float_cmat slice_float_matrix(float_cmat mat, int slice0[2], int slice1[2]) {
205
208
}
206
209
207
210
double_cmat slice_double_matrix (double_cmat mat , int slice0 [2 ], int slice1 [2 ]) {
211
+ //printf("slice double\n");
208
212
double_cmat empty_mat ;
209
213
empty_mat .data = NULL ;
210
214
empty_mat .arena = NULL ;
@@ -244,6 +248,7 @@ double_cmat slice_double_matrix(double_cmat mat, int slice0[2], int slice1[2]) {
244
248
}
245
249
246
250
int create_slice_double_matrix_contiguous (double_cmat * dst , double_cmat mat , int slice0 [2 ], int slice1 [2 ]) {
251
+ //printf("slice conting\n");
247
252
// dst = mat[slice0, slice1]
248
253
if (slice0 [1 ] < 0 ) {
249
254
slice0 [1 ] += mat .shape [0 ];
@@ -267,6 +272,7 @@ int create_slice_double_matrix_contiguous(double_cmat *dst, double_cmat mat, int
267
272
}
268
273
269
274
int create_double_contiguous_from_slice (double_cmat * dest , double_cmat * src ) {
275
+ //printf("create contig from slice\n");
270
276
// dest = src.contiguous().copy()
271
277
int i , j ;
272
278
int rows = src -> shape [0 ];
@@ -333,6 +339,7 @@ int assign_float_slice(float_cmat m1, float_cmat m2, int slice0[2], int slice1[2
333
339
}
334
340
335
341
int assign_double_slice (double_cmat m1 , double_cmat m2 , int slice0 [2 ], int slice1 [2 ]) {
342
+ //printf("assign slice\n");
336
343
// assign m2 to a slice of m1 defined by slice0(x) and slice1(y)
337
344
// m1[slice0, slice1] = m2
338
345
if (slice0 [1 ] < 0 ) {
@@ -355,6 +362,7 @@ int assign_double_slice(double_cmat m1, double_cmat m2, int slice0[2], int slice
355
362
}
356
363
357
364
int assign_double_clone (double_cmat m1 , double_cmat m2 ) {
365
+ //printf("assign double clone\n");
358
366
// m1 = m2.copy()
359
367
if (!(m1 .shape [0 ] == m2 .shape [0 ] && m1 .shape [1 ] == m2 .shape [1 ])) {
360
368
return -1 ;
@@ -366,7 +374,8 @@ int assign_double_clone(double_cmat m1, double_cmat m2) {
366
374
return 0 ;
367
375
}
368
376
369
- int matlincomb_double_contiguous (double_cmat res , int n_mats , double_cmat * mats , double * coeffs ) {
377
+ int matlincomb_double_contiguous (double_cmat res , int n_mats , double_cmat * mats , int8_t * coeffs ) {
378
+ //printf("lincomb\n");
370
379
// res = coeffs[0] * mats[0] + ... + coeffs[n_mats-1] * mats[n_mats-1]
371
380
// memset(&res.data[0][0], 0, sizeof(res.data[0][0])*res.shape[0]*res.shape[1]); // should not reset because it could appear in RHS
372
381
if (n_mats <= 0 ) {
@@ -663,6 +672,7 @@ int free_float_matrix(float_cmat m) {
663
672
}
664
673
665
674
int free_double_matrix (double_cmat m ) {
675
+ //printf("free\n");
666
676
free (m .data );
667
677
if (m .arena_shape [0 ] == m .shape [0 ] && m .arena_shape [1 ] == m .shape [1 ]) {
668
678
free (m .arena );
0 commit comments