Skip to content

Commit a42b5b1

Browse files
committed
fix: add missing mat__norm_fro_fast_scalar dispatch function
1 parent fa64aa3 commit a42b5b1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

mat.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3495,6 +3495,16 @@ MATDEF mat_elem_t mat_norm_fro(const Mat *a) {
34953495
return MAT_DISPATCH(norm_fro)(a);
34963496
}
34973497

3498+
MAT_INTERNAL_STATIC mat_elem_t mat__norm_fro_fast_scalar(const Mat *a) {
3499+
size_t len = a->rows * a->cols;
3500+
mat_elem_t *pa = a->data;
3501+
mat_elem_t sum = 0;
3502+
for (size_t i = 0; i < len; i++) {
3503+
sum += pa[i] * pa[i];
3504+
}
3505+
return MAT_SQRT(sum);
3506+
}
3507+
34983508
#ifdef MAT_HAS_ARM_NEON
34993509
MAT_INTERNAL_STATIC mat_elem_t mat__norm_fro_fast_neon(const Mat *a) {
35003510
size_t len = a->rows * a->cols;

0 commit comments

Comments
 (0)