Skip to content

Commit 3118bfa

Browse files
committed
Moved productWithVector: and productWithMatrix:
1 parent ef3d850 commit 3118bfa

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Math-Core/Number.extension.st

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ Number >> addWithVector: aVector [
1111
"Adds itself to each element of the vector"
1212
^ aVector collect: [ :each | each + self ]
1313
]
14+
15+
{ #category : #'*Math-Core' }
16+
Number >> productWithVector: aVector [
17+
"Answers a new vector product of the receiver with aVector."
18+
^aVector collect: [ :each | each * self]
19+
]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Extension { #name : #Number }
2+
3+
{ #category : #'*Math-Matrix' }
4+
Number >> productWithMatrix: aMatrix [
5+
^aMatrix class rows: (aMatrix rowsCollect: [:r| self productWithVector: r])
6+
]

0 commit comments

Comments
 (0)