-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdecomposition.cc
More file actions
67 lines (54 loc) · 1.53 KB
/
decomposition.cc
File metadata and controls
67 lines (54 loc) · 1.53 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* decomposition.cc -*- C++ -*-
Jeremy Barnes, 24 October 2009
Copyright (c) 2009 Jeremy Barnes. All rights reserved.
Decomposition code.
*/
#include "decomposition.h"
#include "jml/boosting/registry.h"
#include "jml/utils/filter_streams.h"
using namespace std;
using namespace ML;
using namespace ML::DB;
/*****************************************************************************/
/* DECOMPOSITION */
/*****************************************************************************/
void
Decomposition::
poly_serialize(ML::DB::Store_Writer & store) const
{
Registry<Decomposition>::singleton().serialize(store, this);
}
boost::shared_ptr<Decomposition>
Decomposition::
poly_reconstitute(ML::DB::Store_Reader & store)
{
return Registry<Decomposition>::singleton().reconstitute(store);
}
boost::shared_ptr<Decomposition>
Decomposition::
create(const std::string & type)
{
return Registry<Decomposition>::singleton().create(type);
}
bool
Decomposition::
known_type(const std::string & type)
{
return Registry<Decomposition>::singleton().known_type(type);
}
void
Decomposition::
save(const std::string & filename) const
{
filter_ostream stream(filename);
DB::Store_Writer store(stream);
poly_serialize(store);
}
boost::shared_ptr<Decomposition>
Decomposition::
load(const std::string & filename)
{
filter_istream stream(filename);
DB::Store_Reader store(stream);
return poly_reconstitute(store);
}