source: trunk/MagicSoft/slalib/mxm.c@ 20016

Last change on this file since 20016 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 992 bytes
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaMxm ( float a[3][3], float b[3][3], float c[3][3] )
4/*
5** - - - - - - -
6** s l a M x m
7** - - - - - - -
8**
9** Product of two 3x3 matrices:
10**
11** matrix c = matrix a x matrix b
12**
13** (single precision)
14**
15** Given:
16** a float[3][3] matrix
17** b float[3][3] matrix
18**
19** Returned:
20** c float[3][3] matrix result
21**
22** Note: the same array may be nominated more than once.
23**
24** Last revision: 6 November 1999
25**
26** Copyright P.T.Wallace. All rights reserved.
27*/
28{
29 int i, j, k;
30 float w, wm[3][3];
31
32/* Multiply into scratch matrix */
33 for ( i = 0; i < 3; i++ ) {
34 for ( j = 0; j < 3; j++ ) {
35 w = 0.0f;
36 for ( k = 0; k < 3; k++ ) {
37 w += a[i][k] * b[k][j];
38 }
39 wm[i][j] = w;
40 }
41 }
42
43/* Return the result */
44 for ( j = 0; j < 3; j++ ) {
45 for ( i = 0; i < 3; i++ ) {
46 c[i][j] = wm[i][j];
47 }
48 }
49}
Note: See TracBrowser for help on using the repository browser.