_SaveMatrix (Windows CE 5.0)

Send Feedback

Stores the extended floating-point register bank into a 4x4 matrix.

float* _SaveMatrix(   float* matrix);

Parameters

  • matrix
    [out] Pointer to an array of float values arranged such that the indices of the array are the [row][column] values of the 4x4 matrix.

Return Values

Pointer to the 4x4 matrix that has been stored.

Remarks

The following code example shows how to use _SaveMatrix.

void main() 
{
   int i,j;
   float result[4][4];
   float m1[4][4] =    {1.0,1.0,1.0,1.0,  
                  2.0,2.0,2.0,2.0,
                  3.0,3.0,3.0,3.0, 
                  4.0,4.0,4.0,4.0};

   float m2[4][4] =    {2.0,2.0,2.0,2.0, 
                  2.0,2.0,2.0,2.0,
                  2.0,2.0,2.0,2.0,
                  2.0,2.0,2.0,2.0};
       
   _LoadMatrix(m1);      //Load m1 matrix into XD bank regs
   _XDMultMatrix(m2);   //[m1]x[m2] —> result saved into XD bank regs
   _SaveMatrix(result);      //Load XD bank regs into result buffer
      
   //
   // Print out the result
   //
   printf("Result of [m1]x[m2] = \n");
   for (i = 0; i < 4; i++) 
   {
         printf("| ");
         for (j = 0; j < 4; j++)
            printf("%8.4f ",result[i][j]);
         printf(" |\n");
   }

   _XDMultMatrix(m2);   //[m1]x[m2]x[m2]->saved results into XD bank
   _SaveMatrix(result);   //Load XD bank regs into result buffer
      
   //
   // Print out the result
   //
   printf("\nResult of [m1]x[m2]x[m2] = \n");
   for (i = 0; i < 4; i++) 
      {
         printf("| ");
         for (j = 0; j < 4; j++)
            printf("%8.4f ",result[i][j]);
         printf(" |\n");
   }
}
Output
Result of [m1]x[m2] =
|   8.0000   8.0000   8.0000   8.0000  |
|  16.0000  16.0000  16.0000  16.0000  |
|  24.0000  24.0000  24.0000  24.0000  |
|  32.0000  32.0000  32.0000  32.0000  |

Result of [m1]x[m2]x[m2] =
|  64.0000  64.0000  64.0000  64.0000  |
| 128.0000 128.0000 128.0000 128.0000  |
| 192.0000 192.0000 192.0000 192.0000  |
| 256.0000 256.0000 256.0000 256.0000  |

Requirements

Header: shintr.h.

See Also

Intrinsic Functions for Renesas Microprocessors | _LoadMatrix

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.