From 8a408c44b4ebec266ecaf4d87664b938e47c2e34 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Tue, 28 May 2019 21:26:19 +0100 Subject: [PATCH 1/3] [issue-29] Removed test for a deprecated message. --- src/Math-Tests-Matrix/PMMatrixTest.class.st | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/Math-Tests-Matrix/PMMatrixTest.class.st b/src/Math-Tests-Matrix/PMMatrixTest.class.st index b27b24464..3b277e0f6 100644 --- a/src/Math-Tests-Matrix/PMMatrixTest.class.st +++ b/src/Math-Tests-Matrix/PMMatrixTest.class.st @@ -437,24 +437,6 @@ PMMatrixTest >> testMatrixMultiply [ self assert: ((c rowAt: 2) at: 3) equals: 4 ] -{ #category : #'linear algebra' } -PMMatrixTest >> testMatrixMultiplyElementwise [ - "Code Example 8.1" - - | a b c | - a := PMMatrix rows: #(#(1 0 1) #(-1 -2 3)). - b := PMMatrix rows: #(#(1 2 3) #(-2 1 7)). - c := a dot: b. - self assert: c numberOfRows equals: 2. - self assert: c numberOfColumns equals: 3. - self assert: ((c rowAt: 1) at: 1) equals: 1. - self assert: ((c rowAt: 1) at: 2) equals: 0. - self assert: ((c rowAt: 1) at: 3) equals: 3. - self assert: ((c rowAt: 2) at: 1) equals: 2. - self assert: ((c rowAt: 2) at: 2) equals: -2. - self assert: ((c rowAt: 2) at: 3) equals: 21 -] - { #category : #'linear algebra' } PMMatrixTest >> testMatrixPrincipalDiagonal [ | a | From 13053b609da3de3c539af08f64b5e5b3f3c29b04 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Tue, 28 May 2019 21:31:04 +0100 Subject: [PATCH 2/3] [issue-29] Replaced a call to a deprecated message, corrected a style violation. --- src/Math-Matrix/PMMatrix.class.st | 2 +- src/Math-Tests-Core/PMVectorTest.class.st | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/Math-Matrix/PMMatrix.class.st b/src/Math-Matrix/PMMatrix.class.st index 900d3f209..364ac820e 100644 --- a/src/Math-Matrix/PMMatrix.class.st +++ b/src/Math-Matrix/PMMatrix.class.st @@ -430,7 +430,7 @@ PMMatrix >> elementwiseProductWithMatrix: aMatrix [ "Answers the elementwise product between aMatrix and the receiver as a Matrix." | n | n := 0. - ^ PMMatrix rows: ( aMatrix rowsCollect: [ :each | n := n + 1. each dot: ( self rowAt: n)]) + ^ self class rows: ( aMatrix rowsCollect: [ :each | n := n + 1. each hadamardProduct: ( self rowAt: n)]) ] diff --git a/src/Math-Tests-Core/PMVectorTest.class.st b/src/Math-Tests-Core/PMVectorTest.class.st index 082e82fe0..497f8a795 100644 --- a/src/Math-Tests-Core/PMVectorTest.class.st +++ b/src/Math-Tests-Core/PMVectorTest.class.st @@ -137,20 +137,6 @@ PMVectorTest >> testVectorCumulativeSum [ self assert: (w at: 3) equals: 6 ] -{ #category : #tests } -PMVectorTest >> testVectorDotProduct [ - "Code Example 8.1" - - | u v w | - u := #(1 2 3) asPMVector. - v := #(3 4 5) asPMVector. - w := u dot: v. - self assert: (w size) equals: 3. - self assert: (w at: 1) equals: 3. - self assert: (w at: 2) equals: 8. - self assert: (w at: 3) equals: 15 -] - { #category : #tests } PMVectorTest >> testVectorGreater [ From b731b2abc494092b57f95128906a68a0900e3c41 Mon Sep 17 00:00:00 2001 From: Hemal Varambhia Date: Tue, 28 May 2019 21:36:51 +0100 Subject: [PATCH 3/3] [issue-29] Removed deprecated messages. --- src/Math-Core/PMVector.class.st | 17 +---------------- src/Math-Core/PMWeightedPoint.class.st | 2 +- src/Math-Matrix/PMMatrix.class.st | 6 ------ 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/Math-Core/PMVector.class.st b/src/Math-Core/PMVector.class.st index 9185fd96e..4370b0313 100644 --- a/src/Math-Core/PMVector.class.st +++ b/src/Math-Core/PMVector.class.st @@ -20,7 +20,7 @@ Class { #name : #PMVector, #superclass : #Array, #type : #variable, - #category : 'Math-Core' + #category : #'Math-Core' } { #category : #'instance creation' } @@ -167,21 +167,6 @@ PMVector >> cumsum [ ] -{ #category : #deprecated } -PMVector >> dot: aVector [ -"Answers the elementwise product of the receiver with aVector." - | answer n | - answer := self class new: self size. - n := 0. - self with: aVector do: - [ :a :b | - n := n + 1. - answer at: n put: ( a * b). - ]. - ^answer - -] - { #category : #operation } PMVector >> hadamardProduct: aVector [ "Answers the elementwise product of the receiver with aVector." diff --git a/src/Math-Core/PMWeightedPoint.class.st b/src/Math-Core/PMWeightedPoint.class.st index a7beea989..68a6f6146 100644 --- a/src/Math-Core/PMWeightedPoint.class.st +++ b/src/Math-Core/PMWeightedPoint.class.st @@ -12,7 +12,7 @@ Class { 'weight', 'error' ], - #category : 'Math-Core' + #category : #'Math-Core' } { #category : #creation } diff --git a/src/Math-Matrix/PMMatrix.class.st b/src/Math-Matrix/PMMatrix.class.st index 364ac820e..597b1158c 100644 --- a/src/Math-Matrix/PMMatrix.class.st +++ b/src/Math-Matrix/PMMatrix.class.st @@ -407,12 +407,6 @@ PMMatrix >> dimension [ ^ self rows size @ (self rows at: 1) size ] -{ #category : #deprecated } -PMMatrix >> dot: aMatrix [ - "Answers the elementwise product of the receiver with aMatrix." - ^ aMatrix elementwiseProductWithMatrix: self -] - { #category : #operation } PMMatrix >> eigen [ "Computes all eigenvalues and eigenvectors of a matrix.