Lines Matching refs:K
36 template<class W, class K>
38 W Map(const K& k, const W& v1, const W& v2) const { in Map()
43 template<class W, class K>
45 W Map(const K& k, const W& v1, const W& v2) const { in Map()
50 template<class W, class K>
55 W Map(const K& k, const W& v1, const W& v2) const { in Map()
61 template<class W, class K>
64 W Map(const K& k, const W& v1, const W& v2) const { in Map()
79 template <class W, class K = int>
80 class SparsePowerWeight : public SparseTupleWeight<W, K> {
82 using SparseTupleWeight<W, K>::Zero;
83 using SparseTupleWeight<W, K>::One;
84 using SparseTupleWeight<W, K>::NoWeight;
85 using SparseTupleWeight<W, K>::Quantize;
86 using SparseTupleWeight<W, K>::Reverse;
88 typedef SparsePowerWeight<typename W::ReverseWeight, K> ReverseWeight;
92 SparsePowerWeight(const SparseTupleWeight<W, K> &w) : in SparsePowerWeight()
93 SparseTupleWeight<W, K>(w) { } in SparsePowerWeight()
97 SparseTupleWeight<W, K>(begin, end) { } in SparsePowerWeight()
99 SparsePowerWeight(const K &key, const W &w) : in SparsePowerWeight()
100 SparseTupleWeight<W, K>(key, w) { } in SparsePowerWeight()
102 static const SparsePowerWeight<W, K> &Zero() { in Zero()
103 static const SparsePowerWeight<W, K> zero(SparseTupleWeight<W, K>::Zero()); in Zero()
107 static const SparsePowerWeight<W, K> &One() { in One()
108 static const SparsePowerWeight<W, K> one(SparseTupleWeight<W, K>::One()); in One()
112 static const SparsePowerWeight<W, K> &NoWeight() { in NoWeight()
113 static const SparsePowerWeight<W, K> no_weight( in NoWeight()
114 SparseTupleWeight<W, K>::NoWeight()); in NoWeight()
124 if(sizeof(K) != sizeof(uint32)) { in Type()
126 Int64ToStr(8 * sizeof(K), &size); in Type()
139 SparsePowerWeight<W, K> Quantize(float delta = kDelta) const {
140 return SparseTupleWeight<W, K>::Quantize(delta);
144 return SparseTupleWeight<W, K>::Reverse(); in Reverse()
149 template <class W, class K>
150 inline SparsePowerWeight<W, K> Plus(const SparsePowerWeight<W, K> &w1, in Plus()
151 const SparsePowerWeight<W, K> &w2) { in Plus()
152 SparsePowerWeight<W, K> ret; in Plus()
153 SparseTupleWeightPlusMapper<W, K> operator_mapper; in Plus()
159 template <class W, class K>
160 inline SparsePowerWeight<W, K> Times(const SparsePowerWeight<W, K> &w1, in Times()
161 const SparsePowerWeight<W, K> &w2) { in Times()
162 SparsePowerWeight<W, K> ret; in Times()
163 SparseTupleWeightTimesMapper<W, K> operator_mapper; in Times()
169 template <class W, class K>
170 inline SparsePowerWeight<W, K> Divide(const SparsePowerWeight<W, K> &w1,
171 const SparsePowerWeight<W, K> &w2,
173 SparsePowerWeight<W, K> ret;
174 SparseTupleWeightDivideMapper<W, K> operator_mapper(type);
180 template <class W, class K>
181 inline const W& DotProduct(const SparsePowerWeight<W, K> &w1, in DotProduct()
182 const SparsePowerWeight<W, K> &w2) { in DotProduct()
183 const SparsePowerWeight<W, K>& product = Times(w1, w2); in DotProduct()
185 for (SparseTupleWeightIterator<W, K> it(product); !it.Done(); it.Next()) { in DotProduct()
191 template <class W, class K>
192 inline bool ApproxEqual(const SparsePowerWeight<W, K> &w1,
193 const SparsePowerWeight<W, K> &w2,
195 SparseTupleWeight<W, K> ret;
196 SparseTupleWeightApproxMapper<W, K> operator_mapper(kDelta);
198 return ret == SparsePowerWeight<W, K>::One();
201 template <class W, class K>
202 inline SparsePowerWeight<W, K> Times(const W &k, in Times()
203 const SparsePowerWeight<W, K> &w2) { in Times()
204 SparsePowerWeight<W, K> w1(k); in Times()
208 template <class W, class K>
209 inline SparsePowerWeight<W, K> Times(const SparsePowerWeight<W, K> &w1, in Times()
211 SparsePowerWeight<W, K> w2(k); in Times()
215 template <class W, class K>
216 inline SparsePowerWeight<W, K> Divide(const SparsePowerWeight<W, K> &w1,
219 SparsePowerWeight<W, K> w2(k);