Share via


_Multiply4dM

9/7/2007

Multiplies a 4x4 matrix by a 4x4 matrix.

Syntax

float* _Multiply4dM( 
  float* result, 
  float* matrix1, 
  float* matrix2 
);

Parameters

  • result
    [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. This matrix receives the result of the operation.
  • matrix1
    [in] Pointer to an array of float values arranged such that the indices of the array are the [row][column] values of the 4x4 matrix.
  • matrix2
    [in] 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 result matrix.

Remarks

The following code example shows how to use _Multiply4DM.

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};
   Multiply4dM(result, m1, m2);
   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");
   }
}

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  |

Requirements

Routine Required header Architecture

_Multiply4dM

<shintr.h>

SH-4

See Also

Reference

Intrinsic Functions for Renesas Microprocessors
_XDMultMatrix