VEC_$MAT_MULT Domain/OS VEC_$MAT_MULT
NAME
vec_$mat_mult - multiply two 4x4 single-precision matrixes
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$mat_mult(
float *matrix1,
float *matrix2,
float *out_matrix)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$mat_mult(
in matrix1: univ vec_$real_matrix;
in matrix2: univ vec_$real_matrix;
out out_matrix: univ vec_$real_matrix);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
real matrix1(4, 4), matrix2(4, 4), out_matrix(4, 4)
call vec_$mat_mult(matrix1, matrix2, out_matrix)
DESCRIPTION
Vec_$mat_mult multiplies two 4x4 matrixes, matrix1 and matrix2, and sup-
plies the result in out_matrix.
In C, vec_$mat_mult calculates the product of matrix2 on the left and
matrix1 on the right, and the resulting operation is
for (i = 0; i < 4; ++i)
for (j = 0; j < 4; ++j) {
out_mat[j,i] = 0.0;
for (k = 0; k < 4; ++k)
out_mat[j][i] += matrix1[k][i]
* matrix2[j][k];
}
In Pascal, vec_$mat_mult calculates the product of matrix2 on the left
and matrix1 on the right, and the resulting operation is
for i := 1 to 4 do
for j := 1 to 4 do
begin
out_mat[j,i] := 0.0;
for k := 1 to 4 do
out_mat[j,i] := out_mat[j,i]
+ matrix1[k,i]
* matrix2[j,k];
end;
In FORTRAN, vec_$mat_mult calculates the product of matrix1 on the left
and matrix2 on the right, and the resulting operation is
do 10 i = 1, 4
do 10 j = 1, 4
out_mat(i,j) = 0.0
do 10 k = 1, 4
out_mat(i,j) = out_mat(i,j)
& + matrix1(i,k)
& * matrix2(k,j)
10 continue
matrix1
A 4x4 matrix.
matrix2
Another 4x4 matrix.
out_matrix
The product of matrix1 and matrix2.
NOTES
Vec_$mat_multn performs the same operations for variably dimensioned
matrixes.
SEE ALSO
vec_$dmat_mult, vec_$imat_mult, vec_$imat_mult16.