Skip to content

Commit

Permalink
fix a couple of clang related warnings (which infact were errors)
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Apr 4, 2012
1 parent 07e97f4 commit 1aa40a1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/configure
Expand Up @@ -416,7 +416,7 @@ EOF
echocheck "C Compiler flags"
for opt in `echo $COMP_OPTS`
do
cc_check $opt && COMPFLAGS_C="$COMPFLAGS_C $opt"
cc_check -Werror $opt && COMPFLAGS_C="$COMPFLAGS_C $opt"
done
echores "$COMPFLAGS_C"

Expand Down Expand Up @@ -479,7 +479,7 @@ EOF
echocheck "C++ Compiler flags"
for opt in `echo $COMP_OPTS`
do
cxx_check $opt && COMPFLAGS_CPP="$COMPFLAGS_CPP $opt"
cxx_check -Werror $opt && COMPFLAGS_CPP="$COMPFLAGS_CPP $opt"
done
echores "$COMPFLAGS_CPP"

Expand Down
19 changes: 9 additions & 10 deletions src/shogun/classifier/svm/DomainAdaptationSVMLinear.cpp
Expand Up @@ -94,19 +94,23 @@ bool CDomainAdaptationSVMLinear::is_presvm_sane()
}


bool CDomainAdaptationSVMLinear::train_machine(CDotFeatures* train_data)
bool CDomainAdaptationSVMLinear::train_machine(CFeatures* train_data)
{

CDotFeatures* tmp_data;

if (train_data)
{
if (!train_data->has_property(FP_DOT))
SG_ERROR("DotFeatures expected\n");

if (m_labels->get_num_labels() != train_data->get_num_vectors())
SG_ERROR("Number of training vectors does not match number of labels\n");
tmp_data = train_data;

} else {

tmp_data = (CDotFeatures*) train_data;
}
else
{
tmp_data = features;
}

Expand Down Expand Up @@ -197,9 +201,8 @@ void CDomainAdaptationSVMLinear::set_train_factor(float64_t factor)
}


CLabels* CDomainAdaptationSVMLinear::apply(CDotFeatures* data)
CLabels* CDomainAdaptationSVMLinear::apply(CFeatures* data)
{

ASSERT(presvm->get_bias()==0.0);

int32_t num_examples = data->get_num_vectors();
Expand All @@ -208,7 +211,6 @@ CLabels* CDomainAdaptationSVMLinear::apply(CDotFeatures* data)

if (presvm)
{

// recursive call if used on DomainAdaptationSVM object
CLabels* out_presvm = presvm->apply(data);

Expand All @@ -219,12 +221,9 @@ CLabels* CDomainAdaptationSVMLinear::apply(CDotFeatures* data)
float64_t out_combined = out_current->get_label(i) + B*out_presvm->get_label(i);
out_current->set_label(i, out_combined);
}

}


return out_current;

}

#endif //HAVE_LAPACK
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/classifier/svm/DomainAdaptationSVMLinear.h
Expand Up @@ -65,7 +65,7 @@ class CDomainAdaptationSVMLinear : public CLibLinear
* @param data (test)data to be classified
* @return classified labels
*/
virtual CLabels* apply(CDotFeatures* data);
virtual CLabels* apply(CFeatures* data);


/** returns SVM that is used as prior information
Expand Down Expand Up @@ -129,7 +129,7 @@ class CDomainAdaptationSVMLinear : public CLibLinear
*
* @return whether training was successful
*/
virtual bool train_machine(CDotFeatures* data=NULL);
virtual bool train_machine(CFeatures* data=NULL);

protected:

Expand Down
4 changes: 2 additions & 2 deletions src/shogun/classifier/svm/MultiClassSVM.cpp
Expand Up @@ -187,8 +187,8 @@ CLabels* CMultiClassSVM::classify_one_vs_rest()

if (!kernel)
{
SG_ERROR( "SVM can not proceed without kernel!\n");
return false ;
SG_ERROR("SVM can not proceed without kernel!\n");
return NULL;
}

if ( kernel && kernel->get_num_vec_lhs() && kernel->get_num_vec_rhs())
Expand Down
5 changes: 4 additions & 1 deletion src/shogun/lib/CoverTree.h
Expand Up @@ -123,7 +123,7 @@ class CoverTree

public:
/** base level of cover tree */
static const double base = 2.0;
static const double base;

/**
* Constructs a cover tree which begins with all points in points.
Expand Down Expand Up @@ -178,6 +178,9 @@ class CoverTree

}; // CoverTree class

template<class Point>
const double CoverTree<Point>::base = 2.0;

template<class Point>
CoverTree<Point>::CoverTree(const double& maxDist,
const std::vector<Point>& points)
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/machine/Machine.h
Expand Up @@ -230,7 +230,7 @@ class CMachine : public CSGObject
{
SG_ERROR("apply_locked(SGVector<index_t>) is not yet implemented "
"for %s\n", get_name());
return false;
return NULL;
}

/** TODO */
Expand Down

0 comments on commit 1aa40a1

Please sign in to comment.