Skip to content

Commit 95aebd1

Browse files
SergeStinckwichhemalvarambhiaJames Fosterserpi90
authored
Release PolyMath v1.0.2 (#165)
* [skip CI] * [skip CI] * [skip CI] typos * [skip CI] * Update SMark to 1.0.3 * Update README.md * [Issue 152] Remove Magic From 'initialize' Methods (#153) * [issue-152] Improved code formatting. * [issue-152] Removed some reflection magic so that the code is easier to understand. * [issue-152] Improved code formatting. * Cleanup to load in PharoGs (#150) * Do not use an inst variable name as an argument * Don't use 'p' and 'q' as method temps They are defined as instance variables in the class. If they are not supposed to modify the instance variable, then they should have different names. * Don't begin a block with a dot GemStone isn't happy with empty statements. * Cleanup of Array constructors While legal syntax, GemStone has trouble parsing these. * Don't use instance var name as method argument * Add spacing to clarify when number ends GemStone doesn't like '11do:' as a number since 'd' is a legal exponent. * Spacing to clarify separation of statements * Fix typo with extra space. * [issue-154] Corrected the behaviour of findKey to return 'AllTheRest' when selector has no corresponding initialize message. (#155) * [issue-154] Corrected the behaviour of findKey, making it more testable in the subclass to mitigate risk. * [issue-154] Promoted the local variables in the test to state variable to remove duplication. * [issue-154] Extracted duplicate code to a custom assertion. * [skip CI] * [skip CI] * Create FUNDING.yml * Update FUNDING.yml * Remove curly braces, replaced with Arrays in most cases, should close #159 (#162) * Update dependencies to load from github, should close #160 (#161) * [Issue 154] Refactor PMAccuracy testDataTree method (#163) * [issue-154] Moved the test method to its own test case class so that we can break up the long test method and understand the message better. * [issue-154] Moved some test code to an intention-revealing test method & identified a possible smell. * [issue-154] Moved a block of code to its own intention-revealing test method. * [issue-154] Moved some test code to its own intention-revealing method. * [issue-154] Added a smell comment to help the next developer. * [issue-154] Added more smells to the smell comment. * [issue-154] Moved the test code to an intention-revealing test method, extracted the expected result to a role-revealing local variable. * [issue-154] Extracted test code to its own intention-revealing test method, with a comment identifying a coincidence between expected outcome and a default I discovered in the initialize method. * [issue-154] Added calls to the super class methods as required. * [issue-154] Put the call to the super class method in the right place. * [issue-154] Improved the name of the local variable. We still don't know the role it plays in the test yet so gave it a structural name. * [issue-154] Improved the name of a local variable. * [issue-154] Moved the test code to its own better named test method. * Update .travis.yml * Update appveyor.yml * Fix some of the red tests for Pharo 8 (#164) * Update appveyor.yml * Move from Pharo 7.0 to Pharo 8.0 * Update README.md Co-authored-by: Hemal Varambhia <[email protected]> Co-authored-by: James Foster <[email protected]> Co-authored-by: Julian Maestri <[email protected]>
1 parent 8bcf998 commit 95aebd1

File tree

51 files changed

+495
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+495
-510
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ os:
66
- osx
77

88
smalltalk:
9-
- Pharo-6.1
109
- Pharo32-7.0
1110
- Pharo64-7.0
11+
- Pharo32-8.0
12+
- Pharo64-8.0
1213

1314
matrix:
1415
fast_finish: true

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
This file is currently not complete but will be improve step by step.
44

55
# Contributing code
6-
Use last version of Pharo 7.0 in order to use Iceberg.
6+
Use last version of Pharo 8.0 in order to use Iceberg.
77
## Fork the Pharo repository
88

99
All changes you'll do will be versionned in your own fork of the [PolyMath repository](https://github.com/PolyMathOrg/PolyMath). Then, from your fork you'll be able to issue pull requests to PolyMath, where they will be reviewed, and luckily, integrated.
1010

1111
Go to PolyMath github's repository and click on the fork button on the top right. Yes, this means that you'll need a github account to contribute to PolyMath, yes.
1212

1313
## Load last dev version of PolyMath
14-
In a fresh Pharo 7.0 image, load last development version of Polymath :
14+
In a fresh Pharo 8.0 image, load last development version of Polymath :
1515

1616
```Smalltalk
1717
Metacello new

FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: SergeStinckwich

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<p align="center">
33
Scientific Computing with Pharo
44
<br>
5-
<a href="docs/"><strong>Explore the docs »</strong></a>
5+
<a href="https://github.com/PolyMathOrg/PolyMath/wiki"><strong>Explore the docs »</strong></a>
66
<br>
77
<br>
88
<a href="https://github.com/PolyMathOrg/PolyMath/issues/new?labels=Type%3A+Defect">Report a defect</a>
@@ -19,11 +19,12 @@
1919

2020
<img width="1675" alt="Screenshot 2019-04-24 at 11 12 57" src="https://user-images.githubusercontent.com/327334/56652094-66eb7780-6682-11e9-9753-101be18df67c.png">
2121

22-
You can load PolyMath 1.0 into a fresh Pharo 7.0 image with:
22+
23+
You can load PolyMath 1.0.1 into a fresh Pharo 7.0 image with:
2324

2425
```Smalltalk
2526
Metacello new
26-
repository: 'github://PolyMathOrg/PolyMath:v1.0/src';
27+
repository: 'github://PolyMathOrg/PolyMath:v1.0.1/src';
2728
baseline: 'PolyMath';
2829
load
2930
```
@@ -37,7 +38,8 @@ Metacello new
3738
load
3839
```
3940

40-
We have **806** green tests ! At the moment, all the development happens in the master branch (we are using trunk-based development).
41+
42+
We have **815** green tests ! At the moment, all the development happens in the master branch (we are using trunk-based development).
4143

4244
PolyMath is a Pharo project, similar to existing scientific libraries like NumPy, SciPy for Python or SciRuby for Ruby. PolyMath already provides the following basic functionalities:
4345
- complex and quaternions extensions,

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ environment:
66
CYG_MIRROR: http://cygwin.mirror.constant.com
77
SCI_RUN: /cygdrive/c/smalltalkCI-master/run.sh
88
matrix:
9-
- SMALLTALK: Pharo-7.0
9+
- SMALLTALK: Pharo-8.0
1010

1111
platform:
1212
- x86

src/BaselineOfPolyMath/BaselineOfPolyMath.class.st

+4-10
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,13 @@ BaselineOfPolyMath >> projectClass [
177177
{ #category : #dependencies }
178178
BaselineOfPolyMath >> sMark: spec [
179179
spec
180-
project: 'SMark'
181-
with: [ spec
182-
className: #ConfigurationOfSMark;
183-
versionString: '1.0.3';
184-
repository: 'http://smalltalkhub.com/mc/StefanMarr/SMark/main' ]
180+
baseline: 'SMark'
181+
with: [ spec repository: 'github://smarr/SMark:v1.0.4/repository' ]
185182
]
186183

187184
{ #category : #dependencies }
188185
BaselineOfPolyMath >> xmlWriter: spec [
189186
spec
190-
project: 'XMLWriter'
191-
with: [ spec
192-
className: #ConfigurationOfXMLWriter;
193-
versionString: '2.3.10';
194-
repository: 'http://smalltalkhub.com/mc/PharoExtras/XMLWriter/main' ]
187+
baseline: 'XMLWriter'
188+
with: [ spec repository: 'github://pharo-contributions/XML-XMLWriter:2.9.0/src' ]
195189
]

src/ExtendedNumberParser/ExtendedNumberParser.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ ExtendedNumberParser >> readNumberWithFractionPartNumberOfTrailingZeroInIntegerP
166166
fractionPart := 0.
167167
numberOfNonZeroFractionDigits := 0.
168168
numberOfTrailingZeroInFractionPart := 0]
169-
ifNotNil: [.
169+
ifNotNil: [
170170
numberOfNonZeroFractionDigits := lastNonZero.
171171
numberOfTrailingZeroInFractionPart := nDigits - lastNonZero].
172172
self readExponent

src/Math-Accuracy-Core/PMAccuracy.class.st

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Class {
1919
#classVars : [
2020
'DecimalPlaces'
2121
],
22-
#category : 'Math-Accuracy-Core'
22+
#category : #'Math-Accuracy-Core'
2323
}
2424

2525
{ #category : #accessing }
@@ -134,7 +134,7 @@ PMAccuracy >> argumentAt: aName [
134134
PMAccuracy >> asArray: aCol [
135135
^(aCol isCollection and: [ aCol isSequenceable and: [aCol isString not] ])
136136
ifTrue: [ aCol asArray ]
137-
ifFalse: [ {aCol} ]
137+
ifFalse: [ Array with: aCol ]
138138
]
139139

140140
{ #category : #private }
@@ -302,7 +302,7 @@ no isCollection ifFalse: [^1].
302302
PMAccuracy >> numberOfDifferentResultsAt: aname [
303303
|no|
304304
no := self resultsAt: aname.
305-
no isCollection ifFalse:[no:={no}].
305+
no isCollection ifFalse:[no:= Array with: no].
306306
^ no first isCollection ifTrue: [ no size ] ifFalse: [ 1 ]
307307
]
308308

@@ -426,7 +426,7 @@ PMAccuracy >> run: anArrayOfNames [
426426
<< 'Report for: ';
427427
<< self class name;
428428
cr.
429-
self ifSeveralterations: [ aStream << 'iterations: ' << iterations; cr ].
429+
self ifSeveralterations: [ aStream << 'iterations: ' << iterations asString; cr ].
430430
(self tree: dataTree removeAll type: self class name data: 'names')
431431
at: 'iterations' put: iterations;
432432
at: 'names' put: (self tree: KeyedTree new type: 'names' data: a).

src/Math-Benchmarks-ODE/PMODEBenchmark.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PMODEBenchmark class >> runAllToXML: numOfIterations [
3838
xml.
3939
writer tag: 'smark' with: [
4040
(self runAll: numOfIterations) do: [ :runner |
41-
writer tag: 'suite' attributes: { #name -> runner suite class name asString } asDictionary with: [
41+
writer tag: 'suite' attributes: (Dictionary with: #name -> runner suite class name asString) with: [
4242
runner results keysAndValuesDo: [ :key :value |
4343
writer tag: key with: ((value inject: 0 into: [ :subTotal :result |
4444
subTotal + result total ]) / value size) asFloat asString] ] ] ].

src/Math-Core-Process/PMFixpoint.class.st

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ verbose ifFalse: [ ^self ].
6464
GrowlMorph
6565
openWithLabel: 'Info'
6666
contents: ('{1} iterations used.
67-
warning: {2}-cycle detected' format: {iterations. cycleLength})
67+
warning: {2}-cycle detected' format: (Array with: iterations with: cycleLength))
6868
color: Color gray muchDarker
6969
]
7070

@@ -151,7 +151,7 @@ PMFixpoint >> simpleInfo [
151151
verbose ifFalse: [ ^self ].
152152
GrowlMorph
153153
openWithLabel: 'Info'
154-
contents: ('{1} iterations needed.' format: {iterations})
154+
contents: ('{1} iterations needed.' format: (Array with: iterations))
155155
color: Color green muchDarker
156156
]
157157

@@ -161,7 +161,7 @@ verbose ifFalse: [ ^self ].
161161
GrowlMorph
162162
openWithLabel: 'Warning'
163163
contents: ('maximumIterations ({1}) reached.
164-
you can run evaluate a second time' format: {maximumIterations})
164+
you can run evaluate a second time' format: (Array with: maximumIterations))
165165
color: Color orange darker
166166
]
167167

src/Math-Core/PMVector.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ PMVector >> householder [
203203
put: ((x <=0) ifTrue: [x -u] ifFalse: [0 - s / (x + u)]).
204204
b :=(v at: 1) squared * 2 / (s + (v at: 1) squared).
205205
v := v / (v at: 1) ].
206-
^{b. v}
206+
^Array with: b with: v
207207
]
208208

209209
{ #category : #operation }

src/Math-FastFourierTransform/PMFastFourierTransform.class.st

+1-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ PMFastFourierTransform >> initPermTable [
7878
r := (i - 1 bitReverse: nu) + 1.
7979
r > i
8080
ifTrue: [ permTable
81-
add:
82-
{i.
83-
r} ] ]
81+
add: (Array with: i with: r) ] ]
8482
]
8583

8684
{ #category : #initializing }

src/Math-FunctionFit/PMAnotherGeneticOptimizer.class.st

+5-5
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ PMAnotherGeneticOptimizer >> printOn: aStream [
205205
{ #category : #operation }
206206
PMAnotherGeneticOptimizer >> processRandomParents: aNumberArray [
207207
"puts the better chromosome at the first place (is eg necessary for lineCrossOver:and:)"
208-
|pos1 pos2 c|
209-
pos1:=self randomIndex: aNumberArray.
210-
pos2:=self randomIndex: aNumberArray.
211-
pos1>pos2 ifTrue:[c:=pos1.pos1:=pos2. pos2:=c].
208+
| pos1 pos2 c |
209+
pos1 := self randomIndex: aNumberArray.
210+
pos2 := self randomIndex: aNumberArray.
211+
pos1 > pos2 ifTrue: [c := pos1. pos1 := pos2. pos2 := c].
212212
chromosomeManager process: ( bestPoints at: pos1) position
213213
and: ( bestPoints at: pos2) position.
214214
]
@@ -219,7 +219,7 @@ PMAnotherGeneticOptimizer >> rangeScale [
219219
| size best|
220220
size:=bestPoints size -1.
221221
best := 0.0 .
222-
^(size to:1 by:( -1))collect: [:i|best:=2*i/(size*(size+1))+best].
222+
^(size to: 1 by: (-1)) collect: [:i | best := 2 * i / (size * (size + 1)) + best].
223223

224224
]
225225

src/Math-FunctionFit/PMGeneralFunctionFit.class.st

+5-3
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ n:=0.
132132
[ self quartile: max.
133133
self evaluate.
134134
errorCol:= self errorCollection sort.
135-
d2:=(errorFunction parameterSize to: (errorCol size -4) ) collect: [:i| {i+2.
136-
(2*(errorCol at: i)) - (errorCol at: i+1) - (2*(errorCol at: i+2))- (errorCol at: i+3)+(2*(errorCol at: i+4))} ].
135+
d2:=(errorFunction parameterSize to: (errorCol size -4) ) collect: [:i|
136+
Array
137+
with: (i+2)
138+
with: ((2*(errorCol at: i)) - (errorCol at: i+1) - (2*(errorCol at: i+2))- (errorCol at: i+3)+(2*(errorCol at: i+4))) ].
137139
[max :=#(5 0).
138140
d2 do: [:d|((d at: 2) >= (max at:2)) ifTrue: [max :=d]].
139141
(max first = (d2 last first))ifTrue: [
@@ -296,7 +298,7 @@ PMGeneralFunctionFit >> truncateData [
296298
|ec ei |
297299
dataTruncated ifTrue: [^Error signal:'data is already truncated'].
298300
ec:=self errorCollection .
299-
ei:=(ec withIndexCollect: [:e :i|{e.i}]).
301+
ei:=(ec withIndexCollect: [:e :i| Array with: e with: i]).
300302
ei:=(ei sort:[:a :b|a first<b first]) collect: [:e|e second ].
301303
ei :=ei copyFrom: 1 to: (self quartile * ec size) truncated.
302304
self resetResult.

src/Math-KDTree/PMIndexedKDTree.class.st

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ Class {
1313
{ #category : #'instance creation' }
1414
PMIndexedKDTree class >> withAll: aCollectionOfCollections [
1515
"make a KDTree from a SequenceableCollection of SequenceableCollections ,which is an ordered Collection of points in a n-dimensional space. the nearest neighbour search then returns the indices of the neighbours"
16-
|c|
17-
c :=aCollectionOfCollections withIndexCollect: [:v :i| {i.v.}] .
18-
^super withAll: c.
16+
^super withAll: (aCollectionOfCollections withIndexCollect: [:v :i| Array with: i with: v ]).
1917
]
2018

2119
{ #category : #private }
2220
PMIndexedKDTree >> add: aDistance to: aNNStore [
23-
aNNStore add: {aDistance . {index . value}} .
21+
aNNStore add: (Array with: aDistance with: (Array with: index with: value)) .
2422
]
2523

2624
{ #category : #private }
@@ -36,7 +34,7 @@ PMIndexedKDTree >> nnSearch: aSequenceableCollection i: anInt [
3634
|n|
3735
n :=PMNNStore new: anInt .
3836
self nnSearch: aSequenceableCollection asFloatArray near: n .
39-
^anInt =1 ifTrue: [n data first first ] ifFalse: [n completeData collect: [:i | {(i at:2)first . i first}] ]
37+
^anInt =1 ifTrue: [n data first first ] ifFalse: [n completeData collect: [:i | Array with: (i at:2) first with: i first] ]
4038
]
4139

4240
{ #category : #private }

src/Math-KDTree/PMKDTree.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ aCollectionOfCollections first ifEmpty: [self error: 'KDTree withAll: error' ].
2424

2525
{ #category : #private }
2626
PMKDTree >> add: aDistance to: aNNStore [
27-
aNNStore add: {aDistance . value} .
27+
aNNStore add: (Array with: aDistance with: value) .
2828
]
2929

3030
{ #category : #initialize }

src/Math-KDTree/PMNNStore.class.st

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Class {
1616

1717
{ #category : #'instance creation' }
1818
PMNNStore class >> new: anInt [
19-
^((super new: anInt) atAllPut: {Float infinity. nil} )initialize
19+
^((super new: anInt) atAllPut: (Array with: Float infinity with: nil))initialize
2020
]
2121

2222
{ #category : #'instance creation' }
@@ -30,7 +30,7 @@ PMNNStore class >> newFrom: aCollectionWithSortingIndex [
3030
PMNNStore class >> withAll: aCollection [
3131
"this is the peferable form of instance creation for subclasses since freeIndex is correctly initialized this way. then 'sortFor:' must be overwritten and called at least once (!); an example is StupidNN. the other possibility is to use 'new:' and to fill NNStore subclass with 'add:' . the advantage is, that NNStore has not to be filled completely this way and the sorting logic can be applied outside of the subclass without sortFor: (see also comment on add:).
3232
you cant enter the sorting index with the method withAll: . if you want to do that, use 'newFrom:' instead"
33-
^(super withAll: (aCollection collect: [:coll| {nil. coll}]))lastUsedIndex: aCollection size
33+
^(super withAll: (aCollection collect: [:coll| Array with: nil with: coll]))lastUsedIndex: aCollection size
3434
]
3535

3636
{ #category : #comparing }

src/Math-KolmogorovSmirnov/PMKolmogorovSmirnov2Sample.class.st

+9-20
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,11 @@ PMKolmogorovSmirnov2Sample >> initCachedUCalculation [
6363
cij := self cFrom: i and: j.
6464
i * j = 0
6565
ifTrue: [ cij ]
66-
ifFalse: [ cij
67-
*
68-
((uCalcBlock
69-
value:
70-
{i.
71-
(j - 1)})
72-
+
73-
(uCalcBlock
74-
value:
75-
{(i - 1).
76-
j})) ] ] memoized
66+
ifFalse: [ cij * (
67+
(uCalcBlock value: (Array with: i with: j - 1))
68+
+
69+
(uCalcBlock value: (Array with: i - 1 with: j))
70+
) ] ] memoized
7771
]
7872

7973
{ #category : #initialization }
@@ -123,18 +117,15 @@ PMKolmogorovSmirnov2Sample >> ksStatistic [
123117
{ #category : #private }
124118
PMKolmogorovSmirnov2Sample >> makeCDFOf: aCollection intoFirst: aBoolean [
125119
"if aCollection consists of numbers,
126-
it returns a sorted array of (number->{cdf.aBoolean})"
120+
it returns a sorted array of (number-> (Array with: cdf with: aBoolean))"
127121

128122
| cd s result |
129123
cd := 0.
130124
s := aCollection size.
131125
result := aCollection asBag sortedElements
132126
do: [ :a |
133127
cd := a value / s + cd.
134-
a
135-
value:
136-
{cd.
137-
aBoolean} ].
128+
a value: (Array with: cd with: aBoolean) ].
138129
^ aBoolean
139130
ifTrue: [ data := result ]
140131
ifFalse: [ compareWith := result ]
@@ -154,10 +145,8 @@ Kim, P. J. & Jennrich, R. I.
154145
in 'Selected Tables in Mathematical Statistics Volume I' (1973)."
155146

156147
ksStatistic ifNil: [ self ksStatistic ].
157-
^ (uCalcBlock
158-
value:
159-
{smallSize.
160-
bigSize}) / (smallSize + bigSize take: smallSize)
148+
^ (uCalcBlock value: (Array with: smallSize with: bigSize))
149+
/ (smallSize + bigSize take: smallSize)
161150
]
162151

163152
{ #category : #printing }

src/Math-Matrix/PMMatrix.class.st

+2-4
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ PMMatrix >> qrFactorization [
670670
i>0 ifTrue: [ r :=PMMatrix rows: (r rows copyFrom: 1 to: colSize).
671671
i := q numberOfColumns - i.
672672
q := PMMatrix rows: ( q rows collect: [:row| row copyFrom: 1 to: i]) ].
673-
^{q. r}
673+
^Array with: q with: r
674674
]
675675

676676
{ #category : #'as yet unclassified' }
@@ -729,9 +729,7 @@ PMMatrix >> qrFactorizationWithPivoting [
729729
i := q numberOfColumns - i.
730730
pivot := pivot copyFrom: 1 to: i.
731731
q := PMMatrix rows: (q rows collect: [ :row | row copyFrom: 1 to: i ]) ].
732-
^ {q.
733-
r.
734-
pivot}
732+
^ Array with: q with: r with: pivot
735733
]
736734

737735
{ #category : #'as yet unclassified' }

src/Math-ODE/PMAB2Solver.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ PMAB2Solver >> mainStepsPrevState: prevState startTime: initialTime endTime: end
6464
self announceState: state time: time + self dt.
6565
lastTime := time + self dt].
6666

67-
^ {previousState . state}
67+
^ Array with: previousState with: state
6868
]
6969

7070
{ #category : #'as yet unclassified' }

src/Math-ODE/PMAB3Solver.class.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ PMAB3Solver >> mainStepsPrevState: prevState prevPrevState: prevPrevState startT
5656
self announceState: state time: time + self dt.
5757
lastTime := time + (3*self dt)].
5858

59-
^ { previousPrevState. previousState}
59+
^ Array with: previousPrevState with: previousState
6060

6161
]
6262

0 commit comments

Comments
 (0)