DSPRelated.com
Forums

Complex Matrix Multiplication on C6711

Started by Raj Sahakari August 9, 2004
Hi c6x-ers,
 
I am currently facing a problem with complex matrix multiplication on TI-c6711.
 
I am using the DSPF_sp_mat_mul_cplx function (reference - spru657). However, this function seems to be giving erroneous results in some situations. I am unsure if I am using it correctly.
 
My current usage is as follows -
 
/* Multiply a 1x4 matrix with a 4x1 matrix to yield a 1x1 matrix */
 
float Mat_A[1][8], Mat_B[8][1], Mat_C[1][2];
DSPF_sp_mat_mul_cplx(*Mat_A, 1, 4, *Mat_B, 1, *Mat_C);
 
Mat_C sometimes gives wrong results.
 
I am particularly concerned with the "Special Requirements" for the DSPF_sp_mat_mul_cplx function, which state
(1) c1>=4 and r1,r2>=1
(2) x should be padded with 6 words
(3) x and y should be double-word aligned
 
Point (1) is definitely taken care of. However, I am not sure of points (2) and (3). I have tried various options like - pre-padding Mat_A with 3 zeros, post-padding Mat_A with 3 zeros (I have even tried 6 zeros!!), using the .align directive in the linker command file, etc. but to no avail.
 
Could someone kindly help in this regard by providing the correct usage of the DSPF_sp_mat_mul_cplx function, please.
 
Thanks and Regards,
Raj Sahakari.
 
P.S. The equivalent C code, however, seems to behave more predictably but does go on to give a few errors for the imaginary part, especially when the imaginary part reaches the order of about 1e-13 and below.
 
 
*********************************************************
Disclaimer:

This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com





Hi Raj,

We have various libraries to deal with matrices and vectors, including
complex matrix multiplication and as in your case, small complex vectors
dot product. Please see
http://microprocessing.iwarp.com/software/
http://www.sundance.com products: GDD300, GDD9000, GDD8000, GDD7000

I am sure that I can supply you with an optimized small complex dot
product routine that is faster than the TI C6711 DSPlib function
and is truly interruptible.

The reason why the DSPF_sp_mat_mul_cplx() does give erroneous results
is not clear for me know. The x array should be padded with 6 words
(6x4$ bytes) at the end of the array. The routine is not interruptible.
"interrupt-tolerant" means that it can be interrupted (that is, there
are no pending branch on each cycle) but, once interrupted it does not
guarantee that correct results would be obtained, and most probably,
an incorrect result would be almost always calculated. Does your system
work with interrupts?

Double-word alignment is simple if you add the pragmas

#pragma DATA_ALIGN (x, 0x08)
#pragma DATA_ALIGN (y, 0x08)

which ensures that both x and y arrays addresses have three LSBs equal to
zero (i.e. each complex entry starts at the 8 bytes boundary).

Can you give me an example (that one with almost zero imaginary part)
vectors for which the routine calculates an incorrect result?

Regards,

Andrew
--
Andrew V. Nesterov ()
Optimized TMS320C6000 DSP Software
http://microprocessing.iwarp.com/ > Date: Mon, 9 Aug 2004 18:21:48 +0530
> From: "Raj Sahakari" <>
> Subject: Complex Matrix Multiplication on C6711
>
> Hi c6x-ers,
>
> I am currently facing a problem with complex matrix multiplication on
TI-c6711.
>
> I am using the DSPF_sp_mat_mul_cplx function (reference - spru657).
> However, this function seems to be giving erroneous results in some
> situations. I am unsure if I am using it correctly.
>
> My current usage is as follows -
>
> /* Multiply a 1x4 matrix with a 4x1 matrix to yield a 1x1 matrix */
>
> float Mat_A[1][8], Mat_B[8][1], Mat_C[1][2];
> DSPF_sp_mat_mul_cplx(*Mat_A, 1, 4, *Mat_B, 1, *Mat_C);
>
> Mat_C sometimes gives wrong results.
>
> I am particularly concerned with the "Special Requirements" for the
> DSPF_sp_mat_mul_cplx function, which state
> (1) c1>=4 and r1,r2>=1
> (2) x should be padded with 6 words
> (3) x and y should be double-word aligned
>
> Point (1) is definitely taken care of. However, I am not sure of points
> (2) and (3). I have tried various options like - pre-padding Mat_A with
> 3 zeros, post-padding Mat_A with 3 zeros (I have even tried 6 zeros!!),
> using the .align directive in the linker command file, etc. but to no
> avail.
>
> Could someone kindly help in this regard by providing the correct usage
> of the DSPF_sp_mat_mul_cplx function, please.
>
> Thanks and Regards,
> Raj Sahakari.
>
> P.S. The equivalent C code, however, seems to behave more predictably
> but does go on to give a few errors for the imaginary part, especially
> when the imaginary part reaches the order of about 1e-13 and below. >
>
> *********************************************************
> Disclaimer:
>
> This message (including any attachments) contains
> confidential information intended for a specific
> individual and purpose, and is protected by law.
> If you are not the intended recipient, you should
> delete this message and are hereby notified that
> any disclosure, copying, or distribution of this
> message, or the taking of any action based on it,
> is strictly prohibited.
>
> *********************************************************
> Visit us at http://www.mahindrabt.com > [This message contained attachments] >