Skip to content

Commit 8062a30

Browse files
committed
Modification of the tests taking into account the modified methods
1 parent 2ae081b commit 8062a30

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

src/Math-Matrix/PMTensor.class.st

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,6 @@ PMTensor >> flattenedIndexOf: coords [
6868
^ position
6969
]
7070

71-
{ #category : #'as yet unclassified' }
72-
PMTensor >> flattenedIndexOf: aFlatArray withShape: aShape [
73-
74-
array := aFlatArray.
75-
shape := aShape copy.
76-
self updateFirst.
77-
shape ifNotEmpty: [ self updateStrides]
78-
]
79-
8071
{ #category : #'as yet unclassified' }
8172
PMTensor >> fromNestedArray: aFlatArray withShape: aShape [
8273

src/Math-Matrix/PMTensorTest.class.st

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ PMTensorTest >> testFirst [
4242
self assert: b first equals: #( 1 1 )
4343
]
4444

45+
{ #category : #tests }
46+
PMTensorTest >> testFlattenedIndexOf [
47+
48+
| t1 t2 |
49+
t1 := PMTensor fromNestedArray: #( #( 1 2 3 4 ) #( 5 6 7 8 ) ).
50+
self assert: (t1 flattenedIndexOf: #( 1 2 )) equals: 2.
51+
52+
t2 := PMTensor fromNestedArray: #( #( #( 1 2 ) #( 3 4 ) ) #( #( 5 6 ) #( 7 8 ) )
53+
#( #( 9 10 ) #( 11 12 ) ) #( #( 13 14 ) #( 15 16 ) ) ).
54+
self assert: (t2 flattenedIndexOf: #( 1 2 2 )) equals: 4
55+
]
56+
4557
{ #category : #tests }
4658
PMTensorTest >> testFromNestedArray [
4759

@@ -72,18 +84,6 @@ PMTensorTest >> testGet [
7284
self should:[t1 get: #( 4 4 )] raise:Error
7385
]
7486

75-
{ #category : #tests }
76-
PMTensorTest >> testGetPosition [
77-
78-
| t1 t2 |
79-
t1 := PMTensor fromNestedArray: #( #( 1 2 3 4 ) #( 5 6 7 8 ) ).
80-
self assert: (t1 getPosition: #( 1 2 )) equals: 2.
81-
82-
t2 := PMTensor fromNestedArray: #( #( #( 1 2 ) #( 3 4 ) ) #( #( 5 6 ) #( 7 8 ) )
83-
#( #( 9 10 ) #( 11 12 ) ) #( #( 13 14 ) #( 15 16 ) ) ).
84-
self assert: (t2 getPosition: #( 1 2 2 )) equals: 4
85-
]
86-
8787
{ #category : #tests }
8888
PMTensorTest >> testRank [
8989

@@ -162,13 +162,13 @@ PMTensorTest >> testStrides [
162162
self assert: b strides equals: #( 6 1 ).
163163
b := a reshape: #( 6 4 ).
164164
self assert: b strides equals: #( 4 1 ).
165-
self assert: (b getPosition: #( 4 2 )) equals: 14.
165+
self assert: (b flattenedIndexOf: #( 4 2 )) equals: 14.
166166
b := a reshape: #( 3 4 2 ).
167167
self assert: b strides equals: #( 8 2 1 ).
168-
self assert: (b getPosition: #( 3 2 1)) equals: 19.
168+
self assert: (b flattenedIndexOf: #( 3 2 1)) equals: 19.
169169
b := a reshape: #( 2 3 4 ).
170170
self assert: b strides equals: #( 12 4 1 ).
171-
self assert: (b getPosition: #( 2 2 3 )) equals: 19
171+
self assert: (b flattenedIndexOf: #( 2 2 3 )) equals: 19
172172
]
173173

174174
{ #category : #tests }

0 commit comments

Comments
 (0)