Matrix; Dspf_Sp_Mat_Mul - Texas Instruments TMS320C67 DSP Series Programmer's Reference Manual

Library
Hide thumbs Also See for TMS320C67 DSP Series:
Table of Contents

Advertisement

DSPF_sp_mat_mul

4.6 Matrix

DSPF_sp_mat_mul
Function
Arguments
Description
Algorithm
4-64
Single-precision matrix multiplication
void DSPF_sp_mat_mul (float *x, int r1, int c1, float *y, int c2, float *r)
x
Pointer to r1 by c1 input matrix.
r1
Number of rows in x.
c1
Number of columns in x. Also number of rows in y.
y
Pointer to c1 by c2 input matrix.
c2
Number of columns in y.
r
Pointer to r1 by c2 output matrix.
This function computes the expression "r = x * y" for the matrices x and y. The
column dimension of x must match the row dimension of y. The resulting matrix
has the same number of rows as x and the same number of columns as y. The
values stored in the matrices are assumed to be single-precision floating-point
values. This code is suitable for dense matrices. No optimizations are made
for sparse matrices.
void DSPF_sp_mat_mul(float *x, int r1, int c1, float *y, int
c2, float *r)
{
int i, j, k;
float sum;
//
Multiply each row in x by each column in y.
//
The product of row m in x and column n in y is placed
//
in position (m,n) in the result.
for (i = 0; i < r1; i++)
for (j = 0; j < c2; j++)
{
sum = 0;
for (k = 0; k < c1; k++)
sum += x[k + i*c1] * y[j + k*c2];
r[j + i*c2] = sum;
}
}

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C67 DSP Series and is the answer not in the manual?

Questions and answers

Table of Contents