--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Matrix3_3.st Tue Aug 20 15:10:57 2019 +0200
@@ -0,0 +1,88 @@
+"{ Package: 'stx:libbasic2' }"
+
+"{ NameSpace: Smalltalk }"
+
+SquareMatrix variableSubclass:#Matrix3_3
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Collections-MultiDimensional'
+!
+
+!Matrix3_3 class methodsFor:'documentation'!
+
+documentation
+"
+ 3x3 Matrix (2 dimensions).
+ Especially useful with the ArrayIndexing-Parser extension.
+
+ [author:]
+ Claus Gittinger (cg@sinir)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+ MultiDimensionalArrayAccessor
+"
+! !
+
+!Matrix3_3 class methodsFor:'instance creation'!
+
+new
+ ^ self basicNew:3*3
+! !
+
+!Matrix3_3 methodsFor:'accessing'!
+
+_at:index1 at:index2
+ "this is a synthetic selector, generated by the compiler,
+ if a construct of the form expr[idx...] is parsed.
+ I.e.
+ foo[n,m]
+ generates
+ foo _at:n at:m
+ "
+ |idx|
+
+ (index1 between:1 and:3) ifFalse:[self subscriptBoundsError:index1].
+ (index2 between:1 and:3) ifFalse:[self subscriptBoundsError:index2].
+
+ idx := index1 * 3 - 3 + index2.
+ ^ self basicAt:idx.
+!
+
+_at:index1 at:index2 put:value
+ "this is a synthetic selector, generated by the compiler,
+ if a construct of the form expr[idx...] := val is parsed.
+ I.e.
+ foo[n,m] := val
+ generates
+ foo _at:n at:m put:val
+ "
+ |idx|
+
+ (index1 between:1 and:3) ifFalse:[self subscriptBoundsError:index1].
+ (index2 between:1 and:3) ifFalse:[self subscriptBoundsError:index2].
+
+ idx := index1 * 3 - 3 + index2.
+ ^ self basicAt:idx put:value.
+! !
+
+!Matrix3_3 methodsFor:'matrix operations'!
+
+determinantByCofactors
+ "Answer the determinant of this matrix."
+
+ ^ ((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)))) -
+ ((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)))) +
+ ((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)))).
+! !
+
+!Matrix3_3 class methodsFor:'documentation'!
+
+version_CVS
+ ^ '$Header$'
+! !
+