5111
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
5389
|
3 |
"
|
|
4 |
COPYRIGHT (c) 2018 by eXept Software AG
|
|
5 |
All Rights Reserved
|
|
6 |
|
|
7 |
This software is furnished under a license and may be used
|
|
8 |
only in accordance with the terms of that license and with the
|
|
9 |
inclusion of the above copyright notice. This software may not
|
|
10 |
be provided or otherwise made available to, or used by, any
|
|
11 |
other person. No title to or ownership of the software is
|
|
12 |
hereby transferred.
|
|
13 |
"
|
5087
|
14 |
"{ Package: 'stx:libbasic2' }"
|
|
15 |
|
|
16 |
"{ NameSpace: Smalltalk }"
|
|
17 |
|
|
18 |
SquareMatrix variableSubclass:#Matrix3_3
|
|
19 |
instanceVariableNames:''
|
|
20 |
classVariableNames:''
|
|
21 |
poolDictionaries:''
|
|
22 |
category:'Collections-MultiDimensional'
|
|
23 |
!
|
|
24 |
|
|
25 |
!Matrix3_3 class methodsFor:'documentation'!
|
|
26 |
|
5389
|
27 |
copyright
|
|
28 |
"
|
|
29 |
COPYRIGHT (c) 2018 by eXept Software AG
|
|
30 |
All Rights Reserved
|
|
31 |
|
|
32 |
This software is furnished under a license and may be used
|
|
33 |
only in accordance with the terms of that license and with the
|
|
34 |
inclusion of the above copyright notice. This software may not
|
|
35 |
be provided or otherwise made available to, or used by, any
|
|
36 |
other person. No title to or ownership of the software is
|
|
37 |
hereby transferred.
|
|
38 |
"
|
|
39 |
!
|
|
40 |
|
5087
|
41 |
documentation
|
|
42 |
"
|
|
43 |
3x3 Matrix (2 dimensions).
|
|
44 |
Especially useful with the ArrayIndexing-Parser extension.
|
|
45 |
|
|
46 |
[author:]
|
|
47 |
Claus Gittinger (cg@sinir)
|
|
48 |
|
|
49 |
[instance variables:]
|
|
50 |
|
|
51 |
[class variables:]
|
|
52 |
|
|
53 |
[see also:]
|
5111
|
54 |
MatrixAccessor
|
5087
|
55 |
"
|
|
56 |
! !
|
|
57 |
|
|
58 |
!Matrix3_3 class methodsFor:'instance creation'!
|
|
59 |
|
|
60 |
new
|
|
61 |
^ self basicNew:3*3
|
|
62 |
! !
|
|
63 |
|
|
64 |
!Matrix3_3 methodsFor:'accessing'!
|
|
65 |
|
|
66 |
_at:index1 at:index2
|
|
67 |
"this is a synthetic selector, generated by the compiler,
|
|
68 |
if a construct of the form expr[idx...] is parsed.
|
|
69 |
I.e.
|
5136
|
70 |
foo[n][m]
|
5087
|
71 |
generates
|
|
72 |
foo _at:n at:m
|
|
73 |
"
|
|
74 |
|idx|
|
|
75 |
|
|
76 |
(index1 between:1 and:3) ifFalse:[self subscriptBoundsError:index1].
|
|
77 |
(index2 between:1 and:3) ifFalse:[self subscriptBoundsError:index2].
|
|
78 |
|
|
79 |
idx := index1 * 3 - 3 + index2.
|
|
80 |
^ self basicAt:idx.
|
|
81 |
!
|
|
82 |
|
|
83 |
_at:index1 at:index2 put:value
|
|
84 |
"this is a synthetic selector, generated by the compiler,
|
|
85 |
if a construct of the form expr[idx...] := val is parsed.
|
|
86 |
I.e.
|
5136
|
87 |
foo[n][m] := val
|
5087
|
88 |
generates
|
|
89 |
foo _at:n at:m put:val
|
|
90 |
"
|
|
91 |
|idx|
|
|
92 |
|
|
93 |
(index1 between:1 and:3) ifFalse:[self subscriptBoundsError:index1].
|
|
94 |
(index2 between:1 and:3) ifFalse:[self subscriptBoundsError:index2].
|
|
95 |
|
|
96 |
idx := index1 * 3 - 3 + index2.
|
|
97 |
^ self basicAt:idx put:value.
|
|
98 |
! !
|
|
99 |
|
|
100 |
!Matrix3_3 methodsFor:'matrix operations'!
|
|
101 |
|
|
102 |
determinantByCofactors
|
|
103 |
"Answer the determinant of this matrix."
|
|
104 |
|
|
105 |
^ ((self _at: 1 at: 1) * (((self _at: 2 at: 2)*(self _at: 3 at: 3)) - ((self _at: 3 at: 2)*(self _at: 2 at: 3)))) -
|
|
106 |
((self _at: 1 at: 2) * (((self _at: 2 at: 1)*(self _at: 3 at: 3)) - ((self _at: 3 at: 1)*(self _at: 2 at: 3)))) +
|
|
107 |
((self _at: 1 at: 3) * (((self _at: 2 at: 1)*(self _at: 3 at: 2)) - ((self _at: 3 at: 1)*(self _at: 2 at: 2)))).
|
|
108 |
! !
|
|
109 |
|
|
110 |
!Matrix3_3 class methodsFor:'documentation'!
|
|
111 |
|
|
112 |
version_CVS
|
|
113 |
^ '$Header$'
|
|
114 |
! !
|
|
115 |
|