39 const char* description) {
41 add_type(&type, param, name, description);
46 const char* description) {
48 add_type(&type, param, name, description);
53 const char* description) {
55 add_type(&type, param, name, description);
60 const char* description) {
62 add_type(&type, param, name, description);
67 const char* description) {
69 add_type(&type, param, name, description);
74 const char* description) {
76 add_type(&type, param, name, description);
81 const char* description) {
83 add_type(&type, param, name, description);
88 const char* description) {
90 add_type(&type, param, name, description);
95 const char* description) {
97 add_type(&type, param, name, description);
102 const char* description) {
104 add_type(&type, param, name, description);
109 const char* description) {
111 add_type(&type, param, name, description);
116 const char* description) {
118 add_type(&type, param, name, description);
123 const char* description) {
125 add_type(&type, param, name, description);
130 const char* description) {
131 TSGDataType type(CT_SCALAR, ST_NONE, PT_COMPLEX128);
132 add_type(&type, param, name, description);
137 const char* name,
const char* description) {
139 add_type(&type, param, name, description);
144 const char* description) {
146 add_type(&type, param, name, description);
151 const char* description) {
153 add_type(&type, param, name, description);
158 const char* description) {
160 add_type(&type, param, name, description);
165 const char* description) {
167 add_type(&type, param, name, description);
172 const char* description) {
174 add_type(&type, param, name, description);
179 const char* description) {
181 add_type(&type, param, name, description);
186 const char* description) {
188 add_type(&type, param, name, description);
193 const char* description) {
195 add_type(&type, param, name, description);
200 const char* description) {
202 add_type(&type, param, name, description);
207 const char* description) {
209 add_type(&type, param, name, description);
214 const char* description) {
215 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOAT32);
216 add_type(&type, param, name, description);
221 const char* description) {
222 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOAT64);
223 add_type(&type, param, name, description);
228 const char* description) {
229 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOATMAX);
230 add_type(&type, param, name, description);
235 const char* description) {
237 add_type(&type, param, name, description);
242 const char* description) {
244 add_type(&type, param, name, description);
249 const char* description) {
251 add_type(&type, param, name, description);
256 const char* description) {
258 add_type(&type, param, name, description);
263 const char* description) {
265 add_type(&type, param, name, description);
270 const char* description) {
272 add_type(&type, param, name, description);
277 const char* description) {
279 add_type(&type, param, name, description);
284 const char* description) {
286 add_type(&type, param, name, description);
291 const char* description) {
293 add_type(&type, param, name, description);
298 const char* description) {
300 add_type(&type, param, name, description);
305 const char* description) {
306 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOAT32);
307 add_type(&type, param, name, description);
312 const char* description) {
313 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOAT64);
314 add_type(&type, param, name, description);
319 const char* description) {
320 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOATMAX);
321 add_type(&type, param, name, description);
326 const char* description) {
327 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_COMPLEX128);
328 add_type(&type, param, name, description);
336 bool** param,
index_t* length,
const char* name,
337 const char* description) {
338 TSGDataType type(CT_VECTOR, ST_NONE, PT_BOOL, length);
339 add_type(&type, param, name, description);
344 char** param,
index_t* length,
const char* name,
345 const char* description) {
346 TSGDataType type(CT_VECTOR, ST_NONE, PT_CHAR, length);
347 add_type(&type, param, name, description);
352 int8_t** param,
index_t* length,
const char* name,
353 const char* description) {
354 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT8, length);
355 add_type(&type, param, name, description);
360 uint8_t** param,
index_t* length,
const char* name,
361 const char* description) {
362 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT8, length);
363 add_type(&type, param, name, description);
368 int16_t** param,
index_t* length,
const char* name,
369 const char* description) {
370 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT16, length);
371 add_type(&type, param, name, description);
376 uint16_t** param,
index_t* length,
const char* name,
377 const char* description) {
378 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT16, length);
379 add_type(&type, param, name, description);
384 int32_t** param,
index_t* length,
const char* name,
385 const char* description) {
386 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT32, length);
387 add_type(&type, param, name, description);
392 uint32_t** param,
index_t* length,
const char* name,
393 const char* description) {
394 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT32, length);
395 add_type(&type, param, name, description);
400 int64_t** param,
index_t* length,
const char* name,
401 const char* description) {
402 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT64, length);
403 add_type(&type, param, name, description);
408 uint64_t** param,
index_t* length,
const char* name,
409 const char* description) {
410 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT64, length);
411 add_type(&type, param, name, description);
417 const char* description) {
418 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOAT32, length);
419 add_type(&type, param, name, description);
425 const char* description) {
426 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOAT64, length);
427 add_type(&type, param, name, description);
433 const char* description) {
434 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOATMAX, length);
435 add_type(&type, param, name, description);
441 const char* description) {
442 TSGDataType type(CT_VECTOR, ST_NONE, PT_COMPLEX128, length);
443 add_type(&type, param, name, description);
448 const char* name,
const char* description) {
451 add_type(&type, param, name, description);
456 const char* name,
const char* description) {
457 TSGDataType type(CT_VECTOR, ST_STRING, PT_BOOL, length);
458 add_type(&type, param, name, description);
463 const char* name,
const char* description) {
464 TSGDataType type(CT_VECTOR, ST_STRING, PT_CHAR, length);
465 add_type(&type, param, name, description);
470 const char* name,
const char* description) {
471 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT8, length);
472 add_type(&type, param, name, description);
477 const char* name,
const char* description) {
478 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT8, length);
479 add_type(&type, param, name, description);
484 const char* name,
const char* description) {
485 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT16, length);
486 add_type(&type, param, name, description);
491 const char* name,
const char* description) {
492 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT16, length);
493 add_type(&type, param, name, description);
498 const char* name,
const char* description) {
499 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT32, length);
500 add_type(&type, param, name, description);
505 const char* name,
const char* description) {
506 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT32, length);
507 add_type(&type, param, name, description);
512 const char* name,
const char* description) {
513 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT64, length);
514 add_type(&type, param, name, description);
519 const char* name,
const char* description) {
520 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT64, length);
521 add_type(&type, param, name, description);
526 const char* name,
const char* description) {
527 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOAT32, length);
528 add_type(&type, param, name, description);
533 const char* name,
const char* description) {
534 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOAT64, length);
535 add_type(&type, param, name, description);
540 const char* name,
const char* description) {
541 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOATMAX, length);
542 add_type(&type, param, name, description);
547 const char* name,
const char* description) {
548 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_BOOL, length);
549 add_type(&type, param, name, description);
554 const char* name,
const char* description) {
555 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_CHAR, length);
556 add_type(&type, param, name, description);
561 const char* name,
const char* description) {
562 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT8, length);
563 add_type(&type, param, name, description);
568 const char* name,
const char* description) {
569 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT8, length);
570 add_type(&type, param, name, description);
575 const char* name,
const char* description) {
576 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT16, length);
577 add_type(&type, param, name, description);
582 const char* name,
const char* description) {
583 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT16, length);
584 add_type(&type, param, name, description);
589 const char* name,
const char* description) {
590 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT32, length);
591 add_type(&type, param, name, description);
596 const char* name,
const char* description) {
597 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT32, length);
598 add_type(&type, param, name, description);
603 const char* name,
const char* description) {
604 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT64, length);
605 add_type(&type, param, name, description);
610 const char* name,
const char* description) {
611 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT64, length);
612 add_type(&type, param, name, description);
617 const char* name,
const char* description) {
618 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOAT32, length);
619 add_type(&type, param, name, description);
624 const char* name,
const char* description) {
625 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOAT64, length);
626 add_type(&type, param, name, description);
631 const char* name,
const char* description) {
632 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOATMAX, length);
633 add_type(&type, param, name, description);
638 const char* name,
const char* description) {
639 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_COMPLEX128, length);
640 add_type(&type, param, name, description);
647 const char* description)
654 const char* description)
661 const char* description)
668 const char* description)
675 const char* description)
682 const char* description)
689 const char* description)
696 const char* description)
703 const char* description)
710 const char* description)
717 const char* description)
724 const char* description)
731 const char* description)
738 const char* description)
745 const char* description)
752 const char* description)
754 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_BOOL, ¶m->vlen);
755 add_type(&type, ¶m->vector, name, description);
759 const char* description)
761 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_CHAR, ¶m->vlen);
762 add_type(&type, ¶m->vector, name, description);
766 const char* name,
const char* description)
768 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT8, ¶m->vlen);
769 add_type(&type, ¶m->vector, name, description);
773 const char* name,
const char* description)
775 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT8, ¶m->vlen);
776 add_type(&type, ¶m->vector, name, description);
780 const char* name,
const char* description)
782 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT16, ¶m->vlen);
783 add_type(&type, ¶m->vector, name, description);
787 const char* name,
const char* description)
789 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT16, ¶m->vlen);
790 add_type(&type, ¶m->vector, name, description);
794 const char* name,
const char* description)
796 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT32, ¶m->vlen);
797 add_type(&type, ¶m->vector, name, description);
801 const char* name,
const char* description)
803 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT32, ¶m->vlen);
804 add_type(&type, ¶m->vector, name, description);
808 const char* name,
const char* description)
810 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT64, ¶m->vlen);
811 add_type(&type, ¶m->vector, name, description);
815 const char* name,
const char* description)
817 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT64, ¶m->vlen);
818 add_type(&type, ¶m->vector, name, description);
822 const char* name,
const char* description)
824 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOAT32, ¶m->vlen);
825 add_type(&type, ¶m->vector, name, description);
829 const char* name,
const char* description)
831 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOAT64, ¶m->vlen);
832 add_type(&type, ¶m->vector, name, description);
836 const char* name,
const char* description)
838 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOATMAX, ¶m->vlen);
839 add_type(&type, ¶m->vector, name, description);
843 const char* name,
const char* description)
845 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_BOOL, ¶m->vlen);
846 add_type(&type, ¶m->vector, name, description);
850 const char* name,
const char* description)
852 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_CHAR, ¶m->vlen);
853 add_type(&type, ¶m->vector, name, description);
857 const char* name,
const char* description)
859 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT8, ¶m->vlen);
860 add_type(&type, ¶m->vector, name, description);
864 const char* name,
const char* description)
866 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT8, ¶m->vlen);
867 add_type(&type, ¶m->vector, name, description);
871 const char* name,
const char* description)
873 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT16, ¶m->vlen);
874 add_type(&type, ¶m->vector, name, description);
878 const char* name,
const char* description)
880 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT16, ¶m->vlen);
881 add_type(&type, ¶m->vector, name, description);
885 const char* name,
const char* description)
887 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT32, ¶m->vlen);
888 add_type(&type, ¶m->vector, name, description);
892 const char* name,
const char* description)
894 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT32, ¶m->vlen);
895 add_type(&type, ¶m->vector, name, description);
899 const char* name,
const char* description)
901 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT64, ¶m->vlen);
902 add_type(&type, ¶m->vector, name, description);
906 const char* name,
const char* description)
908 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT64, ¶m->vlen);
909 add_type(&type, ¶m->vector, name, description);
913 const char* name,
const char* description)
915 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOAT32, ¶m->vlen);
916 add_type(&type, ¶m->vector, name, description);
920 const char* name,
const char* description)
922 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOAT64, ¶m->vlen);
923 add_type(&type, ¶m->vector, name, description);
927 const char* name,
const char* description)
929 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOATMAX, ¶m->vlen);
930 add_type(&type, ¶m->vector, name, description);
934 const char* name,
const char* description)
936 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_COMPLEX128, ¶m->vlen);
937 add_type(&type, ¶m->vector, name, description);
946 const char* name,
const char* description) {
947 TSGDataType type(CT_MATRIX, ST_NONE, PT_BOOL, length_y,
949 add_type(&type, param, name, description);
955 const char* name,
const char* description) {
956 TSGDataType type(CT_MATRIX, ST_NONE, PT_CHAR, length_y,
958 add_type(&type, param, name, description);
964 const char* name,
const char* description) {
965 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT8, length_y,
967 add_type(&type, param, name, description);
973 const char* name,
const char* description) {
974 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT8, length_y,
976 add_type(&type, param, name, description);
982 const char* name,
const char* description) {
983 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT16, length_y,
985 add_type(&type, param, name, description);
991 const char* name,
const char* description) {
992 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT16, length_y,
994 add_type(&type, param, name, description);
1000 const char* name,
const char* description) {
1001 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT32, length_y,
1003 add_type(&type, param, name, description);
1009 const char* name,
const char* description) {
1010 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT32, length_y,
1012 add_type(&type, param, name, description);
1018 const char* name,
const char* description) {
1019 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT64, length_y,
1021 add_type(&type, param, name, description);
1027 const char* name,
const char* description) {
1028 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT64, length_y,
1030 add_type(&type, param, name, description);
1036 const char* name,
const char* description) {
1037 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOAT32, length_y,
1039 add_type(&type, param, name, description);
1045 const char* name,
const char* description) {
1046 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOAT64, length_y,
1048 add_type(&type, param, name, description);
1054 const char* name,
const char* description) {
1055 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOATMAX, length_y,
1057 add_type(&type, param, name, description);
1063 const char* name,
const char* description) {
1064 TSGDataType type(CT_MATRIX, ST_NONE, PT_COMPLEX128, length_y,
1066 add_type(&type, param, name, description);
1072 const char* name,
const char* description) {
1074 length_y, length_x);
1075 add_type(&type, param, name, description);
1081 const char* name,
const char* description) {
1082 TSGDataType type(CT_MATRIX, ST_STRING, PT_BOOL, length_y,
1084 add_type(&type, param, name, description);
1090 const char* name,
const char* description) {
1091 TSGDataType type(CT_MATRIX, ST_STRING, PT_CHAR, length_y,
1093 add_type(&type, param, name, description);
1099 const char* name,
const char* description) {
1100 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT8, length_y,
1102 add_type(&type, param, name, description);
1108 const char* name,
const char* description) {
1109 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT8, length_y,
1111 add_type(&type, param, name, description);
1117 const char* name,
const char* description) {
1118 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT16, length_y,
1120 add_type(&type, param, name, description);
1126 const char* name,
const char* description) {
1127 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT16, length_y,
1129 add_type(&type, param, name, description);
1135 const char* name,
const char* description) {
1136 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT32, length_y,
1138 add_type(&type, param, name, description);
1144 const char* name,
const char* description) {
1145 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT32, length_y,
1147 add_type(&type, param, name, description);
1153 const char* name,
const char* description) {
1154 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT64, length_y,
1156 add_type(&type, param, name, description);
1162 const char* name,
const char* description) {
1163 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT64, length_y,
1165 add_type(&type, param, name, description);
1171 const char* name,
const char* description) {
1172 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOAT32, length_y,
1174 add_type(&type, param, name, description);
1180 const char* name,
const char* description) {
1181 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOAT64, length_y,
1183 add_type(&type, param, name, description);
1189 const char* name,
const char* description) {
1190 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOATMAX, length_y,
1192 add_type(&type, param, name, description);
1198 const char* name,
const char* description) {
1199 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_BOOL, length_y,
1201 add_type(&type, param, name, description);
1207 const char* name,
const char* description) {
1208 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_CHAR, length_y,
1210 add_type(&type, param, name, description);
1216 const char* name,
const char* description) {
1217 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT8, length_y,
1219 add_type(&type, param, name, description);
1225 const char* name,
const char* description) {
1226 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT8, length_y,
1228 add_type(&type, param, name, description);
1234 const char* name,
const char* description) {
1235 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT16, length_y,
1237 add_type(&type, param, name, description);
1243 const char* name,
const char* description) {
1244 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT16, length_y,
1246 add_type(&type, param, name, description);
1252 const char* name,
const char* description) {
1253 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT32, length_y,
1255 add_type(&type, param, name, description);
1261 const char* name,
const char* description) {
1262 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT32, length_y,
1264 add_type(&type, param, name, description);
1270 const char* name,
const char* description) {
1271 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT64, length_y,
1273 add_type(&type, param, name, description);
1279 const char* name,
const char* description) {
1280 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT64, length_y,
1282 add_type(&type, param, name, description);
1288 const char* name,
const char* description) {
1289 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOAT32, length_y,
1291 add_type(&type, param, name, description);
1297 const char* name,
const char* description) {
1298 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOAT64, length_y,
1300 add_type(&type, param, name, description);
1306 const char* name,
const char* description) {
1307 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOATMAX, length_y,
1309 add_type(&type, param, name, description);
1315 const char* name,
const char* description) {
1316 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_COMPLEX128, length_y,
1318 add_type(&type, param, name, description);
1325 const char* description)
1333 const char* description)
1341 const char* description)
1349 const char* description)
1357 const char* description)
1365 const char* description)
1373 const char* description)
1381 const char* description)
1389 const char* description)
1397 const char* description)
1405 const char* description)
1413 const char* description)
1421 const char* description)
1429 const char* description)
1437 const char* description)
1445 const char* description)
1447 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_BOOL, ¶m->num_rows,
1449 add_type(&type, ¶m->matrix, name, description);
1453 const char* description)
1455 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_CHAR, ¶m->num_rows,
1457 add_type(&type, ¶m->matrix, name, description);
1461 const char* name,
const char* description)
1463 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT8, ¶m->num_rows,
1465 add_type(&type, ¶m->matrix, name, description);
1469 const char* name,
const char* description)
1471 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT8, ¶m->num_rows,
1473 add_type(&type, ¶m->matrix, name, description);
1477 const char* name,
const char* description)
1479 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT16, ¶m->num_rows,
1481 add_type(&type, ¶m->matrix, name, description);
1485 const char* name,
const char* description)
1487 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT16, ¶m->num_rows,
1489 add_type(&type, ¶m->matrix, name, description);
1493 const char* name,
const char* description)
1495 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT32, ¶m->num_rows,
1497 add_type(&type, ¶m->matrix, name, description);
1501 const char* name,
const char* description)
1503 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT32, ¶m->num_rows,
1505 add_type(&type, ¶m->matrix, name, description);
1509 const char* name,
const char* description)
1511 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT64, ¶m->num_rows,
1513 add_type(&type, ¶m->matrix, name, description);
1517 const char* name,
const char* description)
1519 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT64, ¶m->num_rows,
1521 add_type(&type, ¶m->matrix, name, description);
1525 const char* name,
const char* description)
1527 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOAT32, ¶m->num_rows,
1529 add_type(&type, ¶m->matrix, name, description);
1533 const char* name,
const char* description)
1535 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOAT64, ¶m->num_rows,
1537 add_type(&type, ¶m->matrix, name, description);
1541 const char* name,
const char* description)
1543 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOATMAX, ¶m->num_rows,
1545 add_type(&type, ¶m->matrix, name, description);
1549 const char* name,
const char* description)
1551 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_BOOL, ¶m->num_rows,
1553 add_type(&type, ¶m->matrix, name, description);
1557 const char* name,
const char* description)
1559 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_CHAR, ¶m->num_rows,
1561 add_type(&type, ¶m->matrix, name, description);
1565 const char* name,
const char* description)
1567 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT8, ¶m->num_rows,
1569 add_type(&type, ¶m->matrix, name, description);
1573 const char* name,
const char* description)
1575 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT8, ¶m->num_rows,
1577 add_type(&type, ¶m->matrix, name, description);
1581 const char* name,
const char* description)
1583 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT16, ¶m->num_rows,
1585 add_type(&type, ¶m->matrix, name, description);
1589 const char* name,
const char* description)
1591 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT16, ¶m->num_rows,
1593 add_type(&type, ¶m->matrix, name, description);
1597 const char* name,
const char* description)
1599 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT32, ¶m->num_rows,
1601 add_type(&type, ¶m->matrix, name, description);
1605 const char* name,
const char* description)
1607 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT32, ¶m->num_rows,
1609 add_type(&type, ¶m->matrix, name, description);
1613 const char* name,
const char* description)
1615 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT64, ¶m->num_rows,
1617 add_type(&type, ¶m->matrix, name, description);
1621 const char* name,
const char* description)
1623 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT64, ¶m->num_rows,
1625 add_type(&type, ¶m->matrix, name, description);
1629 const char* name,
const char* description)
1631 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOAT32, ¶m->num_rows,
1633 add_type(&type, ¶m->matrix, name, description);
1637 const char* name,
const char* description)
1639 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOAT64, ¶m->num_rows,
1641 add_type(&type, ¶m->matrix, name, description);
1645 const char* name,
const char* description)
1647 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOATMAX, ¶m->num_rows,
1649 add_type(&type, ¶m->matrix, name, description);
1653 const char* name,
const char* description)
1655 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_COMPLEX128, ¶m->num_rows,
1657 add_type(&type, ¶m->matrix, name, description);
1661 const char* name,
const char* description)
1669 const char* name,
const char* description)
1677 const char* name,
const char* description)
1685 const char* name,
const char* description)
1693 const char* name,
const char* description)
1701 const char* name,
const char* description)
1709 const char* name,
const char* description)
1717 const char* name,
const char* description)
1725 const char* name,
const char* description)
1733 const char* name,
const char* description)
1741 const char* name,
const char* description)
1749 const char* name,
const char* description)
1757 const char* name,
const char* description)
1765 const char* name,
const char* description)
1773 const char* name,
const char* description)
1784 const char* name,
const char* description)
1785 :m_datatype(*datatype)
1788 m_name = get_strdup(name);
1799 TParameter::new_prefix(
const char* s1,
const char* s2)
1801 char* tmp = SG_MALLOC(
char, strlen(s1)+strlen(s2)+2);
1803 sprintf(tmp,
"%s%s/", s1, s2);
1822 char* p = new_prefix(prefix,
m_name);
1829 TParameter::delete_cont()
1837 case CT_MATRIX:
case CT_SGMATRIX:
1839 case CT_SCALAR:
case CT_VECTOR:
case CT_SGVECTOR:
break;
1840 case CT_UNDEFINED:
default:
1841 SG_SERROR(
"Implementation error: undefined container type\n");
1851 SG_FREE(*(
char**) m_parameter);
break;
1853 SG_FREE(*(int8_t**) m_parameter);
break;
1855 SG_FREE(*(uint8_t**) m_parameter);
break;
1857 SG_FREE(*(int16_t**) m_parameter);
break;
1859 SG_FREE(*(uint16_t**) m_parameter);
break;
1861 SG_FREE(*(int32_t**) m_parameter);
break;
1863 SG_FREE(*(uint32_t**) m_parameter);
break;
1865 SG_FREE(*(int64_t**) m_parameter);
break;
1867 SG_FREE(*(uint64_t**) m_parameter);
break;
1869 SG_FREE(*(
float32_t**) m_parameter);
break;
1871 SG_FREE(*(
float64_t**) m_parameter);
break;
1880 for (
index_t i=0; i<old_length; i++)
1886 case PT_UNDEFINED:
default:
1887 SG_SERROR(
"Implementation error: undefined primitive type\n");
1893 for (
index_t i=0; i<old_length; i++) {
1929 SG_SERROR(
"TParameter::delete_cont(): Parameters of strings" 1930 " of complex128_t are not supported");
1933 SG_SERROR(
"TParameter::delete_cont(): Implementation " 1934 "error: Could not delete " 1935 "String<SGSerializable*>");
1937 case PT_UNDEFINED:
default:
1938 SG_SERROR(
"Implementation error: undefined primitive type\n");
1943 for (
index_t i=0; i<old_length; i++) {
1979 SG_SERROR(
"TParameter::delete_cont(): Implementation " 1980 "error: Could not delete " 1981 "Sparse<SGSerializable*>");
1983 case PT_UNDEFINED:
default:
1984 SG_SERROR(
"Implementation error: undefined primitive type\n");
1988 case ST_UNDEFINED:
default:
1989 SG_SERROR(
"Implementation error: undefined structure type\n");
2000 char* s=SG_MALLOC(
char, 200);
2002 SG_SDEBUG(
"entering TParameter::new_cont for \"%s\" of type %s\n",
2008 if (new_length == 0)
return;
2015 = SG_MALLOC(
bool, new_length);
break;
2018 = SG_MALLOC(
char, new_length);
break;
2021 = SG_MALLOC(int8_t, new_length);
break;
2024 = SG_MALLOC(uint8_t, new_length);
break;
2027 = SG_MALLOC(int16_t, new_length);
break;
2030 = SG_MALLOC(uint16_t, new_length);
break;
2033 = SG_MALLOC(int32_t, new_length);
break;
2036 = SG_MALLOC(uint32_t, new_length);
break;
2039 = SG_MALLOC(int64_t, new_length);
break;
2042 = SG_MALLOC(uint64_t, new_length);
break;
2045 = SG_MALLOC(
float32_t, new_length);
break;
2048 = SG_MALLOC(
float64_t, new_length);
break;
2059 case PT_UNDEFINED:
default:
2060 SG_SERROR(
"Implementation error: undefined primitive type\n");
2106 SG_SERROR(
"TParameter::new_cont(): Implementation " 2107 "error: Could not allocate " 2108 "String<complex128>");
2111 SG_SERROR(
"TParameter::new_cont(): Implementation " 2112 "error: Could not allocate " 2113 "String<SGSerializable*>");
2115 case PT_UNDEFINED:
default:
2116 SG_SERROR(
"Implementation error: undefined primitive type\n");
2168 SG_SERROR(
"TParameter::new_cont(): Implementation " 2169 "error: Could not allocate " 2170 "Sparse<SGSerializable*>");
2172 case PT_UNDEFINED:
default:
2173 SG_SERROR(
"Implementation error: undefined primitive type\n");
2177 case ST_UNDEFINED:
default:
2178 SG_SERROR(
"Implementation error: undefined structure type\n");
2182 s=SG_MALLOC(
char, 200);
2184 SG_SDEBUG(
"leaving TParameter::new_cont for \"%s\" of type %s\n",
2185 s, m_name ? m_name :
"(nil)");
2190 TParameter::new_sgserial(
CSGObject** param,
2191 EPrimitiveType
generic,
2192 const char* sgserializable_name,
2200 if (*param == NULL) {
2211 "Class `C%s%s' was not listed during compiling Shogun" 2212 " :( ... Can not construct it for `%s%s'!",
2213 sgserializable_name, buf, prefix,
m_name);
2227 const char* sgserial_name =
"";
2231 sgserial_name = (*(
CSGObject**) param)->get_name();
2232 (*(
CSGObject**) param)->is_generic(&
generic);
2235 if (!file->write_sgserializable_begin(
2238 if (*sgserial_name !=
'\0') {
2239 char* p = new_prefix(prefix,
m_name);
2241 ->save_serializable(file, p);
2243 if (!result)
return false;
2245 if (!file->write_sgserializable_end(
2250 param))
return false;
2263 if (!file->read_sgserializable_begin(
2266 if (*sgserial_name !=
'\0') {
2267 if (!new_sgserial((
CSGObject**) param,
generic,
2268 sgserial_name, prefix))
2271 char* p = new_prefix(prefix,
m_name);
2273 ->load_serializable(file, p);
2275 if (!result)
return false;
2277 if (!file->read_sgserializable_end(
2282 param))
return false;
2297 if (!save_ptype(file, param, prefix))
return false;
2300 len_real = str_ptr->
slen;
2301 if (str_ptr->
string == NULL && len_real != 0) {
2302 SG_SWARNING(
"Inconsistency between data structure and " 2303 "len during saving string `%s%s'! Continuing" 2308 if (!file->write_string_begin(
2310 for (
index_t i=0; i<len_real; i++) {
2311 if (!file->write_stringentry_begin(
2313 if (!save_ptype(file, (
char*) str_ptr->
string 2316 if (!file->write_stringentry_end(
2319 if (!file->write_string_end(
2324 if (spr_ptr->
features == NULL && len_real != 0) {
2325 SG_SWARNING(
"Inconsistency between data structure and " 2326 "len during saving sparse `%s%s'! Continuing" 2331 if (!file->write_sparse_begin(
2333 for (
index_t i=0; i<len_real; i++) {
2337 if (!file->write_sparseentry_begin(
2342 prefix))
return false;
2343 if (!file->write_sparseentry_end(
2347 if (!file->write_sparse_end(
2350 case ST_UNDEFINED:
default:
2351 SG_SERROR(
"Implementation error: undefined structure type\n");
2368 if (!load_ptype(file, param, prefix))
return false;
2371 if (!file->read_string_begin(
2374 str_ptr->
string = len_real > 0
2376 for (
index_t i=0; i<len_real; i++) {
2377 if (!file->read_stringentry_begin(
2379 if (!load_ptype(file, (
char*) str_ptr->
string 2382 if (!file->read_stringentry_end(
2385 if (!file->read_string_end(
2388 str_ptr->
slen = len_real;
2391 if (!file->read_sparse_begin(
2396 for (
index_t i=0; i<len_real; i++) {
2400 if (!file->read_sparseentry_begin(
2405 prefix))
return false;
2406 if (!file->read_sparseentry_end(
2416 case ST_UNDEFINED:
default:
2417 SG_SERROR(
"Implementation error: undefined structure type\n");
2425 uint32_t& hash, uint32_t& carry, uint32_t& total_length)
2437 total_length += size;
2439 &hash, &carry, data, size);
2442 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2444 index_t len_real_y = 0, len_real_x = 0;
2452 if (*(
void**)
m_parameter == NULL && len_real_y != 0)
2454 SG_SWARNING(
"Inconsistency between data structure and " 2455 "len_y during hashing `%s'! Continuing with " 2466 case CT_VECTOR:
case CT_SGVECTOR:
2469 case CT_MATRIX:
case CT_SGMATRIX:
2472 if (*(
void**)
m_parameter == NULL && len_real_x != 0)
2474 SG_SWARNING(
"Inconsistency between data structure and " 2475 "len_x during hashing %s'! Continuing " 2481 if (len_real_x *len_real_y == 0)
2482 len_real_x = len_real_y = 0;
2486 case CT_SCALAR:
break;
2487 case CT_UNDEFINED:
default:
2488 SG_SERROR(
"Implementation error: undefined container type\n");
2493 total_length += size;
2498 &hash, &carry, data, size);
2501 case CT_UNDEFINED:
default:
2502 SG_SERROR(
"Implementation error: undefined container type\n");
2516 const int32_t buflen=100;
2517 char* buf=SG_MALLOC(
char, buflen);
2530 if (!save_stype(file,
m_parameter, prefix))
return false;
2532 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2534 index_t len_real_y = 0, len_real_x = 0;
2537 if (*(
void**)
m_parameter == NULL && len_real_y != 0) {
2538 SG_SWARNING(
"Inconsistency between data structure and " 2539 "len_y during saving `%s%s'! Continuing with " 2549 case CT_VECTOR:
case CT_SGVECTOR:
2552 case CT_MATRIX:
case CT_SGMATRIX:
2554 if (*(
void**)
m_parameter == NULL && len_real_x != 0) {
2555 SG_SWARNING(
"Inconsistency between data structure and " 2556 "len_x during saving `%s%s'! Continuing " 2562 if (len_real_x *len_real_y == 0)
2563 len_real_x = len_real_y = 0;
2566 case CT_SCALAR:
break;
2567 case CT_UNDEFINED:
default:
2568 SG_SERROR(
"Implementation error: undefined container type\n");
2573 len_real_y, len_real_x))
2578 for (
index_t x=0; x<len_real_x; x++)
2579 for (
index_t y=0; y<len_real_y; y++) {
2580 if (!file->write_item_begin(
2587 prefix))
return false;
2588 if (!file->write_item_end(
2596 len_real_y, len_real_x))
2601 case CT_UNDEFINED:
default:
2602 SG_SERROR(
"Implementation error: undefined container type\n");
2615 REQUIRE(file != NULL,
"Serializable file object should be != NULL\n");
2617 const int32_t buflen=100;
2618 char* buf=SG_MALLOC(
char, buflen);
2636 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2650 case CT_VECTOR:
case CT_SGVECTOR:
2654 case CT_MATRIX:
case CT_SGMATRIX:
2659 case CT_UNDEFINED:
default:
2660 SG_SERROR(
"Implementation error: undefined container type\n");
2664 for (
index_t x=0; x<dims[0]; x++)
2666 for (
index_t y=0; y<dims[1]; y++)
2668 if (!file->read_item_begin(
2675 prefix))
return false;
2676 if (!file->read_item_end(
2687 case CT_VECTOR:
case CT_SGVECTOR:
2690 case CT_MATRIX:
case CT_SGMATRIX:
2696 case CT_UNDEFINED:
default:
2697 SG_SERROR(
"Implementation error: undefined container type\n");
2707 case CT_UNDEFINED:
default:
2708 SG_SERROR(
"Implementation error: undefined container type\n");
2737 const char* name,
const char* description)
2739 if (name == NULL || *name ==
'\0')
2740 SG_SERROR(
"FATAL: Parameter::add_type(): `name' is empty!\n")
2742 for (
size_t i=0; i<strlen(name); ++i)
2744 if (!std::isalnum(name[i]) && name[i]!=
'_' && name[i]!=
'.')
2746 SG_SERROR(
"Character %d of parameter with name \"%s\" is illegal " 2747 "(only alnum or underscore is allowed)\n",
2753 if (strcmp(
m_params.get_element(i)->m_name, name) == 0)
2754 SG_SERROR(
"FATAL: Parameter::add_type(): " 2755 "Double parameter `%s'!\n", name);
2758 new TParameter(type, param, name, description)
2766 m_params.get_element(i)->print(prefix);
2774 if (!
m_params.get_element(i)->save(file, prefix))
2785 if (!
m_params.get_element(i)->load(file, prefix))
2806 if (!strcmp(own->m_name, current->
m_name))
2808 if (own->m_datatype==current_type)
2816 char* given_type=SG_MALLOC(
char, l);
2817 char* own_type=SG_MALLOC(
char, l);
2819 own->m_datatype.to_string(own_type, l);
2820 SG_SERROR(
"given parameter \"%s\" has a different type (%s)" 2821 " than existing one (%s)\n", current->
m_name,
2822 given_type, own_type);
2823 SG_FREE(given_type);
2833 SG_SERROR(
"parameter with name %s does not exist\n",
2838 if (current_type.
m_ptype==PT_SGOBJECT)
2841 if (own->m_datatype.m_stype==ST_NONE)
2843 if (own->m_datatype.m_ctype==CT_SCALAR)
2848 if ((*to_ref)!=(*to_unref))
2861 for (
index_t j=0; j<own->m_datatype.get_num_elements(); ++j)
2863 if ((*to_ref)[j]!=(*to_unref)[j])
2872 SG_SERROR(
"primitive type PT_SGOBJECT occurred with structure " 2873 "type other than ST_NONE");
2879 if (current_type.
m_ctype==CT_SCALAR)
2882 dest=own->m_parameter;
2888 if (own->m_datatype.m_ptype==PT_SGOBJECT)
2903 switch (own->m_datatype.m_ptype)
2921 sg_memcpy(dest, source, own->m_datatype.get_size());
2939 if (!strcmp(name,
m_params[i]->m_name))
2949 result&=!strcmp(m_name, other.
m_name);
2955 return strcmp(m_name, other.
m_name)<0;
2960 return strcmp(m_name, other.
m_name)>0;
2965 SG_SDEBUG(
"entering TParameter::equals()\n");
2969 SG_SDEBUG(
"leaving TParameter::equals(): other parameter is NULL\n");
2973 if (strcmp(m_name, other->
m_name))
2975 SG_SDEBUG(
"leaving TParameter::equals(): name \"%s\" is different from" 2976 " other parameter's name \"%s\"\n", m_name, other->
m_name);
2983 SG_SDEBUG(
"leaving TParameter::equals(): type of \"%s\" is different " 2984 "from other parameter's \"%s\" type\n", m_name, other->
m_name);
2991 SG_SDEBUG(
"leaving TParameter::equals(): both parameters are NULL\n");
2997 SG_SDEBUG(
"leaving TParameter::equals(): param1 is at %p while " 2998 "param2 is at %p\n", m_parameter, other->
m_parameter);
3003 switch (m_datatype.m_ctype)
3009 m_datatype.m_ptype, m_parameter,
3011 accuracy, tolerant))
3013 SG_SDEBUG(
"leaving TParameter::equals(): scalar data differs\n");
3018 case CT_VECTOR:
case CT_SGVECTOR:
3020 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
3024 SG_SDEBUG(
"length_y: %d\n", *m_datatype.m_length_y)
3025 for (
index_t i=0; i<*m_datatype.m_length_y; ++i)
3027 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3030 void* pointer_a=&((*(
char**)m_parameter)[x]);
3031 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3034 m_datatype.m_ptype, pointer_a, pointer_b,
3035 accuracy, tolerant))
3037 SG_SDEBUG(
"leaving TParameter::equals(): vector element " 3042 x=x+(m_datatype.sizeof_stype());
3047 case CT_MATRIX:
case CT_SGMATRIX:
3049 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
3053 SG_SDEBUG(
"length_y: %d\n", *m_datatype.m_length_y)
3054 SG_SDEBUG(
"length_x: %d\n", *m_datatype.m_length_x)
3061 if (m_datatype.m_stype==ST_SPARSE)
3062 length=(*m_datatype.m_length_y);
3064 length=(*m_datatype.m_length_y) * (*m_datatype.m_length_x);
3066 for (
index_t i=0; i<length; ++i)
3068 SG_SDEBUG(
"comparing element %d which is %d bytes from start\n",
3071 void* pointer_a=&((*(
char**)m_parameter)[x]);
3072 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3075 m_datatype.m_ptype, pointer_a, pointer_b,
3076 accuracy, tolerant))
3078 SG_SDEBUG(
"leaving TParameter::equals(): vector element " 3084 if (m_datatype.m_stype==ST_SPARSE)
3085 x=x+(m_datatype.sizeof_stype());
3087 x=x+(m_datatype.sizeof_stype());
3095 SG_SERROR(
"TParameter::equals(): Not yet implemented for " 3099 case CT_UNDEFINED:
default:
3100 SG_SERROR(
"Implementation error: undefined container type\n");
3104 SG_SDEBUG(
"leaving TParameter::equals(): Parameters are equal\n");
3111 SG_SDEBUG(
"entering TParameter::compare_ptype()\n");
3113 if ((data1 && !data2) || (!data1 && data2))
3115 SG_SINFO(
"leaving TParameter::compare_ptype(): data1 is at %p while " 3116 "data2 is at %p\n", data1, data2);
3121 if (!data1 && !data2)
3123 SG_SDEBUG(
"leaving TParameter::compare_ptype(): both data are NULL\n");
3131 bool casted1=*((
bool*)data1);
3132 bool casted2=*((
bool*)data2);
3136 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_BOOL: " 3137 "data1=%d, data2=%d\n", casted1, casted2);
3144 char casted1=*((
char*)data1);
3145 char casted2=*((
char*)data2);
3149 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_CHAR: " 3150 "data1=%c, data2=%c\n", casted1, casted2);
3157 int8_t casted1=*((int8_t*)data1);
3158 int8_t casted2=*((int8_t*)data2);
3162 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT8: " 3163 "data1=%d, data2=%d\n", casted1, casted2);
3170 uint8_t casted1=*((uint8_t*)data1);
3171 uint8_t casted2=*((uint8_t*)data2);
3175 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT8: " 3176 "data1=%d, data2=%d\n", casted1, casted2);
3183 int16_t casted1=*((int16_t*)data1);
3184 int16_t casted2=*((int16_t*)data2);
3188 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT16: " 3189 "data1=%d, data2=%d\n", casted1, casted2);
3196 uint16_t casted1=*((uint16_t*)data1);
3197 uint16_t casted2=*((uint16_t*)data2);
3201 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT16: " 3202 "data1=%d, data2=%d\n", casted1, casted2);
3209 int32_t casted1=*((int32_t*)data1);
3210 int32_t casted2=*((int32_t*)data2);
3214 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT32: " 3215 "data1=%d, data2=%d\n", casted1, casted2);
3222 uint32_t casted1=*((uint32_t*)data1);
3223 uint32_t casted2=*((uint32_t*)data2);
3227 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT32: " 3228 "data1=%d, data2=%d\n", casted1, casted2);
3235 int64_t casted1=*((int64_t*)data1);
3236 int64_t casted2=*((int64_t*)data2);
3240 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_INT64: " 3241 "data1=%d, data2=%d\n", casted1, casted2);
3248 uint64_t casted1=*((uint64_t*)data1);
3249 uint64_t casted2=*((uint64_t*)data2);
3253 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_UINT64: " 3254 "data1=%d, data2=%d\n", casted1, casted2);
3264 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT32: " 3265 "data1=%f, data2=%f\n", casted1, casted2);
3267 return CMath::fequals<float32_t>(casted1, casted2, accuracy, tolerant);
3275 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOAT64: " 3276 "data1=%f, data2=%f\n", casted1, casted2);
3278 return CMath::fequals<float64_t>(casted1, casted2, accuracy, tolerant);
3286 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_FLOATMAX: " 3287 "data1=%f, data2=%f\n", casted1, casted2);
3289 return CMath::fequals<floatmax_t>(casted1, casted2, accuracy, tolerant);
3298 if (
CMath::abs(casted1_real-casted2_real)>accuracy ||
3299 CMath::abs(casted1_imag-casted2_imag)>accuracy)
3301 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_COMPLEX128: " 3302 "data1=%f+i%f, data2=%f+i%f\n",
3303 casted1_real, casted1_imag,
3304 casted2_real, casted2_imag);
3315 if (!casted1 && ! casted2)
3317 SG_SDEBUG(
"leaving TParameter::compare_ptype(): SGObjects are equal\n");
3324 if (!(casted1->
equals(casted2, accuracy)))
3326 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT " 3327 "equals returned false\n");
3333 if (!(casted2->
equals(casted1, accuracy)))
3335 SG_SINFO(
"leaving TParameter::compare_ptype(): PT_SGOBJECT " 3336 "equals returned false\n");
3344 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive" 3345 "-type: %d\n", ptype);
3349 SG_SDEBUG(
"leaving TParameter::compare_ptype(): Data are equal\n");
3355 SG_SDEBUG(
"entering TParameter::copy_ptype()\n");
3364 *((
bool*)target)=*((
bool*)source);
3365 SG_SDEBUG(
"after copy of ptype PT_BOOL: source %d, target %d\n",
3366 *((
bool*)source), *((
bool*)target));
3371 *((
char*)target)=*((
char*)source);
3372 SG_SDEBUG(
"after copy of ptype PT_CHAR: source %c, target %c\n",
3373 *((
char*)source), *((
char*)target));
3378 *((int8_t*)target)=*((int8_t*)source);
3379 SG_SDEBUG(
"after copy of ptype PT_INT8: source %d, target %d\n",
3380 *((int8_t*)source), *((int8_t*)target));
3385 *((uint8_t*)target)=*((uint8_t*)source);
3386 SG_SDEBUG(
"after copy of ptype PT_UINT8: source %d, target %d\n",
3387 *((uint8_t*)source), *((uint8_t*)target));
3392 *((int16_t*)target)=*((int16_t*)source);
3393 SG_SDEBUG(
"after copy of ptype PT_INT16: source %d, target %d\n",
3394 *((int16_t*)source), *((int16_t*)target));
3399 *((uint16_t*)target)=*((uint16_t*)source);
3400 SG_SDEBUG(
"after copy of ptype PT_UINT16: source %d, target %d\n",
3401 *((uint16_t*)source), *((uint16_t*)target));
3406 *((int32_t*)target)=*((int32_t*)source);
3407 SG_SDEBUG(
"after copy of ptype PT_INT32: source %d, target %d\n",
3408 *((int32_t*)source), *((int32_t*)target));
3413 *((uint32_t*)target)=*((uint32_t*)source);
3414 SG_SDEBUG(
"after copy of ptype PT_UINT32: source %d, target %d\n",
3415 *((uint32_t*)source), *((uint32_t*)target));
3420 *((int64_t*)target)=*((int64_t*)source);
3421 SG_SDEBUG(
"after copy of ptype PT_INT64: source %d, target %d\n",
3422 *((int64_t*)source), *((int64_t*)target));
3427 *((uint64_t*)target)=*((uint64_t*)source);
3428 SG_SDEBUG(
"after copy of ptype PT_UINT64: source %d, target %d\n",
3429 *((uint64_t*)source), *((uint64_t*)target));
3435 SG_SDEBUG(
"after copy of ptype PT_FLOAT32: source %f, target %f\n",
3442 SG_SDEBUG(
"after copy of ptype PT_FLOAT64: source %f, target %f\n",
3449 SG_SDEBUG(
"after copy of ptype PT_FLOATMAX: source %Lf, target %Lf\n",
3456 SG_SDEBUG(
"after copy of ptype PT_COMPLEX128: " 3457 "source real %f, target real %f," 3458 "source imag %f, target imag %f," 3470 if (!casted1 && ! casted2)
3472 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Both SGObjects are NULL\n");
3487 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive" 3488 "-type: %d\n", ptype);
3493 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Copy successful\n");
3498 void* data1,
void* data2,
float64_t accuracy,
bool tolerant)
3500 SG_SDEBUG(
"entering TParameter::compare_stype()\n");
3505 if (!data1 && !data2)
3507 SG_SDEBUG(
"leaving TParameter::compare_stype(): both data are NULL\n");
3512 if ((data1 && !data2) || (!data1 && data2))
3514 SG_SINFO(
"leaving TParameter::compare_stype(): data1 is at %p while " 3515 "data2 is at %p\n", data1, data2);
3535 SG_SINFO(
"leaving TParameter::compare_stype(): Length of " 3536 "sparse vector1 (%d) is different of vector 2 (%d)\n",
3541 SG_SDEBUG(
"Comparing sparse vectors\n");
3544 SG_SDEBUG(
"Comparing sparse entry %d at offset %d\n", i,
3559 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3560 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3563 pointer2, accuracy, tolerant))
3565 SG_SINFO(
"leaving TParameter::compare_stype(): Data of" 3566 " sparse vector element is different\n");
3573 SG_SINFO(
"leaving TParameter::compare_stype(): Feature " 3574 "index of sparse vector element is different. " 3575 "source: %d, target: %d\n",
3588 if (str_ptr1->
slen != str_ptr2->
slen)
3590 SG_SINFO(
"leaving TParameter::compare_stype(): Length of " 3591 "string1 (%d) is different of string2 (%d)\n",
3599 SG_SDEBUG(
"Comparing string element %d at offset %d\n", i,
3601 void* pointer1=str_ptr1->
string+i*size_ptype;
3602 void* pointer2=str_ptr2->
string+i*size_ptype;
3605 pointer2, accuracy, tolerant))
3607 SG_SINFO(
"leaving TParameter::compare_stype(): Data of" 3608 " string element is different\n");
3616 SG_SERROR(
"TParameter::compare_stype(): Undefined struct type\n");
3621 SG_SDEBUG(
"leaving TParameter::compare_stype(): Data were equal\n");
3626 void* source,
void* target)
3628 SG_SDEBUG(
"entering TParameter::copy_stype()\n");
3656 if (source_ptr->
slen != target_ptr->
slen)
3658 SG_SDEBUG(
"string lengths different (source: %d vs target: %d)," 3659 " freeing memory.\n", source_ptr->
slen, target_ptr->
slen);
3662 SG_FREE(target_ptr->
string);
3670 size_t num_bytes=source_ptr->
slen * size_ptype;
3672 SG_SDEBUG(
"target string data NULL, allocating %d bytes.\n",
3674 target_ptr->
string=SG_MALLOC(
char, num_bytes);
3681 SG_SDEBUG(
"Copying string element %d at offset %d\n", i,
3683 void* pointer1=source_ptr->
string+i*size_ptype;
3684 void* pointer2=target_ptr->
string+i*size_ptype;
3688 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of string" 3689 " element failed.\n");
3703 SG_SDEBUG(
"sparse vector lengths different (source: %d vs target: %d)," 3704 " freeing memory.\n",
3719 SG_SDEBUG(
"target sparse data NULL, allocating %d bytes.\n",
3728 SG_SDEBUG(
"Copying sparse entry %d at offset %d\n", i,
3743 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3744 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3748 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of sparse" 3749 " vector element failed\n");
3761 SG_SERROR(
"TParameter::copy_stype(): Undefined struct type\n");
3767 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy successful\n");
3773 SG_SDEBUG(
"entering TParameter::copy()\n");
3777 SG_SDEBUG(
"leaving TParameter::copy(): other parameter is NULL\n");
3783 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of source is NULL\n");
3789 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of target is NULL\n");
3793 if (strcmp(m_name, target->
m_name))
3795 SG_SDEBUG(
"leaving TParameter::copy(): name \"%s\" is different from" 3796 " target parameter's " 3797 "name \"%s\"\n", m_name, target->
m_name);
3801 SG_SDEBUG(
"Comparing datatypes without length\n");
3802 if (!(m_datatype.equals_without_length(target->
m_datatype)))
3804 SG_SDEBUG(
"leaving TParameter::copy(): type of \"%s\" is different " 3805 "from target parameter's \"%s\" type\n", m_name, target->
m_name);
3809 switch (m_datatype.m_ctype)
3815 m_datatype.m_ptype, m_parameter,
3818 SG_SDEBUG(
"leaving TParameter::copy(): scalar data copy error\n");
3823 case CT_VECTOR:
case CT_SGVECTOR:
3825 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
3830 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
3839 if (*(
char**)target->
m_parameter==NULL && *m_datatype.m_length_y>0)
3841 size_t num_bytes=*m_datatype.m_length_y * m_datatype.sizeof_stype();
3842 SG_SDEBUG(
"allocating %d bytes memory for target vector\n", num_bytes);
3844 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
3847 if (m_datatype.m_ptype==PT_SGOBJECT || m_datatype.m_stype==ST_STRING)
3848 memset(*(
void**)target->
m_parameter, 0, num_bytes);
3860 SG_SDEBUG(
"length_y: %d\n", *m_datatype.m_length_y)
3861 for (
index_t i=0; i<*m_datatype.m_length_y; ++i)
3863 SG_SDEBUG(
"copying element %d which is %d bytes from start\n",
3866 void* pointer_a=&((*(
char**)m_parameter)[x]);
3867 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
3870 m_datatype.m_ptype, pointer_a, pointer_b))
3872 SG_SDEBUG(
"leaving TParameter::copy(): vector element " 3877 x=x+(m_datatype.sizeof_stype());
3882 case CT_MATRIX:
case CT_SGMATRIX:
3884 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
3889 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
3898 SG_SDEBUG(
"allocating memory for target vector\n");
3901 if (m_datatype.m_stype==ST_SPARSE)
3902 num_bytes=*m_datatype.m_length_y * m_datatype.sizeof_stype();
3904 num_bytes=*m_datatype.m_length_y *
3905 (*m_datatype.m_length_x) * m_datatype.sizeof_stype();
3907 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
3911 if (m_datatype.m_ptype==PT_SGOBJECT)
3912 memset(*(
void**)target->
m_parameter, 0, num_bytes);
3918 SG_SDEBUG(
"%d bytes are allocated\n", num_bytes);
3927 SG_SDEBUG(
"length_y: %d\n", *m_datatype.m_length_y)
3928 SG_SDEBUG(
"length_x: %d\n", *m_datatype.m_length_x)
3931 if (m_datatype.m_stype==ST_SPARSE)
3932 length=(*m_datatype.m_length_y);
3934 length=(*m_datatype.m_length_y) * (*m_datatype.m_length_x);
3935 for (
index_t i=0; i<length; ++i)
3937 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
3940 void* pointer_a=&((*(
char**)m_parameter)[x]);
3941 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
3944 m_datatype.m_ptype, pointer_a, pointer_b))
3946 SG_SDEBUG(
"leaving TParameter::copy(): vector element " 3952 if (m_datatype.m_stype==ST_SPARSE)
3953 x=x+(m_datatype.sizeof_stype());
3955 x=x+(m_datatype.sizeof_ptype());
3963 SG_SERROR(
"TParameter::copy(): Not yet implemented for " 3967 case CT_UNDEFINED:
default:
3968 SG_SERROR(
"Implementation error: undefined container type\n");
3972 SG_SDEBUG(
"leaving TParameter::copy(): Copy successful\n");
template class SGSparseMatrix
bool operator==(const TParameter &other) const
std::complex< float64_t > complex128_t
bool operator>(const TParameter &other) const
virtual int32_t get_num_parameters()
virtual CSGObject * clone()
static size_t offset_sparseentry(EPrimitiveType ptype)
TParameter * get_parameter(int32_t idx)
SGSparseVector< T > * sparse_matrix
array of sparse vectors of size num_vectors
int64_t get_num_elements()
static bool compare_stype(EStructType stype, EPrimitiveType ptype, void *data1, void *data2, float64_t accuracy=0.0, bool tolerant=false)
virtual void print(const char *prefix="")
#define SG_SNOTIMPLEMENTED
static void ptype_to_string(char *dest, EPrimitiveType ptype, size_t n)
index_t num_vectors
total number of vectors
size_t sizeof_stype() const
Datatypes that shogun supports.
virtual bool load(CSerializableFile *file, const char *prefix="")
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry<T>* vector is orde...
bool equals(TParameter *other, float64_t accuracy=0.0, bool tolerant=false)
virtual void add_type(const TSGDataType *type, void *param, const char *name, const char *description)
bool save(CSerializableFile *file, const char *prefix="")
TParameter(const TSGDataType *datatype, void *parameter, const char *name, const char *description)
void add(bool *param, const char *name, const char *description="")
CSGObject * new_sgserializable(const char *sgserializable_name, EPrimitiveType generic)
DynArray< TParameter * > m_params
static bool compare_ptype(EPrimitiveType ptype, void *data1, void *data2, float64_t accuracy=0.0, bool tolerant=false)
Class SGObject is the base class of all shogun objects.
size_t sizeof_ptype() const
static T product(T *vec, int32_t len)
Return the product of the vectors elements.
virtual bool save(CSerializableFile *file, const char *prefix="")
index_t num_features
total number of features
bool operator<(const TParameter &other) const
void print(const char *prefix)
static bool copy_ptype(EPrimitiveType ptype, void *source, void *target)
void get_incremental_hash(uint32_t &hash, uint32_t &carry, uint32_t &total_length)
virtual bool equals(CSGObject *other, float64_t accuracy=0.0, bool tolerant=false)
void set_from_parameters(Parameter *params)
bool contains_parameter(const char *name)
void add_vector(bool **param, index_t *length, const char *name, const char *description="")
static void IncrementalMurmurHash3(uint32_t *hash, uint32_t *carry, uint8_t *data, int32_t len)
all of classes and functions are contained in the shogun namespace
bool load(CSerializableFile *file, const char *prefix="")
template class SGSparseVectorEntry
void add_parameters(Parameter *params)
bool copy(TParameter *target)
char string_t[STRING_LEN]
void add_matrix(bool **param, index_t *length_y, index_t *length_x, const char *name, const char *description="")
static size_t sizeof_sparseentry(EPrimitiveType ptype)
void to_string(char *dest, size_t n) const
static bool copy_stype(EStructType stype, EPrimitiveType ptype, void *source, void *target)
SGSparseVectorEntry< T > * features