1 /* mxm.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* Table of constant values */
9
10 static integer c__9 = 9;
11
12 /* $Procedure MXM ( Matrix times matrix, 3x3 ) */
mxm_(doublereal * m1,doublereal * m2,doublereal * mout)13 /* Subroutine */ int mxm_(doublereal *m1, doublereal *m2, doublereal *mout)
14 {
15 /* System generated locals */
16 integer i__1, i__2, i__3, i__4, i__5, i__6, i__7;
17
18 /* Builtin functions */
19 integer s_rnge(char *, integer, char *, integer);
20
21 /* Local variables */
22 integer i__, j;
23 extern /* Subroutine */ int moved_(doublereal *, integer *, doublereal *);
24 doublereal prodm[9] /* was [3][3] */;
25
26 /* $ Abstract */
27
28 /* Multiply two 3x3 matrices. */
29
30 /* $ Disclaimer */
31
32 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
33 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
34 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
35 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
36 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
37 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
38 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
39 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
40 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
41 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
42
43 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
44 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
45 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
46 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
47 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
48 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
49
50 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
51 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
52 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
53 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
54
55 /* $ Required_Reading */
56
57 /* None. */
58
59 /* $ Keywords */
60
61 /* MATRIX */
62
63 /* $ Declarations */
64 /* $ Brief_I/O */
65
66 /* VARIABLE I/O DESCRIPTION */
67 /* -------- --- -------------------------------------------------- */
68 /* M1 I 3x3 double precision matrix. */
69 /* M2 I 3x3 double prercision matrix. */
70 /* MOUT O 3x3 double precision matrix. MOUT is the product */
71 /* M1*M2. */
72
73 /* $ Detailed_Input */
74
75 /* M1 is an arbitrary 3x3 double precision matrix. */
76
77 /* M2 is an arbitrary 3x3 double precision matrix. */
78
79 /* $ Detailed_Output */
80
81 /* MOUT is a 3x3 double precision matrix. MOUT is the product */
82 /* M1*M2. */
83
84 /* $ Parameters */
85
86 /* None. */
87
88 /* $ Exceptions */
89
90 /* Error free. */
91
92 /* $ Files */
93
94 /* None. */
95
96 /* $ Particulars */
97
98 /* The code reflects precisely the following mathematical expression */
99
100 /* For each value of the subscripts I and J from 1 to 3: */
101
102 /* MOUT(I,J) = Summation from K=1 to 3 of ( M1(I,K) * M2(K,J) ) */
103
104 /* $ Examples */
105
106 /* Let M1 = | 1.0D0 1.0D0 0.0D0 | */
107 /* | | */
108 /* | -1.0D0 1.0D0 0.0D0 | */
109 /* | | */
110 /* | 0.0D0 0.0D0 1.0D0 | */
111
112
113 /* and M2 = | 1.0D0 0.0D0 0.0D0 | */
114 /* | | */
115 /* | 0.0D0 1.0D0 1.0D0 | */
116 /* | | */
117 /* | 0.0D0 -1.0D0 1.0D0 | */
118
119 /* then the call */
120
121 /* CALL MXM ( M1, M2, MOUT ) */
122
123 /* produces the matrix */
124
125 /* MOUT = | 1.0D0 1.0D0 1.0D0 | */
126 /* | | */
127 /* | -1.0D0 1.0D0 1.0D0 | */
128 /* | | */
129 /* | 0.0D0 -1.0D0 1.0D0 | */
130
131 /* $ Restrictions */
132
133 /* None. */
134
135 /* $ Literature_References */
136
137 /* None. */
138
139 /* $ Author_and_Institution */
140
141 /* W.M. Owen (JPL) */
142
143 /* $ Version */
144
145 /* - SPICELIB Version 1.0.2, 22-APR-2010 (NJB) */
146
147 /* Header correction: assertions that the output */
148 /* can overwrite the input have been removed. */
149
150 /* - SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
151
152 /* Comment section for permuted index source lines was added */
153 /* following the header. */
154
155 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (WMO) */
156
157 /* -& */
158 /* $ Index_Entries */
159
160 /* matrix times matrix 3x3_case */
161
162 /* -& */
163
164 /* Local variables */
165
166
167 /* Perform the matrix multiplication */
168
169 for (i__ = 1; i__ <= 3; ++i__) {
170 for (j = 1; j <= 3; ++j) {
171 prodm[(i__1 = i__ + j * 3 - 4) < 9 && 0 <= i__1 ? i__1 : s_rnge(
172 "prodm", i__1, "mxm_", (ftnlen)162)] = m1[(i__2 = i__ - 1)
173 < 9 && 0 <= i__2 ? i__2 : s_rnge("m1", i__2, "mxm_", (
174 ftnlen)162)] * m2[(i__3 = j * 3 - 3) < 9 && 0 <= i__3 ?
175 i__3 : s_rnge("m2", i__3, "mxm_", (ftnlen)162)] + m1[(
176 i__4 = i__ + 2) < 9 && 0 <= i__4 ? i__4 : s_rnge("m1",
177 i__4, "mxm_", (ftnlen)162)] * m2[(i__5 = j * 3 - 2) < 9 &&
178 0 <= i__5 ? i__5 : s_rnge("m2", i__5, "mxm_", (ftnlen)
179 162)] + m1[(i__6 = i__ + 5) < 9 && 0 <= i__6 ? i__6 :
180 s_rnge("m1", i__6, "mxm_", (ftnlen)162)] * m2[(i__7 = j *
181 3 - 1) < 9 && 0 <= i__7 ? i__7 : s_rnge("m2", i__7, "mxm_"
182 , (ftnlen)162)];
183 }
184 }
185
186 /* Move the result into MOUT */
187
188 moved_(prodm, &c__9, mout);
189 return 0;
190 } /* mxm_ */
191
192