SHOGUN  6.1.3
base/Parameter.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2010 Soeren Sonnenburg
8  * Written (W) 2011-2013 Heiko Strathmann
9  * Copyright (C) 2010 Berlin Institute of Technology
10  */
11 #ifndef __PARAMETER_H__
12 #define __PARAMETER_H__
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/lib/common.h>
17 #include <shogun/lib/DataType.h>
18 #include <shogun/base/DynArray.h>
19 
20 namespace shogun
21 {
22 
23 class CSGObject;
24 class CSerializableFile;
25 template <class ST> class SGString;
26 template <class T> class SGMatrix;
27 template <class T> class SGSparseMatrix;
28 template <class T> class SGVector;
29 template <class T> class SGSparseVector;
30 
32 struct TParameter
33 {
40  explicit TParameter(const TSGDataType* datatype, void* parameter,
41  const char* name, const char* description);
42 
44  ~TParameter();
45 
49  void print(const char* prefix);
50 
55  bool save(CSerializableFile* file, const char* prefix="");
56 
61  bool load(CSerializableFile* file, const char* prefix="");
62 
71  bool equals(TParameter* other, float64_t accuracy=0.0, bool tolerant=false);
72 
86  static bool compare_ptype(EPrimitiveType ptype, void* data1, void* data2,
87  float64_t accuracy=0.0, bool tolerant=false);
88 
103  static bool compare_stype(EStructType stype, EPrimitiveType ptype,
104  void* data1, void* data2, float64_t accuracy=0.0, bool tolerant=false);
105 
112  static bool copy_ptype(EPrimitiveType ptype, void* source, void* target);
113 
121  static bool copy_stype(EStructType stype, EPrimitiveType ptype,
122  void* source, void* target);
123 
128  bool copy(TParameter* target);
129 
130 
132  bool operator==(const TParameter& other) const;
133 
135  bool operator<(const TParameter& other) const;
136 
138  bool operator>(const TParameter& other) const;
139 
143  void* m_parameter;
145  char* m_name;
148 
158  uint32_t& hash, uint32_t& carry, uint32_t& total_length);
159 
163  bool is_valid();
164 
165 private:
166  char* new_prefix(const char* s1, const char* s2);
167  void delete_cont();
168  void new_cont(SGVector<index_t> dims);
169  bool new_sgserial(CSGObject** param, EPrimitiveType generic,
170  const char* sgserializable_name,
171  const char* prefix);
172  bool save_ptype(CSerializableFile* file, const void* param,
173  const char* prefix);
174  bool load_ptype(CSerializableFile* file, void* param,
175  const char* prefix);
176  bool save_stype(CSerializableFile* file, const void* param,
177  const char* prefix);
178  bool load_stype(CSerializableFile* file, void* param,
179  const char* prefix);
180 
181 };
182 
189 {
190 public:
192  explicit Parameter();
194  virtual ~Parameter();
195 
199  virtual void print(const char* prefix="");
200 
205  virtual bool save(CSerializableFile* file, const char* prefix="");
206 
211  virtual bool load(CSerializableFile* file, const char* prefix="");
212 
216  virtual int32_t get_num_parameters()
217  {
218  return m_params.get_num_elements();
219  }
220 
229  void set_from_parameters(Parameter* params);
230 
236  void add_parameters(Parameter* params);
237 
242  bool contains_parameter(const char* name);
243 
249  inline TParameter* get_parameter(int32_t idx)
250  {
251  return m_params.get_element(idx);
252  }
253 
259  inline TParameter* get_parameter(const char* name)
260  {
261  TParameter* result=NULL;
262 
263  for (index_t i=0; i<m_params.get_num_elements(); ++i)
264  {
265  result=m_params.get_element(i);
266  if (!strcmp(name, result->m_name))
267  break;
268  else
269  result=NULL;
270  }
271 
272  return result;
273  }
274 
275  /* ************************************************************ */
276  /* Scalar wrappers */
277 
283  void add(bool* param, const char* name,
284  const char* description="");
290  void add(char* param, const char* name,
291  const char* description="");
297  void add(int8_t* param, const char* name,
298  const char* description="");
304  void add(uint8_t* param, const char* name,
305  const char* description="");
311  void add(int16_t* param, const char* name,
312  const char* description="");
318  void add(uint16_t* param, const char* name,
319  const char* description="");
325  void add(int32_t* param, const char* name,
326  const char* description="");
332  void add(uint32_t* param, const char* name,
333  const char* description="");
339  void add(int64_t* param, const char* name,
340  const char* description="");
346  void add(uint64_t* param, const char* name,
347  const char* description="");
353  void add(float32_t* param, const char* name,
354  const char* description="");
360  void add(float64_t* param, const char* name,
361  const char* description="");
367  void add(floatmax_t* param, const char* name,
368  const char* description="");
374  void add(complex128_t* param, const char* name,
375  const char* description="");
381  void add(CSGObject** param,
382  const char* name, const char* description="");
388  void add(SGString<bool>* param, const char* name,
389  const char* description="");
395  void add(SGString<char>* param, const char* name,
396  const char* description="");
402  void add(SGString<int8_t>* param, const char* name,
403  const char* description="");
409  void add(SGString<uint8_t>* param, const char* name,
410  const char* description="");
416  void add(SGString<int16_t>* param, const char* name,
417  const char* description="");
423  void add(SGString<uint16_t>* param, const char* name,
424  const char* description="");
430  void add(SGString<int32_t>* param, const char* name,
431  const char* description="");
437  void add(SGString<uint32_t>* param, const char* name,
438  const char* description="");
444  void add(SGString<int64_t>* param, const char* name,
445  const char* description="");
451  void add(SGString<uint64_t>* param, const char* name,
452  const char* description="");
458  void add(SGString<float32_t>* param, const char* name,
459  const char* description="");
465  void add(SGString<float64_t>* param, const char* name,
466  const char* description="");
472  void add(SGString<floatmax_t>* param, const char* name,
473  const char* description="");
479  void add(SGSparseVector<bool>* param, const char* name,
480  const char* description="");
486  void add(SGSparseVector<char>* param, const char* name,
487  const char* description="");
493  void add(SGSparseVector<int8_t>* param, const char* name,
494  const char* description="");
500  void add(SGSparseVector<uint8_t>* param, const char* name,
501  const char* description="");
507  void add(SGSparseVector<int16_t>* param, const char* name,
508  const char* description="");
514  void add(SGSparseVector<uint16_t>* param, const char* name,
515  const char* description="");
521  void add(SGSparseVector<int32_t>* param, const char* name,
522  const char* description="");
528  void add(SGSparseVector<uint32_t>* param, const char* name,
529  const char* description="");
535  void add(SGSparseVector<int64_t>* param, const char* name,
536  const char* description="");
542  void add(SGSparseVector<uint64_t>* param, const char* name,
543  const char* description="");
549  void add(SGSparseVector<float32_t>* param, const char* name,
550  const char* description="");
556  void add(SGSparseVector<float64_t>* param, const char* name,
557  const char* description="");
563  void add(SGSparseVector<floatmax_t>* param, const char* name,
564  const char* description="");
570  void add(SGSparseVector<complex128_t>* param, const char* name,
571  const char* description="");
572 
573  /* ************************************************************ */
574  /* Vector wrappers */
575 
582  void add_vector(bool** param, index_t* length,
583  const char* name, const char* description="");
590  void add_vector(char** param, index_t* length,
591  const char* name, const char* description="");
598  void add_vector(int8_t** param, index_t* length,
599  const char* name, const char* description="");
606  void add_vector(uint8_t** param, index_t* length,
607  const char* name, const char* description="");
614  void add_vector(int16_t** param, index_t* length,
615  const char* name, const char* description="");
622  void add_vector(uint16_t** param, index_t* length,
623  const char* name, const char* description="");
630  void add_vector(int32_t** param, index_t* length,
631  const char* name, const char* description="");
638  void add_vector(uint32_t** param, index_t* length,
639  const char* name, const char* description="");
646  void add_vector(int64_t** param, index_t* length,
647  const char* name, const char* description="");
654  void add_vector(uint64_t** param, index_t* length,
655  const char* name, const char* description="");
662  void add_vector(float32_t** param, index_t* length,
663  const char* name, const char* description="");
670  void add_vector(float64_t** param, index_t* length,
671  const char* name, const char* description="");
678  void add_vector(floatmax_t** param, index_t* length,
679  const char* name, const char* description="");
686  void add_vector(complex128_t** param, index_t* length,
687  const char* name, const char* description="");
694  void add_vector(CSGObject*** param, index_t* length,
695  const char* name, const char* description="");
702  void add_vector(SGString<bool>** param, index_t* length,
703  const char* name, const char* description="");
710  void add_vector(SGString<char>** param, index_t* length,
711  const char* name, const char* description="");
718  void add_vector(SGString<int8_t>** param, index_t* length,
719  const char* name, const char* description="");
726  void add_vector(SGString<uint8_t>** param, index_t* length,
727  const char* name, const char* description="");
734  void add_vector(SGString<int16_t>** param, index_t* length,
735  const char* name, const char* description="");
742  void add_vector(SGString<uint16_t>** param, index_t* length,
743  const char* name, const char* description="");
750  void add_vector(SGString<int32_t>** param, index_t* length,
751  const char* name, const char* description="");
758  void add_vector(SGString<uint32_t>** param, index_t* length,
759  const char* name, const char* description="");
766  void add_vector(SGString<int64_t>** param, index_t* length,
767  const char* name, const char* description="");
774  void add_vector(SGString<uint64_t>** param, index_t* length,
775  const char* name, const char* description="");
782  void add_vector(SGString<float32_t>** param, index_t* length,
783  const char* name, const char* description="");
790  void add_vector(SGString<float64_t>** param, index_t* length,
791  const char* name, const char* description="");
798  void add_vector(SGString<floatmax_t>** param, index_t* length,
799  const char* name, const char* description="");
806  void add_vector(SGSparseVector<bool>** param, index_t* length,
807  const char* name, const char* description="");
814  void add_vector(SGSparseVector<char>** param, index_t* length,
815  const char* name, const char* description="");
822  void add_vector(SGSparseVector<int8_t>** param, index_t* length,
823  const char* name, const char* description="");
830  void add_vector(SGSparseVector<uint8_t>** param, index_t* length,
831  const char* name, const char* description="");
838  void add_vector(SGSparseVector<int16_t>** param, index_t* length,
839  const char* name, const char* description="");
846  void add_vector(SGSparseVector<uint16_t>** param, index_t* length,
847  const char* name, const char* description="");
854  void add_vector(SGSparseVector<int32_t>** param, index_t* length,
855  const char* name, const char* description="");
862  void add_vector(SGSparseVector<uint32_t>** param, index_t* length,
863  const char* name, const char* description="");
870  void add_vector(SGSparseVector<int64_t>** param, index_t* length,
871  const char* name, const char* description="");
878  void add_vector(SGSparseVector<uint64_t>** param, index_t* length,
879  const char* name, const char* description="");
886  void add_vector(SGSparseVector<float32_t>** param, index_t* length,
887  const char* name, const char* description="");
894  void add_vector(SGSparseVector<float64_t>** param, index_t* length,
895  const char* name, const char* description="");
902  void add_vector(SGSparseVector<floatmax_t>** param, index_t* length,
903  const char* name, const char* description="");
910  void add_vector(SGSparseVector<complex128_t>** param, index_t* length,
911  const char* name, const char* description="");
912 
913 
919  void add(SGVector<bool>* param, const char* name,
920  const char* description="");
926  void add(SGVector<char>* param, const char* name,
927  const char* description="");
933  void add(SGVector<int8_t>* param, const char* name,
934  const char* description="");
940  void add(SGVector<uint8_t>* param, const char* name,
941  const char* description="");
947  void add(SGVector<int16_t>* param, const char* name,
948  const char* description="");
954  void add(SGVector<uint16_t>* param, const char* name,
955  const char* description="");
961  void add(SGVector<int32_t>* param, const char* name,
962  const char* description="");
968  void add(SGVector<uint32_t>* param, const char* name,
969  const char* description="");
975  void add(SGVector<int64_t>* param, const char* name,
976  const char* description="");
982  void add(SGVector<uint64_t>* param, const char* name,
983  const char* description="");
989  void add(SGVector<float32_t>* param, const char* name,
990  const char* description="");
996  void add(SGVector<float64_t>* param, const char* name,
997  const char* description="");
1003  void add(SGVector<floatmax_t>* param, const char* name,
1004  const char* description="");
1010  void add(SGVector<complex128_t>* param, const char* name,
1011  const char* description="");
1017  void add(SGVector<CSGObject*>* param, const char* name,
1018  const char* description="");
1024  void add(SGVector<SGString<bool> >* param, const char* name,
1025  const char* description="");
1031  void add(SGVector<SGString<char> >* param, const char* name,
1032  const char* description="");
1038  void add(SGVector<SGString<int8_t> >* param, const char* name,
1039  const char* description="");
1045  void add(SGVector<SGString<uint8_t> >* param, const char* name,
1046  const char* description="");
1052  void add(SGVector<SGString<int16_t> >* param, const char* name,
1053  const char* description="");
1059  void add(SGVector<SGString<uint16_t> >* param, const char* name,
1060  const char* description="");
1066  void add(SGVector<SGString<int32_t> >* param, const char* name,
1067  const char* description="");
1073  void add(SGVector<SGString<uint32_t> >* param, const char* name,
1074  const char* description="");
1080  void add(SGVector<SGString<int64_t> >* param, const char* name,
1081  const char* description="");
1087  void add(SGVector<SGString<uint64_t> >* param, const char* name,
1088  const char* description="");
1094  void add(SGVector<SGString<float32_t> >* param, const char* name,
1095  const char* description="");
1101  void add(SGVector<SGString<float64_t> >* param, const char* name,
1102  const char* description="");
1108  void add(SGVector<SGString<floatmax_t> >* param, const char* name,
1109  const char* description="");
1115  void add(SGVector<SGSparseVector<bool> >* param, const char* name,
1116  const char* description="");
1122  void add(SGVector<SGSparseVector<char> >* param, const char* name,
1123  const char* description="");
1129  void add(SGVector<SGSparseVector<int8_t> >* param, const char* name,
1130  const char* description="");
1136  void add(SGVector<SGSparseVector<uint8_t> >* param,const char* name,
1137  const char* description="");
1143  void add(SGVector<SGSparseVector<int16_t> >* param, const char* name,
1144  const char* description="");
1150  void add(SGVector<SGSparseVector<uint16_t> >* param,
1151  const char* name, const char* description="");
1157  void add(SGVector<SGSparseVector<int32_t> >* param, const char* name,
1158  const char* description="");
1164  void add(SGVector<SGSparseVector<uint32_t> >* param,const char* name,
1165  const char* description="");
1171  void add(SGVector<SGSparseVector<int64_t> >* param, const char* name,
1172  const char* description="");
1178  void add(SGVector<SGSparseVector<uint64_t> >* param,
1179  const char* name, const char* description="");
1185  void add(SGVector<SGSparseVector<float32_t> >* param,
1186  const char* name, const char* description="");
1192  void add(SGVector<SGSparseVector<float64_t> >* param,
1193  const char* name, const char* description="");
1199  void add(SGVector<SGSparseVector<floatmax_t> >* param,
1200  const char* name, const char* description="");
1207  const char* name, const char* description="");
1208 
1209  /* ************************************************************ */
1210  /* Matrix wrappers */
1211 
1219  void add_matrix(bool** param,
1220  index_t* length_y, index_t* length_x,
1221  const char* name, const char* description="");
1229  void add_matrix(char** param,
1230  index_t* length_y, index_t* length_x,
1231  const char* name, const char* description="");
1239  void add_matrix(int8_t** param,
1240  index_t* length_y, index_t* length_x,
1241  const char* name, const char* description="");
1249  void add_matrix(uint8_t** param,
1250  index_t* length_y, index_t* length_x,
1251  const char* name, const char* description="");
1259  void add_matrix(int16_t** param,
1260  index_t* length_y, index_t* length_x,
1261  const char* name, const char* description="");
1269  void add_matrix(uint16_t** param,
1270  index_t* length_y, index_t* length_x,
1271  const char* name, const char* description="");
1279  void add_matrix(int32_t** param,
1280  index_t* length_y, index_t* length_x,
1281  const char* name, const char* description="");
1289  void add_matrix(uint32_t** param,
1290  index_t* length_y, index_t* length_x,
1291  const char* name, const char* description="");
1299  void add_matrix(int64_t** param,
1300  index_t* length_y, index_t* length_x,
1301  const char* name, const char* description="");
1309  void add_matrix(uint64_t** param,
1310  index_t* length_y, index_t* length_x,
1311  const char* name, const char* description="");
1319  void add_matrix(float32_t** param,
1320  index_t* length_y, index_t* length_x,
1321  const char* name, const char* description="");
1329  void add_matrix(float64_t** param,
1330  index_t* length_y, index_t* length_x,
1331  const char* name, const char* description="");
1339  void add_matrix(floatmax_t** param,
1340  index_t* length_y, index_t* length_x,
1341  const char* name, const char* description="");
1349  void add_matrix(complex128_t** param,
1350  index_t* length_y, index_t* length_x,
1351  const char* name, const char* description="");
1359  void add_matrix(CSGObject*** param,
1360  index_t* length_y, index_t* length_x,
1361  const char* name, const char* description="");
1369  void add_matrix(SGString<bool>** param,
1370  index_t* length_y, index_t* length_x,
1371  const char* name, const char* description="");
1379  void add_matrix(SGString<char>** param,
1380  index_t* length_y, index_t* length_x,
1381  const char* name, const char* description="");
1389  void add_matrix(SGString<int8_t>** param,
1390  index_t* length_y, index_t* length_x,
1391  const char* name, const char* description="");
1399  void add_matrix(SGString<uint8_t>** param,
1400  index_t* length_y, index_t* length_x,
1401  const char* name, const char* description="");
1409  void add_matrix(SGString<int16_t>** param,
1410  index_t* length_y, index_t* length_x,
1411  const char* name, const char* description="");
1419  void add_matrix(SGString<uint16_t>** param,
1420  index_t* length_y, index_t* length_x,
1421  const char* name, const char* description="");
1429  void add_matrix(SGString<int32_t>** param,
1430  index_t* length_y, index_t* length_x,
1431  const char* name, const char* description="");
1439  void add_matrix(SGString<uint32_t>** param,
1440  index_t* length_y, index_t* length_x,
1441  const char* name, const char* description="");
1449  void add_matrix(SGString<int64_t>** param,
1450  index_t* length_y, index_t* length_x,
1451  const char* name, const char* description="");
1459  void add_matrix(SGString<uint64_t>** param,
1460  index_t* length_y, index_t* length_x,
1461  const char* name, const char* description="");
1469  void add_matrix(SGString<float32_t>** param,
1470  index_t* length_y, index_t* length_x,
1471  const char* name, const char* description="");
1479  void add_matrix(SGString<float64_t>** param,
1480  index_t* length_y, index_t* length_x,
1481  const char* name, const char* description="");
1489  void add_matrix(SGString<floatmax_t>** param,
1490  index_t* length_y, index_t* length_x,
1491  const char* name, const char* description="");
1499  void add_matrix(SGSparseVector<bool>** param,
1500  index_t* length_y, index_t* length_x,
1501  const char* name, const char* description="");
1509  void add_matrix(SGSparseVector<char>** param,
1510  index_t* length_y, index_t* length_x,
1511  const char* name, const char* description="");
1519  void add_matrix(SGSparseVector<int8_t>** param,
1520  index_t* length_y, index_t* length_x,
1521  const char* name, const char* description="");
1529  void add_matrix(SGSparseVector<uint8_t>** param,
1530  index_t* length_y, index_t* length_x,
1531  const char* name, const char* description="");
1539  void add_matrix(SGSparseVector<int16_t>** param,
1540  index_t* length_y, index_t* length_x,
1541  const char* name, const char* description="");
1549  void add_matrix(SGSparseVector<uint16_t>** param,
1550  index_t* length_y, index_t* length_x,
1551  const char* name, const char* description="");
1559  void add_matrix(SGSparseVector<int32_t>** param,
1560  index_t* length_y, index_t* length_x,
1561  const char* name, const char* description="");
1569  void add_matrix(SGSparseVector<uint32_t>** param,
1570  index_t* length_y, index_t* length_x,
1571  const char* name, const char* description="");
1579  void add_matrix(SGSparseVector<int64_t>** param,
1580  index_t* length_y, index_t* length_x,
1581  const char* name, const char* description="");
1589  void add_matrix(SGSparseVector<uint64_t>** param,
1590  index_t* length_y, index_t* length_x,
1591  const char* name, const char* description="");
1599  void add_matrix(SGSparseVector<float32_t>** param,
1600  index_t* length_y, index_t* length_x,
1601  const char* name, const char* description="");
1609  void add_matrix(SGSparseVector<float64_t>** param,
1610  index_t* length_y, index_t* length_x,
1611  const char* name, const char* description="");
1619  void add_matrix(SGSparseVector<floatmax_t>** param,
1620  index_t* length_y, index_t* length_x,
1621  const char* name, const char* description="");
1629  void add_matrix(SGSparseVector<complex128_t>** param,
1630  index_t* length_y, index_t* length_x,
1631  const char* name, const char* description="");
1637  void add(SGMatrix<bool>* param, const char* name,
1638  const char* description="");
1644  void add(SGMatrix<char>* param, const char* name,
1645  const char* description="");
1651  void add(SGMatrix<int8_t>* param, const char* name,
1652  const char* description="");
1658  void add(SGMatrix<uint8_t>* param, const char* name,
1659  const char* description="");
1665  void add(SGMatrix<int16_t>* param, const char* name,
1666  const char* description="");
1672  void add(SGMatrix<uint16_t>* param, const char* name,
1673  const char* description="");
1679  void add(SGMatrix<int32_t>* param, const char* name,
1680  const char* description="");
1686  void add(SGMatrix<uint32_t>* param, const char* name,
1687  const char* description="");
1693  void add(SGMatrix<int64_t>* param, const char* name,
1694  const char* description="");
1700  void add(SGMatrix<uint64_t>* param, const char* name,
1701  const char* description="");
1707  void add(SGMatrix<float32_t>* param, const char* name,
1708  const char* description="");
1714  void add(SGMatrix<float64_t>* param, const char* name,
1715  const char* description="");
1721  void add(SGMatrix<floatmax_t>* param, const char* name,
1722  const char* description="");
1728  void add(SGMatrix<complex128_t>* param, const char* name,
1729  const char* description="");
1735  void add(SGMatrix<CSGObject*>* param, const char* name,
1736  const char* description="");
1742  void add(SGMatrix<SGString<bool> >* param, const char* name,
1743  const char* description="");
1749  void add(SGMatrix<SGString<char> >* param, const char* name,
1750  const char* description="");
1756  void add(SGMatrix<SGString<int8_t> >* param, const char* name,
1757  const char* description="");
1763  void add(SGMatrix<SGString<uint8_t> >* param, const char* name,
1764  const char* description="");
1770  void add(SGMatrix<SGString<int16_t> >* param, const char* name,
1771  const char* description="");
1777  void add(SGMatrix<SGString<uint16_t> >* param, const char* name,
1778  const char* description="");
1784  void add(SGMatrix<SGString<int32_t> >* param, const char* name,
1785  const char* description="");
1791  void add(SGMatrix<SGString<uint32_t> >* param, const char* name,
1792  const char* description="");
1798  void add(SGMatrix<SGString<int64_t> >* param, const char* name,
1799  const char* description="");
1805  void add(SGMatrix<SGString<uint64_t> >* param, const char* name,
1806  const char* description="");
1812  void add(SGMatrix<SGString<float32_t> >* param, const char* name,
1813  const char* description="");
1819  void add(SGMatrix<SGString<float64_t> >* param, const char* name,
1820  const char* description="");
1826  void add(SGMatrix<SGString<floatmax_t> >* param, const char* name,
1827  const char* description="");
1833  void add(SGMatrix<SGSparseVector<bool> >* param, const char* name,
1834  const char* description="");
1840  void add(SGMatrix<SGSparseVector<char> >* param, const char* name,
1841  const char* description="");
1847  void add(SGMatrix<SGSparseVector<int8_t> >* param, const char* name,
1848  const char* description="");
1854  void add(SGMatrix<SGSparseVector<uint8_t> >* param,const char* name,
1855  const char* description="");
1861  void add(SGMatrix<SGSparseVector<int16_t> >* param, const char* name,
1862  const char* description="");
1868  void add(SGMatrix<SGSparseVector<uint16_t> >* param,
1869  const char* name, const char* description="");
1875  void add(SGMatrix<SGSparseVector<int32_t> >* param, const char* name,
1876  const char* description="");
1882  void add(SGMatrix<SGSparseVector<uint32_t> >* param,const char* name,
1883  const char* description="");
1889  void add(SGMatrix<SGSparseVector<int64_t> >* param, const char* name,
1890  const char* description="");
1896  void add(SGMatrix<SGSparseVector<uint64_t> >* param,
1897  const char* name, const char* description="");
1903  void add(SGMatrix<SGSparseVector<float32_t> >* param,
1904  const char* name, const char* description="");
1910  void add(SGMatrix<SGSparseVector<float64_t> >* param,
1911  const char* name, const char* description="");
1917  void add(SGMatrix<SGSparseVector<floatmax_t> >* param,
1918  const char* name, const char* description="");
1925  const char* name, const char* description="");
1926 
1932  void add(SGSparseMatrix<bool>* param,
1933  const char* name, const char* description="");
1939  void add(SGSparseMatrix<char>* param,
1940  const char* name, const char* description="");
1946  void add(SGSparseMatrix<int8_t>* param,
1947  const char* name, const char* description="");
1953  void add(SGSparseMatrix<uint8_t>* param,
1954  const char* name, const char* description="");
1960  void add(SGSparseMatrix<int16_t>* param,
1961  const char* name, const char* description="");
1967  void add(SGSparseMatrix<uint16_t>* param,
1968  const char* name, const char* description="");
1974  void add(SGSparseMatrix<int32_t>* param,
1975  const char* name, const char* description="");
1981  void add(SGSparseMatrix<uint32_t>* param,
1982  const char* name, const char* description="");
1988  void add(SGSparseMatrix<int64_t>* param,
1989  const char* name, const char* description="");
1995  void add(SGSparseMatrix<uint64_t>* param,
1996  const char* name, const char* description="");
2002  void add(SGSparseMatrix<float32_t>* param,
2003  const char* name, const char* description="");
2009  void add(SGSparseMatrix<float64_t>* param,
2010  const char* name, const char* description="");
2016  void add(SGSparseMatrix<floatmax_t>* param,
2017  const char* name, const char* description="");
2023  void add(SGSparseMatrix<complex128_t>* param,
2024  const char* name, const char* description="");
2030  void add(SGSparseMatrix<CSGObject*>* param,
2031  const char* name, const char* description="");
2032 protected:
2033 
2036 
2043  virtual void add_type(const TSGDataType* type, void* param,
2044  const char* name,
2045  const char* description);
2046 };
2047 }
2048 #endif //__PARAMETER_H__
template class SGSparseMatrix
TParameter * get_parameter(const char *name)
std::complex< float64_t > complex128_t
Definition: common.h:77
int32_t index_t
Definition: common.h:72
virtual int32_t get_num_parameters()
bool operator==(const TParameter &other) const
Definition: Parameter.cpp:2946
TParameter * get_parameter(int32_t idx)
parameter struct
void add(SGVector< T > &a, SGVector< T > &b, SGVector< T > &result, T alpha=1, T beta=1)
static bool compare_stype(EStructType stype, EPrimitiveType ptype, void *data1, void *data2, float64_t accuracy=0.0, bool tolerant=false)
Definition: Parameter.cpp:3497
Datatypes that shogun supports.
Definition: DataType.h:68
bool operator<(const TParameter &other) const
Definition: Parameter.cpp:2953
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry<T>* vector is orde...
shogun string
bool equals(TParameter *other, float64_t accuracy=0.0, bool tolerant=false)
Definition: Parameter.cpp:2963
bool save(CSerializableFile *file, const char *prefix="")
Definition: Parameter.cpp:2514
TParameter(const TSGDataType *datatype, void *parameter, const char *name, const char *description)
Definition: Parameter.cpp:1783
TSGDataType m_datatype
DynArray< TParameter * > m_params
static bool compare_ptype(EPrimitiveType ptype, void *data1, void *data2, float64_t accuracy=0.0, bool tolerant=false)
Definition: Parameter.cpp:3108
Parameter class.
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:124
Template Dynamic array class that creates an array that can be used like a list or an array...
Definition: DynArray.h:32
double float64_t
Definition: common.h:60
long double floatmax_t
Definition: common.h:61
shogun vector
void add_vector(const SGMatrix< T > &A, const SGVector< T > &b, SGMatrix< T > &result, T alpha=1, T beta=1)
void print(const char *prefix)
Definition: Parameter.cpp:1809
static bool copy_ptype(EPrimitiveType ptype, void *source, void *target)
Definition: Parameter.cpp:3353
void get_incremental_hash(uint32_t &hash, uint32_t &carry, uint32_t &total_length)
Definition: Parameter.cpp:2424
float float32_t
Definition: common.h:59
shogun matrix
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
bool load(CSerializableFile *file, const char *prefix="")
Definition: Parameter.cpp:2613
bool copy(TParameter *target)
Definition: Parameter.cpp:3771
static bool copy_stype(EStructType stype, EPrimitiveType ptype, void *source, void *target)
Definition: Parameter.cpp:3625
bool operator>(const TParameter &other) const
Definition: Parameter.cpp:2958

SHOGUN Machine Learning Toolbox - Documentation