OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-matrix commits / 0ce0262

Remove more CountTruthValue occurances
0ce0262151f0e44e8edd57e52225247621956ec3
by Linas Vepštas <linasvepstas@gmail.com> · 2025-10-10T14:07:40.000Z

Changed files (2) +7 -15

opencog/matrix/count-api.scm +7 -7
……@@ -122,7 +122,7 @@
122122 'count-type - Return the type of the Value holding the count. If the
123123 base class LLOBJ provides this method, then this type will be used
124124 when first creating a Value to hold the count. If the base class
125 does not provide this, then the default of `CountTruthValue` will
125 does not provide this, then the default of `FloatValue` will
126126 be used. The count-type should be a subtype of type `FloatValue`,
127127 as this is the only type capable of holding numbers.
128128
……@@ -131,19 +131,19 @@
131131 then this offset will be used when setting or incrementing the
132132 scalar count. If the base class does not provide this, then the
133133 default of 2 will be used. This default is the location of the
134 count field on `CountTruthValue`'s and is thus backwards-compat
134 count field on `FloatValue`'s and is thus backwards-compat
135135 with older code.
136136
137137 If 'count-ref is provided and returns #f, then all counts will
138138 be treated as vectors, so that gets, sets and increments all
139139 operate on vectors.
140140"
141 ; By default, the count is stored as a CountTruthValue.
141 ; By default, the count is stored as a FloatValue.
142142 ; That means that it is on the TruthValue Key, and is the
143143 ; third number (the first two being strength and confidence.)
144144 ; These defaults are used if and only if the base object does
145145 ; not provide these.
146 (define (count-type) 'CountTruthValue)
146 (define (count-type) 'FloatValue)
147147 (define (count-key) (PredicateNode "*-TruthValueKey-*"))
148148 (define (count-ref) 2)
149149
……@@ -179,7 +179,7 @@
179179 (cog-set-value-ref! PAIR cnt-key CNT cnt-ref))
180180
181181 ; Increment location. Unlike cog-set-value-ref!, this will
182 ; automatically create the FloatValue (or CountTruthValue).
182 ; automatically create the FloatValue.
183183 (define (inc-scalar-count PAIR CNT)
184184 (cog-inc-value! PAIR cnt-key CNT cnt-ref))
185185
……@@ -351,8 +351,8 @@
351351
352352 ; Return the observed count for the pair PAIR.
353353 ; If the pair has nothing at the storage key, fetch it.
354 ; If the pair has the wrong type, e.g. SimpleTV instead of CountTV
355 ; then fetch it. Be surgical w/ the fetch. Get only what we need.
354 ; If the pair has the wrong type, then fetch it.
355 ; Be surgical w/ the fetch. Get only what we need.
356356 ;
357357 ; This uses a mutex to minimize, but not avoid a race window
358358 ; involving fetch-and-add. Users that try to fetch non-existant
opencog/matrix/support.scm +0 -8
……@@ -89,12 +89,6 @@
8989 (define (set-norms ATOM L0 L1 L2 LQ SU)
9090 (cog-set-value! ATOM norm-key (FloatValue L0 L1 L2 LQ SU)))
9191
92 ; -----------------
93 ; Set the grand-total count. Use the CountTruthValue.
94 ; Backwards-compatibility method. Remove this someday.
95 (define (set-wild-wild-count CNT)
96 (cog-set-tv! (LLOBJ 'wild-wild) (CountTruthValue 0 0 CNT)))
97
9892 ; -----------------
9993 (define left-total-key-name
10094 (if is-filtered?
……@@ -104,7 +98,6 @@
10498 (define left-total-key (PredicateNode left-total-key-name))
10599
106100 (define (set-left-totals L0 L1 SU)
107 (set-wild-wild-count L1)
108101 (cog-set-value! (LLOBJ 'wild-wild) left-total-key (FloatValue L0 L1 SU)))
109102
110103 (define right-total-key-name
……@@ -115,7 +108,6 @@
115108 (define right-total-key (PredicateNode right-total-key-name))
116109
117110 (define (set-right-totals L0 L1 SU)
118 (set-wild-wild-count L1)
119111 (cog-set-value! (LLOBJ 'wild-wild) right-total-key (FloatValue L0 L1 SU)))
120112
121113 ; -----------------