AnsweredAssumed Answered

Why the matrix multiplication is slow?

Question asked by HJ_KIM on Nov 1, 2017
Latest reply on Dec 23, 2017 by AndyK2
The documentation for 21489 states that the [4x4] x [4x1] matrix multiplication speed is 20ns.
However, when I run the example, it is 340ns.
400Mhz 21489 EZ Kit, and matmmltf() is used.
Are there any settings for matrix operations?
I attach my code and project.
Thank you!
#include <matrix.h>
#include <time.h>
#include "adi_initialize.h"
#include "Test2231.h"
time_t start_time, stop_time;
double time_used;
void main()
            float input_1[4][4], *a_p = (float *) (&input_1);
            float input_2[4][1], *b_p = (float *) (&input_2);
            float result[4][1], *res_p = (float *) (&result);
            for(int i=0; i<4;i++){
                  for(int j=0; j<4;j++){
                        input_1[i][j] = (i+1)*(j+1);
                        input_2[i][0] = 0.2*(i+1);
            start_time = clock();
            matmmltf(res_p, a_p, b_p, 4, 4, 1);
            stop_time = clock();
            time_used = ((double)(stop_time-start_time))/CLOCKS_PER_SEC;