Skip to content

Commit 4ac4f41

Browse files
authored
Merge pull request #294 from jecisc/cut-dependency-from-Matrix-to-Complex
Cut dependency between Matrix and Complex
2 parents 6fecb8f + 6b68e07 commit 4ac4f41

File tree

6 files changed

+51
-22
lines changed

6 files changed

+51
-22
lines changed

src/Math-Complex/Number.extension.st

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ Number >> asComplex [
1313
^ PMComplexNumber real: self imaginary: 0
1414
]
1515

16-
{ #category : #'*Math-Complex' }
17-
Number >> complexConjugate [
18-
"The complex conjugate of a complex number (a + bi) is another complex number (a - bi).
19-
Every real number x is also a complex number with imaginary part equal to 0.
20-
In other words, x = x + 0i and x = x - 0i.
21-
Therefore, the complex conjugate of a real number is the same real number"
22-
23-
^ self
24-
]
25-
2616
{ #category : #'*Math-Complex' }
2717
Number >> i [
2818
^ PMComplexNumber real: 0 imaginary: self
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"
2+
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
3+
"
4+
Class {
5+
#name : #ManifestMathMatrix,
6+
#superclass : #PackageManifest,
7+
#category : #'Math-Matrix-Manifest'
8+
}
9+
10+
{ #category : #'meta-data - dependency analyser' }
11+
ManifestMathMatrix class >> manuallyResolvedDependencies [
12+
^ #(#'Collections-Streams' #'Math-Operations-Extensions')
13+
]

src/Math-Matrix/Number.extension.st

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ Number >> addWithRegularMatrix: aMatrix [
66
^ PMMatrix rows: (aMatrix rowsCollect: [ :row | row + self ])
77
]
88

9+
{ #category : #'*Math-Matrix' }
10+
Number >> complexConjugate [
11+
"The complex conjugate of a complex number (a + bi) is another complex number (a - bi).
12+
Every real number x is also a complex number with imaginary part equal to 0.
13+
In other words, x = x + 0i and x = x - 0i.
14+
Therefore, the complex conjugate of a real number is the same real number"
15+
16+
"Maintenance note: This method is related to complexes but is packaged in Matrix because the version on Number is not dependant of Complexe and is used by matrix algos."
17+
18+
^ self
19+
]
20+
921
{ #category : #'*Math-Matrix' }
1022
Number >> productWithMatrix: aMatrix [
1123
^aMatrix class rows: (aMatrix rowsCollect: [:r| self productWithVector: r])
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Extension { #name : #PMMatrixTest }
2+
3+
{ #category : #'*Math-Tests-Complex' }
4+
PMMatrixTest >> testIsRealOnComplexMatrix [
5+
| matrix |
6+
7+
matrix := PMMatrix rows: {
8+
{ 1 . 3 + 4i . 0 } .
9+
{ 1 - 2i . 2 . -4 } .
10+
{ -8 + 0i . 5 . -1 } }.
11+
12+
self deny: matrix isReal.
13+
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"
2+
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
3+
"
4+
Class {
5+
#name : #ManifestMathTestsMatrix,
6+
#superclass : #PackageManifest,
7+
#category : #'Math-Tests-Matrix-Manifest'
8+
}
9+
10+
{ #category : #'meta-data - dependency analyser' }
11+
ManifestMathTestsMatrix class >> manuallyResolvedDependencies [
12+
^ #(#'Math-Core-Process')
13+
]

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,6 @@ PMMatrixTest >> testInverseSingularMatrixError [
252252
raise: PMSingularMatrixError.
253253
]
254254

255-
{ #category : #tests }
256-
PMMatrixTest >> testIsRealOnComplexMatrix [
257-
| matrix |
258-
259-
matrix := PMMatrix rows: {
260-
{ 1 . 3 + 4i . 0 } .
261-
{ 1 - 2i . 2 . -4 } .
262-
{ -8 + 0i . 5 . -1 } }.
263-
264-
self deny: matrix isReal.
265-
]
266-
267255
{ #category : #tests }
268256
PMMatrixTest >> testIsRealOnRealMatrix [
269257
| matrix |

0 commit comments

Comments
 (0)