Skip to content

Commit 86d6f02

Browse files
Merge pull request #201 from rakki-18/master
add atRow: method for PMMatrix
2 parents 22c78b9 + 24c0012 commit 86d6f02

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/Math-Matrix/PMMatrix.class.st

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ PMMatrix >> atAllPut: element [
270270
]
271271

272272
{ #category : #'cell accessing' }
273-
PMMatrix >> atColumn: anInteger [
273+
PMMatrix >> atColumn: aColumnNumber [
274274

275-
^ self columnAt: anInteger
275+
^ self columnAt: aColumnNumber
276276
]
277277

278278
{ #category : #'cell accessing' }
@@ -311,6 +311,12 @@ PMMatrix >> atColumn: aColumnNumber put: aCollection startingAt: rowNumber [
311311

312312
]
313313

314+
{ #category : #'cell accessing' }
315+
PMMatrix >> atRow: aRowNumber [
316+
"answers the aRowNumber-th row in the receiver"
317+
^ self rowAt: aRowNumber
318+
]
319+
314320
{ #category : #'cell accessing' }
315321
PMMatrix >> atRow: rowIndex put: aCollection [
316322

src/Math-Tests-Matrix/PMMatrixTest.class.st

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ PMMatrixTest >> testAtColumnPutRepeat [
4848
self assert: a equals: (PMMatrix rows: #(#(1 nil nil) #(1 nil nil) #(nil nil nil))).
4949
]
5050

51+
{ #category : #tests }
52+
PMMatrixTest >> testAtRow [
53+
54+
| a |
55+
a := PMMatrix rows: #(#(1 2 3) #(2 3 4)).
56+
57+
self assert: (a atRow: 2) equals: (#(2 3 4) asPMVector).
58+
self assert: (a atRow: 1) equals: (#(1 2 3) asPMVector).
59+
]
60+
5161
{ #category : #'linear algebra' }
5262
PMMatrixTest >> testAtRowPutAtColumnPut [
5363
| a |

0 commit comments

Comments
 (0)