Lines Matching refs:W
48 template <class W, class K> class SparseTupleWeight;
50 template<class W, class K>
53 template <class W, class K>
54 istream &operator>>(istream &strm, SparseTupleWeight<W, K> &w);
59 template <class W, class K = int>
62 typedef pair<K, W> Pair;
63 typedef SparseTupleWeight<typename W::ReverseWeight, K> ReverseWeight;
79 SparseTupleWeight(const K& key, const W &w) { in SparseTupleWeight()
84 SparseTupleWeight(const W &w) { in SparseTupleWeight()
88 SparseTupleWeight(const SparseTupleWeight<W, K> &w) { in SparseTupleWeight() argument
91 for (SparseTupleWeightIterator<W, K> it(w); !it.Done(); it.Next()) { in SparseTupleWeight()
96 static const SparseTupleWeight<W, K> &Zero() { in Zero()
97 static SparseTupleWeight<W, K> zero; in Zero()
101 static const SparseTupleWeight<W, K> &One() { in One()
102 static SparseTupleWeight<W, K> one(W::One()); in One()
106 static const SparseTupleWeight<W, K> &NoWeight() { in NoWeight()
107 static SparseTupleWeight<W, K> no_weight(W::NoWeight()); in NoWeight()
123 SparseTupleWeight<W, K> &operator=(const SparseTupleWeight<W, K> &w) {
126 for (SparseTupleWeightIterator<W, K> it(w); !it.Done(); it.Next()) {
134 for (SparseTupleWeightIterator<W, K> it(*this); !it.Done(); it.Next()) { in Member()
144 for (SparseTupleWeightIterator<W, K> it(*this); !it.Done(); it.Next()) { in Hash()
151 SparseTupleWeight<W, K> Quantize(float delta = kDelta) const {
152 SparseTupleWeight<W, K> w;
153 for (SparseTupleWeightIterator<W, K> it(*this); !it.Done(); it.Next()) {
160 SparseTupleWeight<W, K> w; in Reverse()
161 for (SparseTupleWeightIterator<W, K> it(*this); !it.Done(); it.Next()) { in Reverse()
169 Init(W::Zero()); in Init()
172 void Init(const W& default_value) { in Init()
186 inline void Push(const K &k, const W &w, bool default_value_check = true) {
199 void SetDefaultValue(const W& val) { default_ = val; } in SetDefaultValue()
201 const W& DefaultValue() const { return default_; } in DefaultValue()
205 istream&, SparseTupleWeight<W, K>&, char separator);
208 istream&, SparseTupleWeight<W, K>&,
213 W default_;
221 friend istream &operator>><W, K>(istream&, SparseTupleWeight<W, K>&);
222 friend class SparseTupleWeightIterator<W, K>;
225 template<class W, class K>
228 typedef typename SparseTupleWeight<W, K>::Pair Pair;
232 explicit SparseTupleWeightIterator(const SparseTupleWeight<W, K>& w) in SparseTupleWeightIterator() argument
238 return first_.first == SparseTupleWeight<W, K>::kNoKey; in Done()
266 template<class W, class K, class M>
268 SparseTupleWeight<W, K>* ret, in SparseTupleWeightMap() argument
269 const SparseTupleWeight<W, K>& w1, in SparseTupleWeightMap() argument
270 const SparseTupleWeight<W, K>& w2, in SparseTupleWeightMap()
272 SparseTupleWeightIterator<W, K> w1_it(w1); in SparseTupleWeightMap()
273 SparseTupleWeightIterator<W, K> w2_it(w2); in SparseTupleWeightMap()
274 const W& v1_def = w1.DefaultValue(); in SparseTupleWeightMap()
275 const W& v2_def = w2.DefaultValue(); in SparseTupleWeightMap()
280 const W& v1 = (w1_it.Done()) ? v1_def : w1_it.Value().second; in SparseTupleWeightMap()
281 const W& v2 = (w2_it.Done()) ? v2_def : w2_it.Value().second; in SparseTupleWeightMap()
296 template <class W, class K>
297 inline bool operator==(const SparseTupleWeight<W, K> &w1,
298 const SparseTupleWeight<W, K> &w2) {
299 const W& v1_def = w1.DefaultValue();
300 const W& v2_def = w2.DefaultValue();
303 SparseTupleWeightIterator<W, K> w1_it(w1);
304 SparseTupleWeightIterator<W, K> w2_it(w2);
308 const W& v1 = (w1_it.Done()) ? v1_def : w1_it.Value().second;
309 const W& v2 = (w2_it.Done()) ? v2_def : w2_it.Value().second;
325 template <class W, class K>
326 inline bool operator!=(const SparseTupleWeight<W, K> &w1,
327 const SparseTupleWeight<W, K> &w2) {
331 template <class W, class K>
332 inline ostream &operator<<(ostream &strm, const SparseTupleWeight<W, K> &w) {
359 for (SparseTupleWeightIterator<W, K> it(w); !it.Done(); it.Next()) {
372 template <class W, class K>
373 inline istream &operator>>(istream &strm, SparseTupleWeight<W, K> &w) {
387 return SparseTupleWeight<W, K>::ReadWithParen(
391 return SparseTupleWeight<W, K>::ReadNoParen(strm, w, separator);
396 template <class W, class K>
397 inline istream& SparseTupleWeight<W, K>::ReadNoParen( in ReadNoParen() argument
399 SparseTupleWeight<W, K> &w, in ReadNoParen()
410 W default_value; in ReadNoParen()
446 W r; in ReadNoParen()
490 template <class W, class K>
491 inline istream& SparseTupleWeight<W, K>::ReadWithParen( in ReadWithParen() argument
493 SparseTupleWeight<W, K> &w, in ReadWithParen()
513 W default_value; in ReadWithParen()
561 W r; in ReadWithParen()