You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Math-Complex/PMComplex.class.st
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -522,6 +522,18 @@ PMComplex >> imaginary [
522
522
^ imaginary
523
523
]
524
524
525
+
{ #category : #testing }
526
+
PMComplex>>isComplexConjugateOf: aNumber [
527
+
"Answer true if self and aNumber are complex conjugates of each other. The complex conjugate of a complex number is the number with an equal real part and an imaginary part equal in magnitude but opposite in sign."
"Answer true if self and aComplexNumber are complex conjugates of each other. The complex conjugate of a complex number is the number with an equal real part and an imaginary part equal in magnitude but opposite in sign."
"Answers a random number with abs between 0 and 1."
23
-
24
-
^selfabs:1.0 random arg:2*Float pi random
25
-
]
26
-
27
20
{ #category : #'*Math-Complex' }
28
21
PMComplex>> random [
29
22
"analog to Number>>random. However, the only bound is that the abs of the produced complex is less than the length of the receive. The receiver effectively defines a disc within which the random element can be produced."
30
23
^selfclass random *self
31
24
32
25
]
33
26
27
+
{ #category : #'*Math-Complex' }
28
+
PMComplexclass>> random [
29
+
"Answers a random number with abs between 0 and 1."
"Answers the probability of observing a random variable distributed according to the receiver with a value lower than or equal to aNumber. Also known as the cumulative density function (CDF)."
"Kurtosis is a measure of the 'tailedness' of the probability distribution of a real-valued random variable. Not defined for a multivariate normal distribution"
52
+
self shouldNotImplement
53
+
]
54
+
55
+
{ #category : #information }
56
+
PMMultivariateNormalDistribution>> meanVector [
57
+
^ meanVector
58
+
]
59
+
60
+
{ #category : #information }
61
+
PMMultivariateNormalDistribution>> parameters [
62
+
"Returns an Array containing the parameters of the distribution.
63
+
It is used to print out the distribution and for fitting."
64
+
65
+
^ { meanVector . covarianceMatrix }
66
+
]
67
+
68
+
{ #category : #information }
69
+
PMMultivariateNormalDistribution>> power [
70
+
"Number of dimensions of a multivariate normal distribution"
71
+
^ meanVector size
72
+
]
73
+
74
+
{ #category : #information }
75
+
PMMultivariateNormalDistribution>> random [
76
+
"Answer a vector of random numbers distributed accroding to the receiver."
"Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. Not defined for a multivariate normal distribution"
"Answers the probability that a random variable distributed according to the receiver gives a value between aVector and aVector + espilon (infinitesimal interval)."
upperTriangular at: j at: i put: nonDiagonalValue ] ] ].
367
+
368
+
^ upperTriangular
369
+
]
370
+
338
371
{ #category : #comparing }
339
372
PMMatrix>>closeTo: aPMMatrix [
340
373
"Tests that we are within the default Float >> #closeTo: precision of aPMMatrix (0.0001)."
@@ -509,6 +542,54 @@ PMMatrix >> inversePureCRL [
509
542
^self squared inversePureCRL *self transpose
510
543
]
511
544
545
+
{ #category : #testing }
546
+
PMMatrix>> isHermitian [
547
+
"Hermitian matrix (or self-adjoint matrix) is a complex square matrix that is equal to its own conjugate transpose — that is, the element in the i-th row and j-th column is equal to the complex conjugate of the element in the j-th row and i-th column, for all indices i and j"
548
+
549
+
self isSquare ifFalse: [ ^false ].
550
+
551
+
1to:self numberOfRows do: [ :i |
552
+
1to: (i -1) do: [ :j |
553
+
((selfat: i at: j) isComplexConjugateOf: (selfat: j at: i))
554
+
ifFalse: [ ^false ] ] ].
555
+
556
+
^true
557
+
]
558
+
559
+
{ #category : #testing }
560
+
PMMatrix>> isNegativeDefinite [
561
+
"A Hermitian matrix is negative definite if and only if all its eigenvalues are strictly negative"
562
+
self isHermitian ifFalse: [ ^false ].
563
+
^self eigen values allSatisfy: [ :each | each <0 ]
564
+
]
565
+
566
+
{ #category : #testing }
567
+
PMMatrix>> isNegativeSemiDefinite [
568
+
"A Hermitian matrix is negative semi-definite if and only if all its eigenvalues are non-positive"
569
+
self isHermitian ifFalse: [ ^false ].
570
+
^self eigen values allSatisfy: [ :each | each <=0 ]
571
+
]
572
+
573
+
{ #category : #testing }
574
+
PMMatrix>> isPositiveDefinite [
575
+
"A Hermitian matrix is positive definite if and only if all its eigenvalues are strictly positive"
576
+
self isHermitian ifFalse: [ ^false ].
577
+
^self eigen values allSatisfy: [ :each | each >0 ]
578
+
]
579
+
580
+
{ #category : #testing }
581
+
PMMatrix>> isPositiveSemiDefinite [
582
+
"A Hermitian matrix is positive semi-definite if and only if all its eigenvalues are non-negative"
583
+
self isHermitian ifFalse: [ ^false ].
584
+
^self eigen values allSatisfy: [ :each | each >=0 ]
585
+
]
586
+
587
+
{ #category : #testing }
588
+
PMMatrix>> isReal [
589
+
"Answer true if all values of the matrix are real numbers"
590
+
^ rows allSatisfy: [ :vector | vector isReal ].
591
+
]
592
+
512
593
{ #category : #testing }
513
594
PMMatrix>> isSquare [
514
595
"Answers true if the number of rows is equal to the number of columns."
0 commit comments