-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsparse_data.h
36 lines (28 loc) · 955 Bytes
/
sparse_data.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include<GA/GA_ATIBlob.h>
#include<GA/GA_BlobData.h>
#include <unordered_map>
class SparseData : public GA_BlobData {
public:
SparseData() {}
virtual ~SparseData() {}
// Implementation of methods on GA_Blob
uint hash() const override {return weights.size();}
bool isEqual(const GA_BlobData &blob) const override{
const SparseData *s;
s = dynamic_cast<const SparseData*>(&blob);
return s && (s->weights == weights);
}
int64 getMemoryUsage(bool inclusive) const override {return 1;} // TODO
void countMemory(UT_MemoryCounter&, bool) const override {} // TODO
void set_weight(int index, float weight){
weights[index] = weight;
}
// inline float get_weight(int index){
// weights[index] = weight;
// }
// TODO: make private once we figute interface
// cage index point and weight
std::unordered_map<int, float> weights;
private:
};