From b2e0e5575167fdd0942f0ce78d70c7c404757c36 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Mon, 28 Nov 2022 22:18:24 +0100 Subject: [PATCH] Cut dependency from Core to Complex. With this, Math-Core does not depend on anything else from Polymath. --- src/Math-Complex/PMVector.extension.st | 8 ++++++++ src/Math-Core/ManifestMathCore.class.st | 13 +++++++++++++ src/Math-Core/PMVector.class.st | 6 ------ .../PMComplexNumberTest.class.st | 16 ++++++++++++++++ src/Math-Tests-Core/PMVectorTest.class.st | 14 -------------- 5 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 src/Math-Core/ManifestMathCore.class.st diff --git a/src/Math-Complex/PMVector.extension.st b/src/Math-Complex/PMVector.extension.st index c9d2e666c..4aa611eb7 100644 --- a/src/Math-Complex/PMVector.extension.st +++ b/src/Math-Complex/PMVector.extension.st @@ -4,3 +4,11 @@ Extension { #name : #PMVector } PMVector >> adaptToComplex: rcvr andSend: selector [ ^ self collect: [ :ea | rcvr perform: selector with: ea ] ] + +{ #category : #'*Math-Complex' } +PMVector >> isReal [ + + "Answer true if all values of the vector are real numbers" + + ^ self allSatisfy: [ :each | each isRealNumber ] +] diff --git a/src/Math-Core/ManifestMathCore.class.st b/src/Math-Core/ManifestMathCore.class.st new file mode 100644 index 000000000..258ce9ce6 --- /dev/null +++ b/src/Math-Core/ManifestMathCore.class.st @@ -0,0 +1,13 @@ +" +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 +" +Class { + #name : #ManifestMathCore, + #superclass : #PackageManifest, + #category : #'Math-Core-Manifest' +} + +{ #category : #'meta-data - dependency analyser' } +ManifestMathCore class >> manuallyResolvedDependencies [ + ^ #(#'Transcript-Core' #'Math-Operations-Extensions') +] diff --git a/src/Math-Core/PMVector.class.st b/src/Math-Core/PMVector.class.st index 20beb4db2..c566a150e 100644 --- a/src/Math-Core/PMVector.class.st +++ b/src/Math-Core/PMVector.class.st @@ -214,12 +214,6 @@ PMVector >> householder [ ^Array with: b with: v ] -{ #category : #testing } -PMVector >> isReal [ - "Answer true if all values of the vector are real numbers" - ^ self allSatisfy: [ :each | each isRealNumber ]. -] - { #category : #testing } PMVector >> isZero [ ^ self allSatisfy: [ :element | element = 0 ] diff --git a/src/Math-Tests-Complex/PMComplexNumberTest.class.st b/src/Math-Tests-Complex/PMComplexNumberTest.class.st index 50f9948fd..e7d9c7796 100644 --- a/src/Math-Tests-Complex/PMComplexNumberTest.class.st +++ b/src/Math-Tests-Complex/PMComplexNumberTest.class.st @@ -438,6 +438,22 @@ PMComplexNumberTest >> testIsRealNumberOnReal [ self assert: 0.5 isRealNumber ] +{ #category : #tests } +PMComplexNumberTest >> testIsRealOnComplexVector [ + + | vector | + vector := { 1. 4. -2. (0.5 + 3 i) } asPMVector. + self deny: vector isReal +] + +{ #category : #tests } +PMComplexNumberTest >> testIsRealOnRealVector [ + + | vector | + vector := #( 1 4 -2 0.5 ) asPMVector. + self assert: vector isReal +] + { #category : #'testing - mathematical functions' } PMComplexNumberTest >> testLn [ self assert: (Float e + 0 i) ln equals: Float e ln "See Bug 1815 on Mantis" diff --git a/src/Math-Tests-Core/PMVectorTest.class.st b/src/Math-Tests-Core/PMVectorTest.class.st index 51a433b6f..23442b5d4 100644 --- a/src/Math-Tests-Core/PMVectorTest.class.st +++ b/src/Math-Tests-Core/PMVectorTest.class.st @@ -84,20 +84,6 @@ PMVectorTest >> testHouseholder [ assert: (w at: 2) asArray equals: #(1.0 -1.6180158992689828). ] -{ #category : #tests } -PMVectorTest >> testIsRealOnComplexVector [ - | vector | - vector := { 1 . 4 . -2 . 0.5 + 3i } asPMVector. - self deny: vector isReal. -] - -{ #category : #tests } -PMVectorTest >> testIsRealOnRealVector [ - | vector | - vector := #(1 4 -2 0.5) asPMVector. - self assert: vector isReal. -] - { #category : #tests } PMVectorTest >> testLessThan [ | vec vecCopy |