20 using namespace shogun;
28 const char* description) {
30 add_type(&type, param, name, description);
35 const char* description) {
37 add_type(&type, param, name, description);
42 const char* description) {
44 add_type(&type, param, name, description);
49 const char* description) {
51 add_type(&type, param, name, description);
56 const char* description) {
58 add_type(&type, param, name, description);
63 const char* description) {
65 add_type(&type, param, name, description);
70 const char* description) {
72 add_type(&type, param, name, description);
77 const char* description) {
79 add_type(&type, param, name, description);
84 const char* description) {
86 add_type(&type, param, name, description);
91 const char* description) {
93 add_type(&type, param, name, description);
98 const char* description) {
100 add_type(&type, param, name, description);
105 const char* description) {
107 add_type(&type, param, name, description);
112 const char* description) {
114 add_type(&type, param, name, description);
119 const char* description) {
120 TSGDataType type(CT_SCALAR, ST_NONE, PT_COMPLEX128);
121 add_type(&type, param, name, description);
126 const char* name,
const char* description) {
128 add_type(&type, param, name, description);
133 const char* description) {
135 add_type(&type, param, name, description);
140 const char* description) {
142 add_type(&type, param, name, description);
147 const char* description) {
149 add_type(&type, param, name, description);
154 const char* description) {
156 add_type(&type, param, name, description);
161 const char* description) {
163 add_type(&type, param, name, description);
168 const char* description) {
170 add_type(&type, param, name, description);
175 const char* description) {
177 add_type(&type, param, name, description);
182 const char* description) {
184 add_type(&type, param, name, description);
189 const char* description) {
191 add_type(&type, param, name, description);
196 const char* description) {
198 add_type(&type, param, name, description);
203 const char* description) {
204 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOAT32);
205 add_type(&type, param, name, description);
210 const char* description) {
211 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOAT64);
212 add_type(&type, param, name, description);
217 const char* description) {
218 TSGDataType type(CT_SCALAR, ST_STRING, PT_FLOATMAX);
219 add_type(&type, param, name, description);
224 const char* description) {
226 add_type(&type, param, name, description);
231 const char* description) {
233 add_type(&type, param, name, description);
238 const char* description) {
240 add_type(&type, param, name, description);
245 const char* description) {
247 add_type(&type, param, name, description);
252 const char* description) {
254 add_type(&type, param, name, description);
259 const char* description) {
261 add_type(&type, param, name, description);
266 const char* description) {
268 add_type(&type, param, name, description);
273 const char* description) {
275 add_type(&type, param, name, description);
280 const char* description) {
282 add_type(&type, param, name, description);
287 const char* description) {
289 add_type(&type, param, name, description);
294 const char* description) {
295 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOAT32);
296 add_type(&type, param, name, description);
301 const char* description) {
302 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOAT64);
303 add_type(&type, param, name, description);
308 const char* description) {
309 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_FLOATMAX);
310 add_type(&type, param, name, description);
315 const char* description) {
316 TSGDataType type(CT_SCALAR, ST_SPARSE, PT_COMPLEX128);
317 add_type(&type, param, name, description);
325 bool** param,
index_t* length,
const char* name,
326 const char* description) {
327 TSGDataType type(CT_VECTOR, ST_NONE, PT_BOOL, length);
328 add_type(&type, param, name, description);
333 char** param,
index_t* length,
const char* name,
334 const char* description) {
335 TSGDataType type(CT_VECTOR, ST_NONE, PT_CHAR, length);
336 add_type(&type, param, name, description);
341 int8_t** param,
index_t* length,
const char* name,
342 const char* description) {
343 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT8, length);
344 add_type(&type, param, name, description);
349 uint8_t** param,
index_t* length,
const char* name,
350 const char* description) {
351 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT8, length);
352 add_type(&type, param, name, description);
357 int16_t** param,
index_t* length,
const char* name,
358 const char* description) {
359 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT16, length);
360 add_type(&type, param, name, description);
365 uint16_t** param,
index_t* length,
const char* name,
366 const char* description) {
367 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT16, length);
368 add_type(&type, param, name, description);
373 int32_t** param,
index_t* length,
const char* name,
374 const char* description) {
375 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT32, length);
376 add_type(&type, param, name, description);
381 uint32_t** param,
index_t* length,
const char* name,
382 const char* description) {
383 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT32, length);
384 add_type(&type, param, name, description);
389 int64_t** param,
index_t* length,
const char* name,
390 const char* description) {
391 TSGDataType type(CT_VECTOR, ST_NONE, PT_INT64, length);
392 add_type(&type, param, name, description);
397 uint64_t** param,
index_t* length,
const char* name,
398 const char* description) {
399 TSGDataType type(CT_VECTOR, ST_NONE, PT_UINT64, length);
400 add_type(&type, param, name, description);
406 const char* description) {
407 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOAT32, length);
408 add_type(&type, param, name, description);
414 const char* description) {
415 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOAT64, length);
416 add_type(&type, param, name, description);
422 const char* description) {
423 TSGDataType type(CT_VECTOR, ST_NONE, PT_FLOATMAX, length);
424 add_type(&type, param, name, description);
430 const char* description) {
431 TSGDataType type(CT_VECTOR, ST_NONE, PT_COMPLEX128, length);
432 add_type(&type, param, name, description);
437 const char* name,
const char* description) {
440 add_type(&type, param, name, description);
445 const char* name,
const char* description) {
446 TSGDataType type(CT_VECTOR, ST_STRING, PT_BOOL, length);
447 add_type(&type, param, name, description);
452 const char* name,
const char* description) {
453 TSGDataType type(CT_VECTOR, ST_STRING, PT_CHAR, length);
454 add_type(&type, param, name, description);
459 const char* name,
const char* description) {
460 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT8, length);
461 add_type(&type, param, name, description);
466 const char* name,
const char* description) {
467 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT8, length);
468 add_type(&type, param, name, description);
473 const char* name,
const char* description) {
474 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT16, length);
475 add_type(&type, param, name, description);
480 const char* name,
const char* description) {
481 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT16, length);
482 add_type(&type, param, name, description);
487 const char* name,
const char* description) {
488 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT32, length);
489 add_type(&type, param, name, description);
494 const char* name,
const char* description) {
495 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT32, length);
496 add_type(&type, param, name, description);
501 const char* name,
const char* description) {
502 TSGDataType type(CT_VECTOR, ST_STRING, PT_INT64, length);
503 add_type(&type, param, name, description);
508 const char* name,
const char* description) {
509 TSGDataType type(CT_VECTOR, ST_STRING, PT_UINT64, length);
510 add_type(&type, param, name, description);
515 const char* name,
const char* description) {
516 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOAT32, length);
517 add_type(&type, param, name, description);
522 const char* name,
const char* description) {
523 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOAT64, length);
524 add_type(&type, param, name, description);
529 const char* name,
const char* description) {
530 TSGDataType type(CT_VECTOR, ST_STRING, PT_FLOATMAX, length);
531 add_type(&type, param, name, description);
536 const char* name,
const char* description) {
537 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_BOOL, length);
538 add_type(&type, param, name, description);
543 const char* name,
const char* description) {
544 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_CHAR, length);
545 add_type(&type, param, name, description);
550 const char* name,
const char* description) {
551 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT8, length);
552 add_type(&type, param, name, description);
557 const char* name,
const char* description) {
558 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT8, length);
559 add_type(&type, param, name, description);
564 const char* name,
const char* description) {
565 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT16, length);
566 add_type(&type, param, name, description);
571 const char* name,
const char* description) {
572 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT16, length);
573 add_type(&type, param, name, description);
578 const char* name,
const char* description) {
579 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT32, length);
580 add_type(&type, param, name, description);
585 const char* name,
const char* description) {
586 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT32, length);
587 add_type(&type, param, name, description);
592 const char* name,
const char* description) {
593 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_INT64, length);
594 add_type(&type, param, name, description);
599 const char* name,
const char* description) {
600 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_UINT64, length);
601 add_type(&type, param, name, description);
606 const char* name,
const char* description) {
607 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOAT32, length);
608 add_type(&type, param, name, description);
613 const char* name,
const char* description) {
614 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOAT64, length);
615 add_type(&type, param, name, description);
620 const char* name,
const char* description) {
621 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_FLOATMAX, length);
622 add_type(&type, param, name, description);
627 const char* name,
const char* description) {
628 TSGDataType type(CT_VECTOR, ST_SPARSE, PT_COMPLEX128, length);
629 add_type(&type, param, name, description);
636 const char* description)
643 const char* description)
650 const char* description)
657 const char* description)
664 const char* description)
671 const char* description)
678 const char* description)
685 const char* description)
692 const char* description)
699 const char* description)
706 const char* description)
713 const char* description)
720 const char* description)
727 const char* description)
734 const char* description)
741 const char* description)
743 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_BOOL, ¶m->vlen);
744 add_type(&type, ¶m->vector, name, description);
748 const char* description)
750 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_CHAR, ¶m->vlen);
751 add_type(&type, ¶m->vector, name, description);
755 const char* name,
const char* description)
757 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT8, ¶m->vlen);
758 add_type(&type, ¶m->vector, name, description);
762 const char* name,
const char* description)
764 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT8, ¶m->vlen);
765 add_type(&type, ¶m->vector, name, description);
769 const char* name,
const char* description)
771 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT16, ¶m->vlen);
772 add_type(&type, ¶m->vector, name, description);
776 const char* name,
const char* description)
778 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT16, ¶m->vlen);
779 add_type(&type, ¶m->vector, name, description);
783 const char* name,
const char* description)
785 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT32, ¶m->vlen);
786 add_type(&type, ¶m->vector, name, description);
790 const char* name,
const char* description)
792 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT32, ¶m->vlen);
793 add_type(&type, ¶m->vector, name, description);
797 const char* name,
const char* description)
799 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_INT64, ¶m->vlen);
800 add_type(&type, ¶m->vector, name, description);
804 const char* name,
const char* description)
806 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_UINT64, ¶m->vlen);
807 add_type(&type, ¶m->vector, name, description);
811 const char* name,
const char* description)
813 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOAT32, ¶m->vlen);
814 add_type(&type, ¶m->vector, name, description);
818 const char* name,
const char* description)
820 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOAT64, ¶m->vlen);
821 add_type(&type, ¶m->vector, name, description);
825 const char* name,
const char* description)
827 TSGDataType type(CT_SGVECTOR, ST_STRING, PT_FLOATMAX, ¶m->vlen);
828 add_type(&type, ¶m->vector, name, description);
832 const char* name,
const char* description)
834 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_BOOL, ¶m->vlen);
835 add_type(&type, ¶m->vector, name, description);
839 const char* name,
const char* description)
841 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_CHAR, ¶m->vlen);
842 add_type(&type, ¶m->vector, name, description);
846 const char* name,
const char* description)
848 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT8, ¶m->vlen);
849 add_type(&type, ¶m->vector, name, description);
853 const char* name,
const char* description)
855 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT8, ¶m->vlen);
856 add_type(&type, ¶m->vector, name, description);
860 const char* name,
const char* description)
862 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT16, ¶m->vlen);
863 add_type(&type, ¶m->vector, name, description);
867 const char* name,
const char* description)
869 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT16, ¶m->vlen);
870 add_type(&type, ¶m->vector, name, description);
874 const char* name,
const char* description)
876 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT32, ¶m->vlen);
877 add_type(&type, ¶m->vector, name, description);
881 const char* name,
const char* description)
883 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT32, ¶m->vlen);
884 add_type(&type, ¶m->vector, name, description);
888 const char* name,
const char* description)
890 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_INT64, ¶m->vlen);
891 add_type(&type, ¶m->vector, name, description);
895 const char* name,
const char* description)
897 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_UINT64, ¶m->vlen);
898 add_type(&type, ¶m->vector, name, description);
902 const char* name,
const char* description)
904 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOAT32, ¶m->vlen);
905 add_type(&type, ¶m->vector, name, description);
909 const char* name,
const char* description)
911 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOAT64, ¶m->vlen);
912 add_type(&type, ¶m->vector, name, description);
916 const char* name,
const char* description)
918 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_FLOATMAX, ¶m->vlen);
919 add_type(&type, ¶m->vector, name, description);
923 const char* name,
const char* description)
925 TSGDataType type(CT_SGVECTOR, ST_SPARSE, PT_COMPLEX128, ¶m->vlen);
926 add_type(&type, ¶m->vector, name, description);
935 const char* name,
const char* description) {
936 TSGDataType type(CT_MATRIX, ST_NONE, PT_BOOL, length_y,
938 add_type(&type, param, name, description);
944 const char* name,
const char* description) {
945 TSGDataType type(CT_MATRIX, ST_NONE, PT_CHAR, length_y,
947 add_type(&type, param, name, description);
953 const char* name,
const char* description) {
954 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT8, length_y,
956 add_type(&type, param, name, description);
962 const char* name,
const char* description) {
963 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT8, length_y,
965 add_type(&type, param, name, description);
971 const char* name,
const char* description) {
972 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT16, length_y,
974 add_type(&type, param, name, description);
980 const char* name,
const char* description) {
981 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT16, length_y,
983 add_type(&type, param, name, description);
989 const char* name,
const char* description) {
990 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT32, length_y,
992 add_type(&type, param, name, description);
998 const char* name,
const char* description) {
999 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT32, length_y,
1001 add_type(&type, param, name, description);
1007 const char* name,
const char* description) {
1008 TSGDataType type(CT_MATRIX, ST_NONE, PT_INT64, length_y,
1010 add_type(&type, param, name, description);
1016 const char* name,
const char* description) {
1017 TSGDataType type(CT_MATRIX, ST_NONE, PT_UINT64, length_y,
1019 add_type(&type, param, name, description);
1025 const char* name,
const char* description) {
1026 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOAT32, length_y,
1028 add_type(&type, param, name, description);
1034 const char* name,
const char* description) {
1035 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOAT64, length_y,
1037 add_type(&type, param, name, description);
1043 const char* name,
const char* description) {
1044 TSGDataType type(CT_MATRIX, ST_NONE, PT_FLOATMAX, length_y,
1046 add_type(&type, param, name, description);
1052 const char* name,
const char* description) {
1053 TSGDataType type(CT_MATRIX, ST_NONE, PT_COMPLEX128, length_y,
1055 add_type(&type, param, name, description);
1061 const char* name,
const char* description) {
1063 length_y, length_x);
1064 add_type(&type, param, name, description);
1070 const char* name,
const char* description) {
1071 TSGDataType type(CT_MATRIX, ST_STRING, PT_BOOL, length_y,
1073 add_type(&type, param, name, description);
1079 const char* name,
const char* description) {
1080 TSGDataType type(CT_MATRIX, ST_STRING, PT_CHAR, length_y,
1082 add_type(&type, param, name, description);
1088 const char* name,
const char* description) {
1089 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT8, length_y,
1091 add_type(&type, param, name, description);
1097 const char* name,
const char* description) {
1098 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT8, length_y,
1100 add_type(&type, param, name, description);
1106 const char* name,
const char* description) {
1107 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT16, length_y,
1109 add_type(&type, param, name, description);
1115 const char* name,
const char* description) {
1116 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT16, length_y,
1118 add_type(&type, param, name, description);
1124 const char* name,
const char* description) {
1125 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT32, length_y,
1127 add_type(&type, param, name, description);
1133 const char* name,
const char* description) {
1134 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT32, length_y,
1136 add_type(&type, param, name, description);
1142 const char* name,
const char* description) {
1143 TSGDataType type(CT_MATRIX, ST_STRING, PT_INT64, length_y,
1145 add_type(&type, param, name, description);
1151 const char* name,
const char* description) {
1152 TSGDataType type(CT_MATRIX, ST_STRING, PT_UINT64, length_y,
1154 add_type(&type, param, name, description);
1160 const char* name,
const char* description) {
1161 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOAT32, length_y,
1163 add_type(&type, param, name, description);
1169 const char* name,
const char* description) {
1170 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOAT64, length_y,
1172 add_type(&type, param, name, description);
1178 const char* name,
const char* description) {
1179 TSGDataType type(CT_MATRIX, ST_STRING, PT_FLOATMAX, length_y,
1181 add_type(&type, param, name, description);
1187 const char* name,
const char* description) {
1188 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_BOOL, length_y,
1190 add_type(&type, param, name, description);
1196 const char* name,
const char* description) {
1197 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_CHAR, length_y,
1199 add_type(&type, param, name, description);
1205 const char* name,
const char* description) {
1206 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT8, length_y,
1208 add_type(&type, param, name, description);
1214 const char* name,
const char* description) {
1215 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT8, length_y,
1217 add_type(&type, param, name, description);
1223 const char* name,
const char* description) {
1224 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT16, length_y,
1226 add_type(&type, param, name, description);
1232 const char* name,
const char* description) {
1233 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT16, length_y,
1235 add_type(&type, param, name, description);
1241 const char* name,
const char* description) {
1242 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT32, length_y,
1244 add_type(&type, param, name, description);
1250 const char* name,
const char* description) {
1251 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT32, length_y,
1253 add_type(&type, param, name, description);
1259 const char* name,
const char* description) {
1260 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_INT64, length_y,
1262 add_type(&type, param, name, description);
1268 const char* name,
const char* description) {
1269 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_UINT64, length_y,
1271 add_type(&type, param, name, description);
1277 const char* name,
const char* description) {
1278 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOAT32, length_y,
1280 add_type(&type, param, name, description);
1286 const char* name,
const char* description) {
1287 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOAT64, length_y,
1289 add_type(&type, param, name, description);
1295 const char* name,
const char* description) {
1296 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_FLOATMAX, length_y,
1298 add_type(&type, param, name, description);
1304 const char* name,
const char* description) {
1305 TSGDataType type(CT_MATRIX, ST_SPARSE, PT_COMPLEX128, length_y,
1307 add_type(&type, param, name, description);
1314 const char* description)
1322 const char* description)
1330 const char* description)
1338 const char* description)
1346 const char* description)
1354 const char* description)
1362 const char* description)
1370 const char* description)
1378 const char* description)
1386 const char* description)
1394 const char* description)
1402 const char* description)
1410 const char* description)
1418 const char* description)
1426 const char* description)
1434 const char* description)
1436 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_BOOL, ¶m->num_rows,
1438 add_type(&type, ¶m->matrix, name, description);
1442 const char* description)
1444 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_CHAR, ¶m->num_rows,
1446 add_type(&type, ¶m->matrix, name, description);
1450 const char* name,
const char* description)
1452 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT8, ¶m->num_rows,
1454 add_type(&type, ¶m->matrix, name, description);
1458 const char* name,
const char* description)
1460 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT8, ¶m->num_rows,
1462 add_type(&type, ¶m->matrix, name, description);
1466 const char* name,
const char* description)
1468 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT16, ¶m->num_rows,
1470 add_type(&type, ¶m->matrix, name, description);
1474 const char* name,
const char* description)
1476 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT16, ¶m->num_rows,
1478 add_type(&type, ¶m->matrix, name, description);
1482 const char* name,
const char* description)
1484 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT32, ¶m->num_rows,
1486 add_type(&type, ¶m->matrix, name, description);
1490 const char* name,
const char* description)
1492 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT32, ¶m->num_rows,
1494 add_type(&type, ¶m->matrix, name, description);
1498 const char* name,
const char* description)
1500 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_INT64, ¶m->num_rows,
1502 add_type(&type, ¶m->matrix, name, description);
1506 const char* name,
const char* description)
1508 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_UINT64, ¶m->num_rows,
1510 add_type(&type, ¶m->matrix, name, description);
1514 const char* name,
const char* description)
1516 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOAT32, ¶m->num_rows,
1518 add_type(&type, ¶m->matrix, name, description);
1522 const char* name,
const char* description)
1524 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOAT64, ¶m->num_rows,
1526 add_type(&type, ¶m->matrix, name, description);
1530 const char* name,
const char* description)
1532 TSGDataType type(CT_SGMATRIX, ST_STRING, PT_FLOATMAX, ¶m->num_rows,
1534 add_type(&type, ¶m->matrix, name, description);
1538 const char* name,
const char* description)
1540 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_BOOL, ¶m->num_rows,
1542 add_type(&type, ¶m->matrix, name, description);
1546 const char* name,
const char* description)
1548 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_CHAR, ¶m->num_rows,
1550 add_type(&type, ¶m->matrix, name, description);
1554 const char* name,
const char* description)
1556 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT8, ¶m->num_rows,
1558 add_type(&type, ¶m->matrix, name, description);
1562 const char* name,
const char* description)
1564 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT8, ¶m->num_rows,
1566 add_type(&type, ¶m->matrix, name, description);
1570 const char* name,
const char* description)
1572 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT16, ¶m->num_rows,
1574 add_type(&type, ¶m->matrix, name, description);
1578 const char* name,
const char* description)
1580 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT16, ¶m->num_rows,
1582 add_type(&type, ¶m->matrix, name, description);
1586 const char* name,
const char* description)
1588 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT32, ¶m->num_rows,
1590 add_type(&type, ¶m->matrix, name, description);
1594 const char* name,
const char* description)
1596 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT32, ¶m->num_rows,
1598 add_type(&type, ¶m->matrix, name, description);
1602 const char* name,
const char* description)
1604 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_INT64, ¶m->num_rows,
1606 add_type(&type, ¶m->matrix, name, description);
1610 const char* name,
const char* description)
1612 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_UINT64, ¶m->num_rows,
1614 add_type(&type, ¶m->matrix, name, description);
1618 const char* name,
const char* description)
1620 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOAT32, ¶m->num_rows,
1622 add_type(&type, ¶m->matrix, name, description);
1626 const char* name,
const char* description)
1628 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOAT64, ¶m->num_rows,
1630 add_type(&type, ¶m->matrix, name, description);
1634 const char* name,
const char* description)
1636 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_FLOATMAX, ¶m->num_rows,
1638 add_type(&type, ¶m->matrix, name, description);
1642 const char* name,
const char* description)
1644 TSGDataType type(CT_SGMATRIX, ST_SPARSE, PT_COMPLEX128, ¶m->num_rows,
1646 add_type(&type, ¶m->matrix, name, description);
1650 const char* name,
const char* description)
1658 const char* name,
const char* description)
1666 const char* name,
const char* description)
1674 const char* name,
const char* description)
1682 const char* name,
const char* description)
1690 const char* name,
const char* description)
1698 const char* name,
const char* description)
1706 const char* name,
const char* description)
1714 const char* name,
const char* description)
1722 const char* name,
const char* description)
1730 const char* name,
const char* description)
1738 const char* name,
const char* description)
1746 const char* name,
const char* description)
1754 const char* name,
const char* description)
1762 const char* name,
const char* description)
1773 const char* name,
const char* description)
1774 :m_datatype(*datatype)
1777 m_name = get_strdup(name);
1792 SG_SDEBUG(
"deleting from scratch data\n")
1825 TParameter::new_prefix(
const char* s1,
const char* s2)
1827 char* tmp = SG_MALLOC(
char, strlen(s1)+strlen(s2)+2);
1829 sprintf(tmp,
"%s%s/", s1, s2);
1848 char* p = new_prefix(prefix,
m_name);
1855 TParameter::delete_cont()
1863 case CT_MATRIX:
case CT_SGMATRIX:
1865 case CT_SCALAR:
case CT_VECTOR:
case CT_SGVECTOR:
break;
1866 case CT_UNDEFINED:
default:
1867 SG_SERROR(
"Implementation error: undefined container type\n");
1906 for (
index_t i=0; i<old_length; i++)
1912 case PT_UNDEFINED:
default:
1913 SG_SERROR(
"Implementation error: undefined primitive type\n");
1919 for (
index_t i=0; i<old_length; i++) {
1955 SG_SERROR(
"TParameter::delete_cont(): Parameters of strings"
1956 " of complex128_t are not supported");
1959 SG_SERROR(
"TParameter::delete_cont(): Implementation "
1960 "error: Could not delete "
1961 "String<SGSerializable*>");
1963 case PT_UNDEFINED:
default:
1964 SG_SERROR(
"Implementation error: undefined primitive type\n");
1969 for (
index_t i=0; i<old_length; i++) {
2005 SG_SERROR(
"TParameter::delete_cont(): Implementation "
2006 "error: Could not delete "
2007 "Sparse<SGSerializable*>");
2009 case PT_UNDEFINED:
default:
2010 SG_SERROR(
"Implementation error: undefined primitive type\n");
2014 case ST_UNDEFINED:
default:
2015 SG_SERROR(
"Implementation error: undefined structure type\n");
2026 char* s=SG_MALLOC(
char, 200);
2028 SG_SDEBUG(
"entering TParameter::new_cont for \"%s\" of type %s with",
2034 if (new_length == 0)
return;
2041 = SG_MALLOC(
bool, new_length);
break;
2044 = SG_MALLOC(
char, new_length);
break;
2047 = SG_MALLOC(int8_t, new_length);
break;
2050 = SG_MALLOC(uint8_t, new_length);
break;
2053 = SG_MALLOC(int16_t, new_length);
break;
2056 = SG_MALLOC(uint16_t, new_length);
break;
2059 = SG_MALLOC(int32_t, new_length);
break;
2062 = SG_MALLOC(uint32_t, new_length);
break;
2065 = SG_MALLOC(int64_t, new_length);
break;
2068 = SG_MALLOC(uint64_t, new_length);
break;
2071 = SG_MALLOC(
float32_t, new_length);
break;
2074 = SG_MALLOC(
float64_t, new_length);
break;
2085 case PT_UNDEFINED:
default:
2086 SG_SERROR(
"Implementation error: undefined primitive type\n");
2132 SG_SERROR(
"TParameter::new_cont(): Implementation "
2133 "error: Could not allocate "
2134 "String<complex128>");
2137 SG_SERROR(
"TParameter::new_cont(): Implementation "
2138 "error: Could not allocate "
2139 "String<SGSerializable*>");
2141 case PT_UNDEFINED:
default:
2142 SG_SERROR(
"Implementation error: undefined primitive type\n");
2194 SG_SERROR(
"TParameter::new_cont(): Implementation "
2195 "error: Could not allocate "
2196 "Sparse<SGSerializable*>");
2198 case PT_UNDEFINED:
default:
2199 SG_SERROR(
"Implementation error: undefined primitive type\n");
2203 case ST_UNDEFINED:
default:
2204 SG_SERROR(
"Implementation error: undefined structure type\n");
2208 s=SG_MALLOC(
char, 200);
2210 SG_SDEBUG(
"leaving TParameter::new_cont for \"%s\" of type %s\n",
2216 TParameter::new_sgserial(
CSGObject** param,
2217 EPrimitiveType
generic,
2218 const char* sgserializable_name,
2226 if (*param == NULL) {
2237 "Class `C%s%s' was not listed during compiling Shogun"
2238 " :( ... Can not construct it for `%s%s'!",
2239 sgserializable_name, buf, prefix,
m_name);
2253 const char* sgserial_name =
"";
2257 sgserial_name = (*(
CSGObject**) param)->get_name();
2258 (*(
CSGObject**) param)->is_generic(&
generic);
2261 if (!file->write_sgserializable_begin(
2264 if (*sgserial_name !=
'\0') {
2265 char* p = new_prefix(prefix,
m_name);
2267 ->save_serializable(file, p);
2269 if (!result)
return false;
2271 if (!file->write_sgserializable_end(
2276 param))
return false;
2289 if (!file->read_sgserializable_begin(
2292 if (*sgserial_name !=
'\0') {
2293 if (!new_sgserial((
CSGObject**) param,
generic,
2294 sgserial_name, prefix))
2297 char* p = new_prefix(prefix,
m_name);
2299 ->load_serializable(file, p);
2301 if (!result)
return false;
2303 if (!file->read_sgserializable_end(
2308 param))
return false;
2323 if (!save_ptype(file, param, prefix))
return false;
2326 len_real = str_ptr->
slen;
2327 if (str_ptr->
string == NULL && len_real != 0) {
2328 SG_SWARNING(
"Inconsistency between data structure and "
2329 "len during saving string `%s%s'! Continuing"
2334 if (!file->write_string_begin(
2336 for (
index_t i=0; i<len_real; i++) {
2337 if (!file->write_stringentry_begin(
2339 if (!save_ptype(file, (
char*) str_ptr->
string
2342 if (!file->write_stringentry_end(
2345 if (!file->write_string_end(
2350 if (spr_ptr->
features == NULL && len_real != 0) {
2351 SG_SWARNING(
"Inconsistency between data structure and "
2352 "len during saving sparse `%s%s'! Continuing"
2357 if (!file->write_sparse_begin(
2359 for (
index_t i=0; i<len_real; i++) {
2363 if (!file->write_sparseentry_begin(
2368 prefix))
return false;
2369 if (!file->write_sparseentry_end(
2373 if (!file->write_sparse_end(
2376 case ST_UNDEFINED:
default:
2377 SG_SERROR(
"Implementation error: undefined structure type\n");
2394 if (!load_ptype(file, param, prefix))
return false;
2397 if (!file->read_string_begin(
2400 str_ptr->
string = len_real > 0
2402 for (
index_t i=0; i<len_real; i++) {
2403 if (!file->read_stringentry_begin(
2405 if (!load_ptype(file, (
char*) str_ptr->
string
2408 if (!file->read_stringentry_end(
2411 if (!file->read_string_end(
2414 str_ptr->
slen = len_real;
2417 if (!file->read_sparse_begin(
2422 for (
index_t i=0; i<len_real; i++) {
2426 if (!file->read_sparseentry_begin(
2431 prefix))
return false;
2432 if (!file->read_sparseentry_end(
2442 case ST_UNDEFINED:
default:
2443 SG_SERROR(
"Implementation error: undefined structure type\n");
2451 uint32_t& hash, uint32_t& carry, uint32_t& total_length)
2463 total_length += size;
2465 &hash, &carry, data, size);
2468 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2470 index_t len_real_y = 0, len_real_x = 0;
2478 if (*(
void**)
m_parameter == NULL && len_real_y != 0)
2480 SG_SWARNING(
"Inconsistency between data structure and "
2481 "len_y during hashing `%s'! Continuing with "
2492 case CT_VECTOR:
case CT_SGVECTOR:
2495 case CT_MATRIX:
case CT_SGMATRIX:
2498 if (*(
void**)
m_parameter == NULL && len_real_x != 0)
2500 SG_SWARNING(
"Inconsistency between data structure and "
2501 "len_x during hashing %s'! Continuing "
2507 if (len_real_x *len_real_y == 0)
2508 len_real_x = len_real_y = 0;
2512 case CT_SCALAR:
break;
2513 case CT_UNDEFINED:
default:
2514 SG_SERROR(
"Implementation error: undefined container type\n");
2519 total_length += size;
2524 &hash, &carry, data, size);
2527 case CT_UNDEFINED:
default:
2528 SG_SERROR(
"Implementation error: undefined container type\n");
2542 const int32_t buflen=100;
2543 char* buf=SG_MALLOC(
char, buflen);
2556 if (!save_stype(file,
m_parameter, prefix))
return false;
2558 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2560 index_t len_real_y = 0, len_real_x = 0;
2563 if (*(
void**)
m_parameter == NULL && len_real_y != 0) {
2564 SG_SWARNING(
"Inconsistency between data structure and "
2565 "len_y during saving `%s%s'! Continuing with "
2575 case CT_VECTOR:
case CT_SGVECTOR:
2578 case CT_MATRIX:
case CT_SGMATRIX:
2580 if (*(
void**)
m_parameter == NULL && len_real_x != 0) {
2581 SG_SWARNING(
"Inconsistency between data structure and "
2582 "len_x during saving `%s%s'! Continuing "
2588 if (len_real_x *len_real_y == 0)
2589 len_real_x = len_real_y = 0;
2592 case CT_SCALAR:
break;
2593 case CT_UNDEFINED:
default:
2594 SG_SERROR(
"Implementation error: undefined container type\n");
2599 len_real_y, len_real_x))
2604 for (
index_t x=0; x<len_real_x; x++)
2605 for (
index_t y=0; y<len_real_y; y++) {
2606 if (!file->write_item_begin(
2613 prefix))
return false;
2614 if (!file->write_item_end(
2622 len_real_y, len_real_x))
2627 case CT_UNDEFINED:
default:
2628 SG_SERROR(
"Implementation error: undefined container type\n");
2641 const int32_t buflen=100;
2642 char* buf=SG_MALLOC(
char, buflen);
2660 case CT_VECTOR:
case CT_MATRIX:
case CT_SGVECTOR:
case CT_SGMATRIX:
2674 case CT_VECTOR:
case CT_SGVECTOR:
2678 case CT_MATRIX:
case CT_SGMATRIX:
2683 case CT_UNDEFINED:
default:
2684 SG_SERROR(
"Implementation error: undefined container type\n");
2688 for (
index_t x=0; x<dims[0]; x++)
2690 for (
index_t y=0; y<dims[1]; y++)
2692 if (!file->read_item_begin(
2699 prefix))
return false;
2700 if (!file->read_item_end(
2711 case CT_VECTOR:
case CT_SGVECTOR:
2714 case CT_MATRIX:
case CT_SGMATRIX:
2720 case CT_UNDEFINED:
default:
2721 SG_SERROR(
"Implementation error: undefined container type\n");
2731 case CT_UNDEFINED:
default:
2732 SG_SERROR(
"Implementation error: undefined container type\n");
2757 const char* name,
const char* description)
2759 if (name == NULL || *name ==
'\0')
2760 SG_SERROR(
"FATAL: Parameter::add_type(): `name' is empty!\n")
2762 for (
size_t i=0; i<strlen(name); ++i)
2764 if (!std::isalnum(name[i]) && name[i]!=
'_' && name[i]!=
'.')
2766 SG_SERROR(
"Character %d of parameter with name \"%s\" is illegal "
2767 "(only alnum or underscore is allowed)\n",
2774 SG_SERROR(
"FATAL: Parameter::add_type(): "
2775 "Double parameter `%s'!\n", name);
2778 new TParameter(type, param, name, description)
2826 if (!strcmp(own->m_name, current->
m_name))
2828 if (own->m_datatype==current_type)
2836 char* given_type=SG_MALLOC(
char, l);
2837 char* own_type=SG_MALLOC(
char, l);
2839 own->m_datatype.to_string(own_type, l);
2840 SG_SERROR(
"given parameter \"%s\" has a different type (%s)"
2841 " than existing one (%s)\n", current->
m_name,
2842 given_type, own_type);
2843 SG_FREE(given_type);
2853 SG_SERROR(
"parameter with name %s does not exist\n",
2858 if (current_type.
m_ptype==PT_SGOBJECT)
2861 if (own->m_datatype.m_stype==ST_NONE)
2863 if (own->m_datatype.m_ctype==CT_SCALAR)
2868 if ((*to_ref)!=(*to_unref))
2881 for (
index_t j=0; j<own->m_datatype.get_num_elements(); ++j)
2883 if ((*to_ref)[j]!=(*to_unref)[j])
2892 SG_SERROR(
"primitive type PT_SGOBJECT occurred with structure "
2893 "type other than ST_NONE");
2899 if (current_type.
m_ctype==CT_SCALAR)
2902 dest=own->m_parameter;
2908 if (own->m_datatype.m_ptype==PT_SGOBJECT)
2923 switch (own->m_datatype.m_ptype)
2941 memcpy(dest, source, own->m_datatype.get_size());
2959 if (!strcmp(name,
m_params[i]->m_name))
2986 SG_SDEBUG(
"entering TParameter::allocate_data_from_scratch of "
2995 case CT_VECTOR:
case CT_SGVECTOR:
2999 case CT_MATRIX:
case CT_SGMATRIX:
3012 case CT_UNDEFINED:
default:
3013 SG_SERROR(
"Implementation error: undefined container type\n");
3019 SG_SERROR(
"TParameter::allocate_data_from_scratch must not be called "
3020 "when the underlying TParameter instance already has data.\n");
3045 void** data_p=SG_MALLOC(
void*, 1);
3054 *data_p=SG_MALLOC(
void**, 1);
3055 **(
void***)data_p=NULL;
3068 SG_SDEBUG(
"leaving TParameter::allocate_data_from_scratch of "
3089 SG_SDEBUG(
"Copying scalar data of size %d from %p to %p\n",
3109 for (
index_t j=0; j<length; ++j)
3134 SG_SDEBUG(
"entering TParameter::equals()\n");
3138 SG_SDEBUG(
"leaving TParameter::equals(): other parameter is NULL\n");
3144 SG_SDEBUG(
"leaving TParameter::equals(): name \"%s\" is different from"
3145 " other parameter's name \"%s\"\n",
m_name, other->
m_name);
3152 SG_SDEBUG(
"leaving TParameter::equals(): type of \"%s\" is different "
3153 "from other parameter's \"%s\" type\n",
m_name, other->
m_name);
3160 SG_SDEBUG(
"leaving TParameter::equals(): both parameters are NULL\n");
3166 SG_SDEBUG(
"leaving TParameter::equals(): param1 is at %p while "
3182 SG_SDEBUG(
"leaving TParameter::equals(): scalar data differes\n");
3187 case CT_VECTOR:
case CT_SGVECTOR:
3189 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
3196 SG_SDEBUG(
"comparing element %d which is %d byes from start\n",
3200 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3205 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3215 case CT_MATRIX:
case CT_SGMATRIX:
3217 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
3234 for (
index_t i=0; i<length; ++i)
3236 SG_SDEBUG(
"comparing element %d which is %d byes from start\n",
3240 void* pointer_b=&((*(
char**)other->
m_parameter)[x]);
3245 SG_SDEBUG(
"leaving TParameter::equals(): vector element "
3262 SG_SERROR(
"TParameter::equals(): Not yet implemented for "
3266 case CT_UNDEFINED:
default:
3267 SG_SERROR(
"Implementation error: undefined container type\n");
3271 SG_SDEBUG(
"leaving TParameter::equals(): Parameters are equal\n");
3278 SG_SDEBUG(
"entering TParameter::compare_ptype()\n");
3280 if ((data1 && !data2) || (!data1 && data2))
3282 SG_SDEBUG(
"leaving TParameter::compare_ptype(): data1 is at %p while "
3283 "data2 is at %p\n", data1, data2);
3288 if (!data1 && !data2)
3290 SG_SDEBUG(
"leaving TParameter::compare_ptype(): both data are NULL\n");
3298 bool casted1=*((
bool*)data1);
3299 bool casted2=*((
bool*)data2);
3303 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_BOOL: "
3304 "data1=%d, data2=%d\n", casted1, casted2);
3311 char casted1=*((
char*)data1);
3312 char casted2=*((
char*)data2);
3316 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_CHAR: "
3317 "data1=%c, data2=%c\n", casted1, casted2);
3324 int8_t casted1=*((int8_t*)data1);
3325 int8_t casted2=*((int8_t*)data2);
3329 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_INT8: "
3330 "data1=%d, data2=%d\n", casted1, casted2);
3337 uint8_t casted1=*((uint8_t*)data1);
3338 uint8_t casted2=*((uint8_t*)data2);
3342 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_UINT8: "
3343 "data1=%d, data2=%d\n", casted1, casted2);
3350 int16_t casted1=*((int16_t*)data1);
3351 int16_t casted2=*((int16_t*)data2);
3355 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_INT16: "
3356 "data1=%d, data2=%d\n", casted1, casted2);
3363 uint16_t casted1=*((uint16_t*)data1);
3364 uint16_t casted2=*((uint16_t*)data2);
3368 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_UINT16: "
3369 "data1=%d, data2=%d\n", casted1, casted2);
3376 int32_t casted1=*((int32_t*)data1);
3377 int32_t casted2=*((int32_t*)data2);
3381 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_INT32: "
3382 "data1=%d, data2=%d\n", casted1, casted2);
3389 uint32_t casted1=*((uint32_t*)data1);
3390 uint32_t casted2=*((uint32_t*)data2);
3394 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_UINT32: "
3395 "data1=%d, data2=%d\n", casted1, casted2);
3402 int64_t casted1=*((int64_t*)data1);
3403 int64_t casted2=*((int64_t*)data2);
3407 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_INT64: "
3408 "data1=%d, data2=%d\n", casted1, casted2);
3415 uint64_t casted1=*((uint64_t*)data1);
3416 uint64_t casted2=*((uint64_t*)data2);
3420 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_UINT64: "
3421 "data1=%d, data2=%d\n", casted1, casted2);
3433 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_FLOAT32: "
3434 "data1=%f, data2=%f\n", casted1, casted2);
3446 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_FLOAT64: "
3447 "data1=%f, data2=%f\n", casted1, casted2);
3458 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_FLOATMAX: "
3459 "data1=%f, data2=%f\n", casted1, casted2);
3470 if (
CMath::abs(casted1_real-casted2_real)>accuracy ||
3471 CMath::abs(casted1_imag-casted2_imag)>accuracy)
3473 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_COMPLEX128: "
3474 "data1=%f+i%f, data2=%f+i%f\n",
3475 casted1_real, casted1_imag,
3476 casted2_real, casted2_imag);
3487 if (!casted1 && ! casted2)
3489 SG_SDEBUG(
"leaving TParameter::compare_ptype(): SGObjects are equal\n");
3496 if (!(casted1->
equals(casted2, accuracy)))
3498 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3499 "equals returned false\n");
3505 if (!(casted2->
equals(casted1, accuracy)))
3507 SG_SDEBUG(
"leaving TParameter::compare_ptype(): PT_SGOBJECT "
3508 "equals returned false\n");
3516 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3517 "-type: %d\n", ptype);
3521 SG_SDEBUG(
"leaving TParameter::compare_ptype(): Data are equal\n");
3527 SG_SDEBUG(
"entering TParameter::copy_ptype()\n");
3536 *((
bool*)target)=*((
bool*)source);
3537 SG_SDEBUG(
"after copy of ptype PT_BOOL: source %d, target %d\n",
3538 *((
bool*)source), *((
bool*)target));
3543 *((
char*)target)=*((
char*)source);
3544 SG_SDEBUG(
"after copy of ptype PT_CHAR: source %c, target %c\n",
3545 *((
char*)source), *((
char*)target));
3550 *((int8_t*)target)=*((int8_t*)source);
3551 SG_SDEBUG(
"after copy of ptype PT_INT8: source %d, target %d\n",
3552 *((int8_t*)source), *((int8_t*)target));
3557 *((uint8_t*)target)=*((uint8_t*)source);
3558 SG_SDEBUG(
"after copy of ptype PT_UINT8: source %d, target %d\n",
3559 *((uint8_t*)source), *((uint8_t*)target));
3564 *((int16_t*)target)=*((int16_t*)source);
3565 SG_SDEBUG(
"after copy of ptype PT_INT16: source %d, target %d\n",
3566 *((int16_t*)source), *((int16_t*)target));
3571 *((uint16_t*)target)=*((uint16_t*)source);
3572 SG_SDEBUG(
"after copy of ptype PT_UINT16: source %d, target %d\n",
3573 *((uint16_t*)source), *((uint16_t*)target));
3578 *((int32_t*)target)=*((int32_t*)source);
3579 SG_SDEBUG(
"after copy of ptype PT_INT32: source %d, target %d\n",
3580 *((int32_t*)source), *((int32_t*)target));
3585 *((uint32_t*)target)=*((uint32_t*)source);
3586 SG_SDEBUG(
"after copy of ptype PT_UINT32: source %d, target %d\n",
3587 *((uint32_t*)source), *((uint32_t*)target));
3592 *((int64_t*)target)=*((int64_t*)source);
3593 SG_SDEBUG(
"after copy of ptype PT_INT64: source %d, target %d\n",
3594 *((int64_t*)source), *((int64_t*)target));
3599 *((uint64_t*)target)=*((uint64_t*)source);
3600 SG_SDEBUG(
"after copy of ptype PT_UINT64: source %d, target %d\n",
3601 *((uint64_t*)source), *((uint64_t*)target));
3607 SG_SDEBUG(
"after copy of ptype PT_FLOAT32: source %f, target %f\n",
3614 SG_SDEBUG(
"after copy of ptype PT_FLOAT64: source %f, target %f\n",
3621 SG_SDEBUG(
"after copy of ptype PT_FLOATMAX: source %Lf, target %Lf\n",
3628 SG_SDEBUG(
"after copy of ptype PT_COMPLEX128: "
3629 "source real %f, target real %f,"
3630 "source imag %f, target imag %f,"
3642 if (!casted1 && ! casted2)
3644 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Both SGObjects are NULL\n");
3659 SG_SERROR(
"TParameter::compare_ptype(): Encountered unknown primitive"
3660 "-type: %d\n", ptype);
3665 SG_SDEBUG(
"leaving TParameter::copy_ptype(): Copy successful\n");
3670 void* data1,
void* data2,
floatmax_t accuracy)
3672 SG_SDEBUG(
"entering TParameter::compare_stype()\n");
3677 if (!data1 && !data2)
3679 SG_SDEBUG(
"leaving TParameter::compare_stype(): both data are NULL\n");
3684 if ((data1 && !data2) || (!data1 && data2))
3686 SG_SDEBUG(
"leaving TParameter::compare_stype(): data1 is at %p while "
3687 "data2 is at %p\n", data1, data2);
3707 SG_SDEBUG(
"leaving TParameter::compare_stype(): Length of "
3708 "sparse vector1 (%d) is different of vector 2 (%d)\n",
3713 SG_SDEBUG(
"Comparing sparse vectors\n");
3716 SG_SDEBUG(
"Comparing sparse entry %d at offset %d\n", i,
3731 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3732 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3735 pointer2, accuracy))
3737 SG_SDEBUG(
"leaving TParameter::compare_stype(): Data of"
3738 " sparse vector element is different\n");
3745 SG_SDEBUG(
"leaving TParameter::compare_stype(): Feature "
3746 "index of sparse vector element is different. "
3747 "source: %d, target: %d\n",
3760 if (str_ptr1->
slen != str_ptr2->
slen)
3762 SG_SDEBUG(
"leaving TParameter::compare_stype(): Length of "
3763 "string1 (%d) is different of string2 (%d)\n",
3771 SG_SDEBUG(
"Comparing string element %d at offset %d\n", i,
3773 void* pointer1=str_ptr1->
string+i*size_ptype;
3774 void* pointer2=str_ptr2->
string+i*size_ptype;
3777 pointer2, accuracy))
3779 SG_SDEBUG(
"leaving TParameter::compare_stype(): Data of"
3780 " string element is different\n");
3788 SG_SERROR(
"TParameter::compare_stype(): Undefined struct type\n");
3793 SG_SDEBUG(
"leaving TParameter::compare_stype(): Data were equal\n");
3798 void* source,
void* target)
3800 SG_SDEBUG(
"entering TParameter::copy_stype()\n");
3828 if (source_ptr->
slen != target_ptr->
slen)
3830 SG_SDEBUG(
"string lengths different (source: %d vs target: %d),"
3831 " freeing memory.\n", source_ptr->
slen, target_ptr->
slen);
3834 SG_FREE(target_ptr->
string);
3842 size_t num_bytes=source_ptr->
slen * size_ptype;
3844 SG_SDEBUG(
"target string data NULL, allocating %d bytes.\n",
3846 target_ptr->
string=SG_MALLOC(
char, num_bytes);
3853 SG_SDEBUG(
"Copying string element %d at offset %d\n", i,
3855 void* pointer1=source_ptr->
string+i*size_ptype;
3856 void* pointer2=target_ptr->
string+i*size_ptype;
3860 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of string"
3861 " element failed.\n");
3875 SG_SDEBUG(
"sparse vector lengths different (source: %d vs target: %d),"
3876 " freeing memory.\n",
3891 SG_SDEBUG(
"target sparse data NULL, allocating %d bytes.\n",
3900 SG_SDEBUG(
"Copying sparse entry %d at offset %d\n", i,
3915 void* pointer1=&(cur1->
entry)-char_offset+ptype_offset;
3916 void* pointer2=&(cur2->
entry)-char_offset+ptype_offset;
3920 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy of sparse"
3921 " vector element failed\n");
3933 SG_SERROR(
"TParameter::copy_stype(): Undefined struct type\n");
3939 SG_SDEBUG(
"leaving TParameter::copy_stype(): Copy successful\n");
3945 SG_SDEBUG(
"entering TParameter::copy()\n");
3949 SG_SDEBUG(
"leaving TParameter::copy(): other parameter is NULL\n");
3955 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of source is NULL\n");
3961 SG_SDEBUG(
"leaving TParameter::copy(): m_parameter of target is NULL\n");
3967 SG_SDEBUG(
"leaving TParameter::copy(): name \"%s\" is different from"
3968 " target parameter's "
3973 SG_SDEBUG(
"Comparing datatypes without length\n");
3976 SG_SDEBUG(
"leaving TParameter::copy(): type of \"%s\" is different "
3977 "from target parameter's \"%s\" type\n",
m_name, target->
m_name);
3990 SG_SDEBUG(
"leaving TParameter::copy(): scalar data copy error\n");
3995 case CT_VECTOR:
case CT_SGVECTOR:
3997 SG_SDEBUG(
"CT_VECTOR or CT_SGVECTOR\n");
4002 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
4014 SG_SDEBUG(
"allocating %d bytes memory for target vector\n", num_bytes);
4015 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
4030 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
4034 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
4039 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
4049 case CT_MATRIX:
case CT_SGMATRIX:
4051 SG_SDEBUG(
"CT_MATRIX or CT_SGMATRIX\n");
4056 SG_SDEBUG(
"changing size of target vector and freeing memory\n");
4065 SG_SDEBUG(
"allocating memory for target vector\n");
4073 *(
char**)target->
m_parameter=SG_MALLOC(
char, num_bytes);
4094 for (
index_t i=0; i<length; ++i)
4096 SG_SDEBUG(
"copying element %d which is %d byes from start\n",
4100 void* pointer_b=&((*(
char**)target->
m_parameter)[x]);
4105 SG_SDEBUG(
"leaving TParameter::copy(): vector element "
4122 SG_SERROR(
"TParameter::copy(): Not yet implemented for "
4126 case CT_UNDEFINED:
default:
4127 SG_SERROR(
"Implementation error: undefined container type\n");
4131 SG_SDEBUG(
"leaving TParameter::copy(): Copy successful\n");