Go to the source code of this file.
Defines | |
#define | GET_VECTOR(fname, mfname, sg_type) |
#define | GET_MATRIX(fname, conv, sg_type) |
#define | GET_NDARRAY(fname, conv, sg_type) |
#define | GET_SPARSEMATRIX(fname, conv, sg_type) |
#define | SET_VECTOR(fname, mfname, sg_type) |
#define | SET_MATRIX(fname, sg_type, fprt_type, type_str) |
#define | SET_NDARRAY(fname, sg_type, fprt_type, type_str) |
#define | SET_SPARSEMATRIX(fname, sg_type, fprt_type, type_str) |
#define GET_MATRIX | ( | fname, | ||
conv, | ||||
sg_type | ||||
) |
Definition at line 82 of file AsciiFile.cpp.
#define GET_NDARRAY | ( | fname, | ||
conv, | ||||
sg_type | ||||
) |
Definition at line 167 of file AsciiFile.cpp.
#define GET_SPARSEMATRIX | ( | fname, | ||
conv, | ||||
sg_type | ||||
) |
Definition at line 285 of file AsciiFile.cpp.
#define GET_VECTOR | ( | fname, | ||
mfname, | ||||
sg_type | ||||
) |
void CAsciiFile::fname(sg_type*& vec, int32_t& len) \ { \ vec=NULL; \ len=0; \ int32_t num_feat=0; \ int32_t num_vec=0; \ mfname(vec, num_feat, num_vec); \ if ((num_feat==1) || (num_vec==1)) \ { \ if (num_feat==1) \ len=num_vec; \ else \ len=num_feat; \ } \ else \ { \ SG_FREE(vec); \ vec=NULL; \ len=0; \ SG_ERROR("Could not read vector from" \ " file %s (shape %dx%d found but " \ "vector expected).\n", filename, \ num_vec, num_feat); \ } \ }
Definition at line 41 of file AsciiFile.cpp.
#define SET_MATRIX | ( | fname, | ||
sg_type, | ||||
fprt_type, | ||||
type_str | ||||
) |
void CAsciiFile::fname(const sg_type* matrix, int32_t num_feat, int32_t num_vec) \ { \ if (!(file && matrix)) \ SG_ERROR("File or matrix invalid.\n"); \ \ for (int32_t i=0; i<num_vec; i++) \ { \ for (int32_t j=0; j<num_feat; j++) \ { \ sg_type v=matrix[num_feat*i+j]; \ if (j==num_feat-1) \ fprintf(file, type_str "\n", (fprt_type) v); \ else \ fprintf(file, type_str " ", (fprt_type) v); \ } \ } \ }
Definition at line 826 of file AsciiFile.cpp.
#define SET_NDARRAY | ( | fname, | ||
sg_type, | ||||
fprt_type, | ||||
type_str | ||||
) |
void CAsciiFile::fname(const sg_type* array, int32_t * dims, int32_t num_dims) \ { \ if (!(file && array)) \ SG_ERROR("File or data invalid.\n"); \ \ size_t total = 1; \ for(int i = 0;i < num_dims;i++) \ total *= dims[i]; \ int32_t block_size = dims[num_dims-1]; \ \ fprintf(file,"%d ",num_dims); \ for(int i = 0;i < num_dims;i++) \ fprintf(file,"%d ",dims[i]); \ fprintf(file,"\n"); \ \ for (size_t i=0; i < total; i++) \ { \ sg_type v= array[i]; \ if ( ((i+1) % block_size) == 0) \ fprintf(file, type_str "\n", (fprt_type) v); \ else \ fprintf(file, type_str " ", (fprt_type) v); \ } \ }
Definition at line 858 of file AsciiFile.cpp.
#define SET_SPARSEMATRIX | ( | fname, | ||
sg_type, | ||||
fprt_type, | ||||
type_str | ||||
) |
void CAsciiFile::fname(const SGSparseVector<sg_type>* matrix, int32_t num_feat, int32_t num_vec) \ { \ if (!(file && matrix)) \ SG_ERROR("File or matrix invalid.\n"); \ \ for (int32_t i=0; i<num_vec; i++) \ { \ SGSparseVectorEntry<sg_type>* vec = matrix[i].features; \ int32_t len=matrix[i].num_feat_entries; \ \ for (int32_t j=0; j<len; j++) \ { \ if (j<len-1) \ { \ fprintf(file, "%d:" type_str " ", \ (int32_t) vec[j].feat_index+1, (fprt_type) vec[j].entry); \ } \ else \ { \ fprintf(file, "%d:" type_str "\n", \ (int32_t) vec[j].feat_index+1, (fprt_type) vec[j].entry); \ } \ } \ } \ }
Definition at line 898 of file AsciiFile.cpp.
#define SET_VECTOR | ( | fname, | ||
mfname, | ||||
sg_type | ||||
) |
void CAsciiFile::fname(const sg_type* vec, int32_t len) \ { \ mfname(vec, len, 1); \ }
set functions - to pass data from shogun to the target interface
Definition at line 807 of file AsciiFile.cpp.