5122
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
5382
|
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 |
"
|
5085
|
14 |
"{ Package: 'stx:libbasic2' }"
|
|
15 |
|
|
16 |
"{ NameSpace: Smalltalk }"
|
|
17 |
|
|
18 |
Matrix variableSubclass:#TwoDimensionalMatrix
|
|
19 |
instanceVariableNames:''
|
|
20 |
classVariableNames:''
|
|
21 |
poolDictionaries:''
|
|
22 |
category:'Collections-MultiDimensional'
|
|
23 |
!
|
|
24 |
|
5382
|
25 |
!TwoDimensionalMatrix class methodsFor:'documentation'!
|
|
26 |
|
|
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 |
! !
|
5085
|
40 |
|
|
41 |
!TwoDimensionalMatrix methodsFor:'accessing'!
|
|
42 |
|
|
43 |
subMatrix: aPoint
|
5122
|
44 |
|nRows "{Class: SmallInteger }"
|
|
45 |
nCols "{Class: SmallInteger }"
|
|
46 |
retval retRow retCol |
|
5085
|
47 |
|
5122
|
48 |
nRows := self rows.
|
|
49 |
nCols := self columns.
|
|
50 |
retval := Matrix newForRows:(nRows-1) cols:(nCols-1).
|
5085
|
51 |
|
5122
|
52 |
retRow := retCol := 1.
|
|
53 |
|
|
54 |
1 to:nRows do:[:r |
|
5085
|
55 |
r ~= aPoint x ifTrue: [
|
5122
|
56 |
1 to:nCols do:[:c |
|
5085
|
57 |
c ~= aPoint y ifTrue: [
|
|
58 |
retval _at: retRow at: retCol put: (self _at: r at: c).
|
|
59 |
retCol := retCol + 1
|
|
60 |
]
|
|
61 |
].
|
|
62 |
retRow := retRow + 1
|
|
63 |
].
|
|
64 |
retCol := 1
|
|
65 |
].
|
|
66 |
^ retval
|
5122
|
67 |
|
|
68 |
"
|
5188
|
69 |
(Matrix3_3 withAll:#(11 12 13
|
|
70 |
21 22 23
|
|
71 |
31 32 33))
|
|
72 |
subMatrix:(1 @ 1)
|
5122
|
73 |
"
|
5085
|
74 |
! !
|
|
75 |
|
|
76 |
!TwoDimensionalMatrix methodsFor:'matrix operations'!
|
|
77 |
|
|
78 |
minor: aPoint
|
|
79 |
^ (self subMatrix: aPoint) determinantByCofactors
|
|
80 |
! !
|
|
81 |
|
|
82 |
!TwoDimensionalMatrix methodsFor:'queries'!
|
|
83 |
|
|
84 |
cofactor:aPoint
|
|
85 |
(aPoint x + aPoint y) odd
|
|
86 |
ifTrue: [ ^ -1 * (self minor: aPoint) ]
|
|
87 |
ifFalse: [ ^ self minor: aPoint ]
|
|
88 |
! !
|
|
89 |
|
|
90 |
!TwoDimensionalMatrix class methodsFor:'documentation'!
|
|
91 |
|
|
92 |
version_CVS
|
|
93 |
^ '$Header$'
|
|
94 |
! !
|
|
95 |
|