|
|
Output from imldet1.sas |
Source
0 Graphs |
|---|
NOTE: Capture of log output started.
NOTE: %INCLUDE (level 1) file n:\psy6140\examples\iml\imldet1.sas is file
n:\psy6140\examples\iml\imldet1.sas.
265 +title 'Properties of determinants'; 266 +proc iml;
IML Ready
266 + reset print log;
267 + /*----------------------------------------*
268 + | IMLDET1: Properties of determinants |
269 + *----------------------------------------*/
270 + A = {3 1, 2 4};
A 2 rows 2 cols (numeric)
3 1
2 4
271 + r = det(A);
R 1 row 1 col (numeric)
10
272 +
273 + *-- 1. Interchange rows or cols -> -1 # det(A);
274 + r = det(A[{2 1},]);
R 1 row 1 col (numeric)
-10
275 + r = det(A[,{2 1}]);
R 1 row 1 col (numeric)
-10
276 + 277 + *-- 2. transpose -> det a unchanged; 278 + r = det( A`);
R 1 row 1 col (numeric)
10
279 +
280 + *-- 3. multiply row # k -> k # det a;
281 + r = diag({3 1}) * A;
R 2 rows 2 cols (numeric)
9 3
2 4
282 + r = det( diag({3 1}) * A);
R 1 row 1 col (numeric)
30
283 + 284 + *-- 4. multiply matrix # k -> k**2 # det(a); 285 + r = det(3 # A);
R 1 row 1 col (numeric)
90
286 +
287 + *-- 5. det (a * b) -> det(a) # det(b);
288 + B={ 4 2, 3 5};
B 2 rows 2 cols (numeric)
4 2
3 5
289 + r = det(B);
R 1 row 1 col (numeric)
14
290 + r = det(A * B);
R 1 row 1 col (numeric)
140
291 + r = det(A) # det(B);
R 1 row 1 col (numeric)
140
292 +
293 + *-- 6. proportional rows -> det = 0;
294 + C={1 5, 2 6, 4 4};
C 3 rows 2 cols (numeric)
1 5
2 6
4 4
295 + C=C || C[,1];
C 3 rows 3 cols (numeric)
1 5 1
2 6 2
4 4 4
296 + r = det(C);
R 1 row 1 col (numeric)
0
297 + 298 + *-- 7. Add multiple of one row to another -> det unchanged; 299 + A[2,] = A[2,] - 2#A[1,];
A 2 rows 2 cols (numeric)
3 1
-4 2
300 + r = det(A);
R 1 row 1 col (numeric)
10
301 +quit;
Exiting IML.
NOTE: The PROCEDURE IML used 0.17 seconds.
302 +
NOTE: %INCLUDE (level 1) ending.