• 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

83.93
/src/Math-Numerical/PMScaledProbabilityDensityFunction.class.st
1
Class {
2
        #name : #PMScaledProbabilityDensityFunction,
3
        #superclass : #Object,
4
        #instVars : [
5
                'probabilityDensityFunction',
6
                'count',
7
                'binWidth'
8
        ],
9
        #category : #'Math-Numerical'
10
}
11

12
{ #category : #creation }
13
PMScaledProbabilityDensityFunction class >> histogram: aHistogram against: aProbabilityDensityFunction [
3✔
14
        "Create a new instance of the receiver with given probability density function and histogram."
3✔
15
                ^self new
3✔
16
                initialize: aProbabilityDensityFunction
3✔
17
                binWidth: aHistogram binWidth
3✔
18
                count: aHistogram totalCount
3✔
19
]
3✔
20

21
{ #category : #creation }
22
PMScaledProbabilityDensityFunction class >> histogram: aHistogram distributionClass: aProbabilityDensityFunctionClass [
3✔
23
        "Create a new instance of the receiver with given probability density function and histogram."
3✔
24

3✔
25
        | dp |
3✔
26
        ^ (dp := aProbabilityDensityFunctionClass fromHistogram: aHistogram) ifNotNil: [ self histogram: aHistogram against: dp ]
3✔
27
]
3✔
28

29
{ #category : #transformation }
30
PMScaledProbabilityDensityFunction >> changeParametersBy: aVector [
3✔
31
                "Modify the parameters of the receiver by aVector"
3✔
32
        count := count + aVector last.
3✔
33
        probabilityDensityFunction changeParametersBy: aVector
3✔
34
]
3✔
35

36
{ #category : #information }
37
PMScaledProbabilityDensityFunction >> distributionFunction [
×
38
        ^probabilityDensityFunction distributionFunction
×
39
]
×
40

41
{ #category : #initialization }
42
PMScaledProbabilityDensityFunction >> initialize: aProbabilityDensityFunction binWidth: aNumber count: anInteger [
3✔
43
        "Private"
3✔
44

3✔
45
        probabilityDensityFunction := aProbabilityDensityFunction.
3✔
46
        binWidth := aNumber.
3✔
47
        count := anInteger.
3✔
48
        ^self
3✔
49
]
3✔
50

51
{ #category : #information }
52
PMScaledProbabilityDensityFunction >> parameters [
3✔
53
        ^probabilityDensityFunction parameters copyWith: count
3✔
54
]
3✔
55

56
{ #category : #display }
57
PMScaledProbabilityDensityFunction >> printOn: aStream [
×
58
        super printOn: aStream.
×
59
        aStream nextPut: $[;
×
60
                        nextPutAll: probabilityDensityFunction class distributionName;
×
61
                        nextPut: $]
×
62
]
×
63

64
{ #category : #transformation }
65
PMScaledProbabilityDensityFunction >> setCount: aNumber [
3✔
66
        count := aNumber
3✔
67
]
3✔
68

69
{ #category : #information }
70
PMScaledProbabilityDensityFunction >> value: aNumber [
3✔
71

3✔
72
        ^(probabilityDensityFunction value: aNumber) * binWidth * count
3✔
73
]
3✔
74

75
{ #category : #information }
76
PMScaledProbabilityDensityFunction >> valueAndGradient: aNumber [
3✔
77
        "Answers an Array containing the value of the receiver at aNumber
3✔
78
                 and the gradient of the receiver's respective to the receiver's
3✔
79
                 parameters evaluated at aNumber."
3✔
80

3✔
81
        | g temp |
3✔
82
        g := probabilityDensityFunction valueAndGradient: aNumber.
3✔
83
        temp := binWidth * count.
3✔
84
        ^Array with: g first * temp
3✔
85
                   with: ( (g last collect: [:each | each * temp]) copyWith: g first * binWidth)
3✔
86
]
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