Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Simple to Dense renaming
  • Loading branch information
lisitsyn committed May 8, 2012
1 parent 7bb62a6 commit b4ef345
Show file tree
Hide file tree
Showing 223 changed files with 1,178 additions and 1,356 deletions.
Expand Up @@ -12,7 +12,7 @@
#include <shogun/base/Parameter.h>
#include <shogun/io/SerializableAsciiFile.h>
#include <shogun/base/ParameterMap.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>

using namespace shogun;

Expand Down Expand Up @@ -45,7 +45,7 @@ class CTestClassInt : public CSGObject
SGMatrix<int32_t> features=SGMatrix<int32_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 3);
m_features=new CSimpleFeatures<int32_t>(features);
m_features=new CDenseFeatures<int32_t>(features);
SG_REF(m_features);
m_parameters->add((CSGObject**)&m_features, "int_features",
"Test features");
Expand All @@ -66,7 +66,7 @@ class CTestClassInt : public CSGObject
int32_t m_matrix_rows;
int32_t m_matrix_cols;

CSimpleFeatures<int32_t>* m_features;
CDenseFeatures<int32_t>* m_features;

virtual const char* get_name() const { return "TestClassInt"; }
};
Expand All @@ -87,7 +87,7 @@ class CTestClassFloat : public CSGObject
SGMatrix<float64_t> features=SGMatrix<float64_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 3.0);
m_features=new CSimpleFeatures<float64_t>(features);
m_features=new CDenseFeatures<float64_t>(features);
SG_REF(m_features);
m_parameters->add((CSGObject**)&m_features, "float_features",
"Test features");
Expand Down Expand Up @@ -147,7 +147,7 @@ class CTestClassFloat : public CSGObject
float64_t m_number;
SGVector<float64_t> m_vector;
SGMatrix<float64_t> m_matrix;
CSimpleFeatures<float64_t>* m_features;
CDenseFeatures<float64_t>* m_features;

virtual const char* get_name() const { return "TestClassFloat"; }
};
Expand Down Expand Up @@ -209,8 +209,8 @@ void test_load_file_parameter()
}
else if (!strcmp(current->m_name, "int_features"))
{
CSimpleFeatures<int32_t>* features=
*((CSimpleFeatures<int32_t>**)
CDenseFeatures<int32_t>* features=
*((CDenseFeatures<int32_t>**)
current->m_parameter);
SGMatrix<int32_t> feature_matrix_loaded=
features->get_feature_matrix();
Expand Down
14 changes: 7 additions & 7 deletions examples/undocumented/libshogun/base_load_file_parameters.cpp
Expand Up @@ -12,7 +12,7 @@
#include <shogun/base/Parameter.h>
#include <shogun/io/SerializableAsciiFile.h>
#include <shogun/base/ParameterMap.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>

using namespace shogun;

Expand Down Expand Up @@ -45,7 +45,7 @@ class CTestClassInt : public CSGObject
SGMatrix<int32_t> features=SGMatrix<int32_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 3);
m_features=new CSimpleFeatures<int32_t>(features);
m_features=new CDenseFeatures<int32_t>(features);
SG_REF(m_features);
m_parameters->add((CSGObject**)&m_features, "int_features",
"Test features");
Expand All @@ -66,7 +66,7 @@ class CTestClassInt : public CSGObject
int32_t m_matrix_rows;
int32_t m_matrix_cols;

CSimpleFeatures<int32_t>* m_features;
CDenseFeatures<int32_t>* m_features;

virtual const char* get_name() const { return "TestClassInt"; }
};
Expand All @@ -87,7 +87,7 @@ class CTestClassFloat : public CSGObject
SGMatrix<float64_t> features=SGMatrix<float64_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 3.0);
m_features=new CSimpleFeatures<float64_t>(features);
m_features=new CDenseFeatures<float64_t>(features);
SG_REF(m_features);
m_parameters->add((CSGObject**)&m_features, "float_features",
"Test features");
Expand Down Expand Up @@ -147,7 +147,7 @@ class CTestClassFloat : public CSGObject
float64_t m_number;
SGVector<float64_t> m_vector;
SGMatrix<float64_t> m_matrix;
CSimpleFeatures<float64_t>* m_features;
CDenseFeatures<float64_t>* m_features;

virtual const char* get_name() const { return "TestClassFloat"; }
};
Expand Down Expand Up @@ -237,8 +237,8 @@ void test_load_file_parameters()

/* and for the feature object */
current=file_loaded_sgobject->get_element(0);
CSimpleFeatures<int32_t>* features=
*((CSimpleFeatures<int32_t>**)current->m_parameter);
CDenseFeatures<int32_t>* features=
*((CDenseFeatures<int32_t>**)current->m_parameter);
SGMatrix<int32_t> feature_matrix_loaded=
features->get_feature_matrix();
SGMatrix<int32_t> feature_matrix_original=
Expand Down
15 changes: 7 additions & 8 deletions examples/undocumented/libshogun/base_map_parameters.cpp
Expand Up @@ -12,7 +12,7 @@
#include <shogun/base/Parameter.h>
#include <shogun/io/SerializableAsciiFile.h>
#include <shogun/base/ParameterMap.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>

using namespace shogun;

Expand Down Expand Up @@ -45,7 +45,7 @@ class CTestClassInt : public CSGObject
SGMatrix<int32_t> features=SGMatrix<int32_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 3);
m_features=new CSimpleFeatures<int32_t>(10);
m_features=new CDenseFeatures<int32_t>(10);
m_features->set_feature_matrix(features);
m_features->set_combined_feature_weight(5.0);
SG_REF(m_features);
Expand All @@ -68,7 +68,7 @@ class CTestClassInt : public CSGObject
int32_t m_matrix_rows;
int32_t m_matrix_cols;

CSimpleFeatures<int32_t>* m_features;
CDenseFeatures<int32_t>* m_features;

virtual const char* get_name() const { return "TestClassInt"; }
};
Expand All @@ -89,7 +89,7 @@ class CTestClassFloat : public CSGObject
SGMatrix<int32_t> features=SGMatrix<int32_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 3);
m_features=new CSimpleFeatures<int32_t>(features);
m_features=new CDenseFeatures<int32_t>(features);
SG_REF(m_features);
m_parameters->add((CSGObject**)&m_features, "float_features",
"Test features");
Expand Down Expand Up @@ -143,7 +143,6 @@ class CTestClassFloat : public CSGObject

virtual ~CTestClassFloat()
{
m_matrix.destroy_matrix();
SG_UNREF(m_features);
}

Expand All @@ -152,7 +151,7 @@ class CTestClassFloat : public CSGObject
SGMatrix<float64_t> m_matrix;

/* no type change here */
CSimpleFeatures<int32_t>* m_features;
CDenseFeatures<int32_t>* m_features;

virtual const char* get_name() const { return "TestClassFloat"; }

Expand Down Expand Up @@ -303,8 +302,8 @@ void test_load_file_parameter()
SG_SPRINT("checking \"float_features\":\n");
ASSERT(!strcmp(current->m_name, "float_features"));
/* cast to simple features */
CSimpleFeatures<int32_t>* features=
*((CSimpleFeatures<int32_t>**)current->m_parameter);
CDenseFeatures<int32_t>* features=
*((CDenseFeatures<int32_t>**)current->m_parameter);
SG_SPRINT("checking address (mapped!=original): %p!=%p\n", features,
int_instance->m_features);
ASSERT((void*)features!=(void*)int_instance->m_features);
Expand Down
Expand Up @@ -12,7 +12,7 @@
#include <shogun/base/Parameter.h>
#include <shogun/io/SerializableAsciiFile.h>
#include <shogun/base/ParameterMap.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>

using namespace shogun;

Expand Down Expand Up @@ -45,7 +45,7 @@ class CTestClassInt : public CSGObject
SGMatrix<int32_t> features=SGMatrix<int32_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 3);
m_features=new CSimpleFeatures<int32_t>(10);
m_features=new CDenseFeatures<int32_t>(10);
m_features->set_feature_matrix(features);
m_features->set_combined_feature_weight(5.0);
SG_REF(m_features);
Expand All @@ -68,7 +68,7 @@ class CTestClassInt : public CSGObject
int32_t m_matrix_rows;
int32_t m_matrix_cols;

CSimpleFeatures<int32_t>* m_features;
CDenseFeatures<int32_t>* m_features;

virtual const char* get_name() const { return "TestClassInt"; }
};
Expand All @@ -93,7 +93,7 @@ class CTestClassFloat : public CSGObject
SGMatrix<int32_t> features=SGMatrix<int32_t>(2, 3);
CMath::range_fill_vector(features.matrix,
features.num_rows*features.num_cols, 0);
m_features=new CSimpleFeatures<int32_t>(features);
m_features=new CDenseFeatures<int32_t>(features);
SG_REF(m_features);
m_parameters->add((CSGObject**)&m_features, "float_features",
"Test features");
Expand Down Expand Up @@ -156,7 +156,7 @@ class CTestClassFloat : public CSGObject
SGMatrix<float64_t> m_matrix;

/* no type change here */
CSimpleFeatures<int32_t>* m_features;
CDenseFeatures<int32_t>* m_features;

virtual const char* get_name() const { return "TestClassFloat"; }

Expand Down
4 changes: 2 additions & 2 deletions examples/undocumented/libshogun/classifier_conjugateindex.cpp
@@ -1,5 +1,5 @@
#include <shogun/features/Labels.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/multiclass/ConjugateIndex.h>
#include <shogun/base/init.h>
#include <shogun/lib/common.h>
Expand All @@ -18,7 +18,7 @@ int main(int argc, char** argv)

// create three 2-dimensional vectors
// shogun will now own the matrix created
CSimpleFeatures<float64_t>* features= new CSimpleFeatures<float64_t>();
CDenseFeatures<float64_t>* features= new CDenseFeatures<float64_t>();
features->set_feature_matrix(matrix, 2, 3);

// create three labels
Expand Down
@@ -1,5 +1,5 @@
#include <shogun/features/Labels.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/classifier/GaussianNaiveBayes.h>
#include <shogun/base/init.h>
#include <shogun/lib/common.h>
Expand All @@ -18,7 +18,7 @@ int main(int argc, char** argv)

// create three 2-dimensional vectors
// shogun will now own the matrix created
CSimpleFeatures<float64_t>* features= new CSimpleFeatures<float64_t>();
CDenseFeatures<float64_t>* features= new CDenseFeatures<float64_t>();
features->set_feature_matrix(matrix, 2, 3);

// create three labels
Expand Down
4 changes: 2 additions & 2 deletions examples/undocumented/libshogun/classifier_libsvm.cpp
Expand Up @@ -8,7 +8,7 @@
* Copyright (C) 2008-2009 Fraunhofer Institute FIRST and Max Planck Society
*/
#include <shogun/kernel/GaussianKernel.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/classifier/svm/LibSVM.h>
#include <shogun/mathematics/Math.h>
#include <shogun/lib/common.h>
Expand Down Expand Up @@ -69,7 +69,7 @@ int main()
CLabels* labels=new CLabels(SGVector<float64_t>(lab, NUM));

// create train features
CSimpleFeatures<float64_t>* features = new CSimpleFeatures<float64_t>(feature_cache);
CDenseFeatures<float64_t>* features = new CDenseFeatures<float64_t>(feature_cache);
SG_REF(features);
features->set_feature_matrix(feat, DIMS, NUM);

Expand Down
4 changes: 2 additions & 2 deletions examples/undocumented/libshogun/classifier_minimal_svm.cpp
@@ -1,5 +1,5 @@
#include <shogun/features/Labels.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/kernel/GaussianKernel.h>
#include <shogun/classifier/svm/LibSVM.h>
#include <shogun/base/init.h>
Expand All @@ -24,7 +24,7 @@ int main(int argc, char** argv)

// create three 2-dimensional vectors
// shogun will now own the matrix created
CSimpleFeatures<float64_t>* features= new CSimpleFeatures<float64_t>();
CDenseFeatures<float64_t>* features= new CDenseFeatures<float64_t>();
features->set_feature_matrix(matrix, 2, 3);

// create three labels
Expand Down
14 changes: 7 additions & 7 deletions examples/undocumented/libshogun/classifier_multiclass_ecoc.cpp
@@ -1,8 +1,8 @@
#include <shogun/features/Labels.h>
#include <shogun/io/StreamingAsciiFile.h>
#include <shogun/io/SGIO.h>
#include <shogun/features/StreamingSimpleFeatures.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/StreamingDenseFeatures.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/multiclass/ecoc/ECOCStrategy.h>
#include <shogun/multiclass/ecoc/ECOCOVREncoder.h>
#include <shogun/multiclass/ecoc/ECOCHDDecoder.h>
Expand All @@ -29,11 +29,11 @@ int main(int argc, char** argv)
SG_REF(ffeats_train);
SG_REF(flabels_train);

CStreamingSimpleFeatures< float64_t >* stream_features =
new CStreamingSimpleFeatures< float64_t >(ffeats_train, false, 1024);
CStreamingDenseFeatures< float64_t >* stream_features =
new CStreamingDenseFeatures< float64_t >(ffeats_train, false, 1024);

CStreamingSimpleFeatures< float64_t >* stream_labels =
new CStreamingSimpleFeatures< float64_t >(flabels_train, true, 1024);
CStreamingDenseFeatures< float64_t >* stream_labels =
new CStreamingDenseFeatures< float64_t >(flabels_train, true, 1024);

SG_REF(stream_features);
SG_REF(stream_labels);
Expand All @@ -57,7 +57,7 @@ int main(int argc, char** argv)
stream_features->end_parser();

// Create features with the useful values from mat
CSimpleFeatures< float64_t >* features = new CSimpleFeatures< float64_t >(mat.matrix, num_feats, num_vectors);
CDenseFeatures< float64_t >* features = new CDenseFeatures< float64_t >(mat.matrix, num_feats, num_vectors);

CLabels* labels = new CLabels(num_vectors);
SG_REF(features);
Expand Down
@@ -1,8 +1,8 @@
#include <shogun/features/Labels.h>
#include <shogun/io/StreamingAsciiFile.h>
#include <shogun/io/SGIO.h>
#include <shogun/features/StreamingSimpleFeatures.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/StreamingDenseFeatures.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/multiclass/ecoc/ECOCStrategy.h>
#include <shogun/multiclass/ecoc/ECOCRandomDenseEncoder.h>
#include <shogun/multiclass/ecoc/ECOCRandomSparseEncoder.h>
Expand Down Expand Up @@ -30,11 +30,11 @@ int main(int argc, char** argv)
SG_REF(ffeats_train);
SG_REF(flabels_train);

CStreamingSimpleFeatures< float64_t >* stream_features =
new CStreamingSimpleFeatures< float64_t >(ffeats_train, false, 1024);
CStreamingDenseFeatures< float64_t >* stream_features =
new CStreamingDenseFeatures< float64_t >(ffeats_train, false, 1024);

CStreamingSimpleFeatures< float64_t >* stream_labels =
new CStreamingSimpleFeatures< float64_t >(flabels_train, true, 1024);
CStreamingDenseFeatures< float64_t >* stream_labels =
new CStreamingDenseFeatures< float64_t >(flabels_train, true, 1024);

SG_REF(stream_features);
SG_REF(stream_labels);
Expand All @@ -58,7 +58,7 @@ int main(int argc, char** argv)
stream_features->end_parser();

// Create features with the useful values from mat
CSimpleFeatures< float64_t >* features = new CSimpleFeatures< float64_t >(mat.matrix, num_feats, num_vectors);
CDenseFeatures< float64_t >* features = new CDenseFeatures< float64_t >(mat.matrix, num_feats, num_vectors);

CLabels* labels = new CLabels(num_vectors);
SG_REF(features);
Expand Down
@@ -1,5 +1,5 @@
#include <shogun/features/Labels.h>
#include <shogun/features/SimpleFeatures.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/kernel/GaussianKernel.h>
#include <shogun/multiclass/MulticlassLibSVM.h>
#include <shogun/base/init.h>
Expand All @@ -24,7 +24,7 @@ int main(int argc, char** argv)

// create vectors
// shogun will now own the matrix created
CSimpleFeatures<float64_t>* features=new CSimpleFeatures<float64_t>(matrix);
CDenseFeatures<float64_t>* features=new CDenseFeatures<float64_t>(matrix);

// create three labels
CLabels* labels=new CLabels(num_vec);
Expand Down

0 comments on commit b4ef345

Please sign in to comment.