python module pass basic test
This commit is contained in:
@@ -242,7 +242,7 @@ class FMatrixS : public FMatrixInterface<FMatrixS>{
|
||||
* \brief save column access data into stream
|
||||
* \param fo output stream to save to
|
||||
*/
|
||||
inline void SaveColAccess(utils::IStream &fo) {
|
||||
inline void SaveColAccess(utils::IStream &fo) const {
|
||||
fo.Write(&num_buffered_row_, sizeof(num_buffered_row_));
|
||||
if (num_buffered_row_ != 0) {
|
||||
SaveBinary(fo, col_ptr_, col_data_);
|
||||
|
||||
@@ -15,7 +15,12 @@ DataMatrix* LoadDataMatrix(const char *fname, bool silent, bool savebuffer) {
|
||||
}
|
||||
|
||||
void SaveDataMatrix(const DataMatrix &dmat, const char *fname, bool silent) {
|
||||
utils::Error("not implemented");
|
||||
if (dmat.magic == DMatrixSimple::kMagic){
|
||||
const DMatrixSimple *p_dmat = static_cast<const DMatrixSimple*>(&dmat);
|
||||
p_dmat->SaveBinary(fname, silent);
|
||||
} else {
|
||||
utils::Error("not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace io
|
||||
|
||||
@@ -148,7 +148,7 @@ class DMatrixSimple : public DataMatrix {
|
||||
* \param fname name of binary data
|
||||
* \param silent whether print information or not
|
||||
*/
|
||||
inline void SaveBinary(const char* fname, bool silent = false) {
|
||||
inline void SaveBinary(const char* fname, bool silent = false) const {
|
||||
utils::FileStream fs(utils::FopenCheck(fname, "wb"));
|
||||
int magic = kMagic;
|
||||
fs.Write(&magic, sizeof(magic));
|
||||
|
||||
@@ -58,7 +58,7 @@ struct MetaInfo {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
inline void SaveBinary(utils::IStream &fo) {
|
||||
inline void SaveBinary(utils::IStream &fo) const {
|
||||
fo.Write(&num_row, sizeof(num_row));
|
||||
fo.Write(&num_col, sizeof(num_col));
|
||||
fo.Write(labels);
|
||||
|
||||
Reference in New Issue
Block a user