Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Update SparseBinaryMatrix to use Serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan51 committed Dec 4, 2015
1 parent 8917eae commit e221e3d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/nupic/math/SparseBinaryMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <nupic/math/StlIo.hpp>
#include <nupic/math/ArrayAlgo.hpp>
#include <nupic/proto/SparseBinaryMatrixProto.capnp.h>
#include <nupic/types/Serializable.hpp>

namespace nupic {

Expand All @@ -45,7 +46,7 @@ namespace nupic {
*
*/
template <typename UI1 = nupic::UInt32, typename UI2 = nupic::UInt32>
class SparseBinaryMatrix {
class SparseBinaryMatrix : Serializable<SparseBinaryMatrixProto> {
public:
typedef UI1 size_type;
typedef UI2 nz_index_type;
Expand Down Expand Up @@ -1294,6 +1295,8 @@ class SparseBinaryMatrix {
}
}

using Serializable::write;

inline void write(SparseBinaryMatrixProto::Builder &proto) const {
proto.setNumRows(nRows());
proto.setNumColumns(nCols());
Expand All @@ -1307,6 +1310,8 @@ class SparseBinaryMatrix {
}
}

using Serializable::read;

inline void read(SparseBinaryMatrixProto::Reader &proto) {
auto rows = proto.getNumRows();
auto columns = proto.getNumColumns();
Expand Down

0 comments on commit e221e3d

Please sign in to comment.