21 using namespace shogun;
49 if (rw==
'r' || rw ==
'w')
53 if (!(
file=fopen((
const char*)
filename, (
const char*) mode)))
58 SG_ERROR(
"unknown mode '%c'\n", mode[0]);
72 for (int32_t i=0; i<len; i++)
73 vector[i]= (int_vector[i]!=0);
80 int32_t* int_vector =
SG_MALLOC(int32_t, len);
81 for (int32_t i=0;i<len;i++)
94 uint8_t * byte_matrix;
97 ASSERT(num_feat > 0 && num_vec > 0)
98 matrix =
SG_MALLOC(
bool, num_feat*num_vec);
100 for(int32_t i = 0;i < num_vec;i++)
102 for(int32_t j = 0;j < num_feat;j++)
103 matrix[i*num_feat+j] = byte_matrix[i*num_feat+j] != 0 ? 1 : 0;
111 uint8_t * byte_matrix =
SG_MALLOC(uint8_t, num_feat*num_vec);
112 for(int32_t i = 0;i < num_vec;i++)
114 for(int32_t j = 0;j < num_feat;j++)
115 byte_matrix[i*num_feat+j] = matrix[i*num_feat+j] != 0 ? 1 : 0;
125 int32_t& max_string_len)
130 ASSERT(num_str>0 && max_string_len>0);
133 for(int32_t i = 0;i < num_str;i++)
137 for(int32_t j = 0;j < strs[i].
slen;j++)
138 strings[i].
string[j] = strs[i].
string[j] != 0 ? 1 : 0;
141 for(int32_t i = 0;i < num_str;i++)
150 for(int32_t i = 0;i < num_str;i++)
154 for(int32_t j = 0;j < strings[i].
slen;j++)
155 strs[i].
string[j] = strings[i].
string[j] != 0 ? 1 : 0;
160 for(int32_t i = 0;i < num_str;i++)
183 FILE* tmpf=fopen(fname,
"r");
185 fseek(tmpf,0,SEEK_END);
190 size_t total=fread(result,1,len,tmpf);