@@ -61,30 +61,23 @@ def generate_fm_source_files(A_eval_order, A_reduced_exprs, B_reduced_exprs, B_r
61
61
n_B_mats = len (B_names )
62
62
63
63
64
-
65
- content += f" matlincomb_double_contiguous(tmp0, { n_A_mats } , (double_cmat[{ n_A_mats } ])"
66
- content += "{"
67
- for name in A_names :
68
- content += f"{ name } , "
69
- content += "}"
70
- content += f", (int8_t[{ n_A_mats } ])"
71
- content += "{"
64
+ content += f" static const int8_t A_coeffs_{ fm_index } [{ n_A_mats } ] = {{"
72
65
for c in A_coeffs :
73
66
content += f"{ c } , "
74
- content += "}"
75
- content += ");\n "
76
-
77
- content += f" matlincomb_double_contiguous(tmp1, { n_B_mats } , (double_cmat[{ n_B_mats } ])"
78
- content += "{"
79
- for name in B_names :
80
- content += f"{ name } , "
81
- content += "}"
82
- content += f", (int8_t[{ n_B_mats } ])"
83
- content += "{"
67
+ content += "};\n "
68
+
69
+ for idx , name in enumerate (A_names ):
70
+ content += f" marr[{ idx } ]={ name } ;\n "
71
+ content += f" matlincomb_double_contiguous(tmp0, { n_A_mats } , (double_cmat*)marr, (int8_t*)A_coeffs_{ fm_index } );\n "
72
+
73
+ content += f" static const int8_t B_coeffs_{ fm_index } [{ n_B_mats } ] = {{"
84
74
for c in B_coeffs :
85
75
content += f"{ c } , "
86
- content += "}"
87
- content += ");\n "
76
+ content += "};\n "
77
+
78
+ for idx , name in enumerate (B_names ):
79
+ content += f" marr[{ idx } ]={ name } ;\n "
80
+ content += f" matlincomb_double_contiguous(tmp1, { n_B_mats } , (double_cmat*)marr, (int8_t*)B_coeffs_{ fm_index } );\n "
88
81
89
82
content += " cblas_dscal(BL*BL, dnum17, &tmp0.data[0][0], 1);\n "
90
83
@@ -167,6 +160,7 @@ def generate_fmm_32x32_source():
167
160
double_cmat tmp0, tmp1;
168
161
create_double_matrix(pairint {BL, BL}, &tmp0);
169
162
create_double_matrix(pairint {BL, BL}, &tmp1);
163
+ double_cmat marr[60] = {NULL};
170
164
"""
171
165
172
166
for j in range (1 ,33 ):
@@ -284,17 +278,14 @@ def generate_fAxxeval_source_files(A_eval_order, A_reduced_exprs, B_reduced_expr
284
278
285
279
n_A_mats = len (A_names )
286
280
287
-
288
- content += f" matlincomb_double_contiguous({ idf } , { n_A_mats } , (double_cmat[{ n_A_mats } ])"
289
- content += "{"
290
- for name in A_names :
291
- content += f"{ name } , "
292
- content += "}"
293
- content += f", (int8_t[{ n_A_mats } ])"
294
- content += "{"
281
+ content += f" static const int8_t A_coeffs_{ func_name } [{ n_A_mats } ] = {{"
295
282
for c in A_coeffs :
296
283
content += f"{ c } , "
297
- content += "});\n "
284
+ content += "};\n "
285
+
286
+ for idx , name in enumerate (A_names ):
287
+ content += f" marr[{ idx } ]={ name } ;\n "
288
+ content += f" matlincomb_double_contiguous({ idf } , { n_A_mats } , (double_cmat*)marr, (int8_t*)A_coeffs_{ func_name } );\n "
298
289
Axxi2code [i ] = content
299
290
return Axxi2code
300
291
@@ -314,19 +305,15 @@ def generate_fBx_source_files(A_eval_order, A_reduced_exprs, B_reduced_exprs, B_
314
305
315
306
316
307
reset_var = f"{ idf } "
317
- content += f" memset(&{ reset_var } .data[0][0], 0, sizeof({ reset_var } .data[0][0])*{ reset_var } .shape[0]*{ reset_var } .shape[1]);\n "
318
-
319
- content += f" matlincomb_double_contiguous({ idf } , { n_B_mats } , (double_cmat[{ n_B_mats } ])"
320
- content += "{"
321
- for name in B_names :
322
- content += f"{ name } , "
323
- content += "}"
324
- content += f", (int8_t[{ n_B_mats } ])"
325
- content += "{"
308
+
309
+ content += f" static const int8_t B_coeffs_{ idf } [{ n_B_mats } ] = {{"
326
310
for c in B_coeffs :
327
311
content += f"{ c } , "
328
- content += "}"
329
- content += ");\n "
312
+ content += "};\n "
313
+
314
+ for idx , name in enumerate (B_names ):
315
+ content += f" marr[{ idx } ]={ name } ;\n "
316
+ content += f" matlincomb_double_contiguous({ idf } , { n_B_mats } , (double_cmat*)marr, (int8_t*)B_coeffs_{ idf } );\n "
330
317
Bxi2code [idf ] = content
331
318
return Bxi2code
332
319
0 commit comments