• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PolyMathOrg / PolyMath / 4385132063

pending completion
4385132063

push

github

GitHub
Merge pull request #316 from jecisc/divers-cleanings

2977 of 2977 new or added lines in 214 files covered. (100.0%)

19725 of 24212 relevant lines covered (81.47%)

2.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/src/Math-Distributions/PMMultivariateNormalDistribution.class.st
1
Class {
2
        #name : #PMMultivariateNormalDistribution,
3
        #superclass : #PMProbabilityDensity,
4
        #instVars : [
5
                'meanVector',
6
                'covarianceMatrix'
7
        ],
8
        #category : #'Math-Distributions-Normal'
9
}
10

11
{ #category : #'instance creation' }
12
PMMultivariateNormalDistribution class >> meanVector: aMeanVector covarianceMatrix: aCovarianceMatrix [
3✔
13
        ^ self new
3✔
14
                initializeMeanVector: aMeanVector
3✔
15
                covarianceMatrix: aCovarianceMatrix;
3✔
16
                yourself
3✔
17
]
3✔
18

19
{ #category : #information }
20
PMMultivariateNormalDistribution >> average [
3✔
21
        ^ self meanVector
3✔
22
]
3✔
23

24
{ #category : #transformation }
25
PMMultivariateNormalDistribution >> changeParametersBy: aVector [
×
26
        "Modify the parameters of the receiver by aVector."
×
27
        meanVector := meanVector + aVector first.
×
28
        covarianceMatrix := covarianceMatrix + aVector second
×
29
]
×
30

31
{ #category : #information }
32
PMMultivariateNormalDistribution >> covarianceMatrix [
×
33
        ^ covarianceMatrix
×
34
]
×
35

36
{ #category : #information }
37
PMMultivariateNormalDistribution >> distributionValue: aNumber [
×
38
        "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)."
×
39

×
40
        self shouldBeImplemented
×
41
]
×
42

43
{ #category : #initialization }
44
PMMultivariateNormalDistribution >> initializeMeanVector: aMeanVector covarianceMatrix: aCovarianceMatrix [
3✔
45
        meanVector := aMeanVector.
3✔
46
        covarianceMatrix := aCovarianceMatrix
3✔
47
]
3✔
48

49
{ #category : #information }
50
PMMultivariateNormalDistribution >> kurtosis [
×
51
        "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 [
3✔
57
        ^ meanVector
3✔
58
]
3✔
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 [
3✔
70
        "Number of dimensions of a multivariate normal distribution"
3✔
71
        ^ meanVector size
3✔
72
]
3✔
73

74
{ #category : #information }
75
PMMultivariateNormalDistribution >> random [
3✔
76
        "Answer a vector of random numbers distributed accroding to the receiver."
3✔
77
        | standardNormalRandom upperTriangular |
3✔
78

3✔
79
        standardNormalRandom := (1 to: self power) asPMVector
3✔
80
                collect: [ :each | PMNormalDistribution random ].
3✔
81

3✔
82
        upperTriangular := covarianceMatrix choleskyDecomposition.
3✔
83

3✔
84
        ^ upperTriangular transpose * standardNormalRandom + meanVector
3✔
85
]
3✔
86

87
{ #category : #information }
88
PMMultivariateNormalDistribution >> skewness [
×
89
        "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"
×
90
        self shouldNotImplement
×
91
]
×
92

93
{ #category : #information }
94
PMMultivariateNormalDistribution >> value: aVector [
3✔
95
        "Answers the probability that a random variable distributed according to the receiver gives a value between aVector and aVector + espilon (infinitesimal interval)."
3✔
96

3✔
97
        ^ (-1/2 * (aVector - meanVector) * covarianceMatrix inverse * (aVector - meanVector)) exp / (((2 * Float pi) raisedTo: self power) * covarianceMatrix determinant) sqrt
3✔
98
]
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc