Skip to content

Commit

Permalink
A few warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Aug 9, 2012
1 parent c3843f9 commit df8cd27
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 19 deletions.
5 changes: 5 additions & 0 deletions src/shogun/evaluation/MachineEvaluation.h
Expand Up @@ -90,10 +90,15 @@ class CMachineEvaluation: public CSGObject
virtual void init();

protected:
/** machine */
CMachine* m_machine;
/** features */
CFeatures* m_features;
/** labels */
CLabels* m_labels;
/** splitting strategy */
CSplittingStrategy* m_splitting_strategy;
/** evaluation criterion */
CEvaluation* m_evaluation_criterion;

/** whether machine will automatically be locked before evaluation */
Expand Down
4 changes: 4 additions & 0 deletions src/shogun/features/Features.h
Expand Up @@ -252,6 +252,10 @@ class CFeatures : public CSGObject
* Calls subset_changed_post() afterwards */
virtual void remove_all_subsets();

/** returns subset stack
*
* @return subset stack
*/
virtual CSubsetStack* get_subset_stack();

/** method may be overwritten to update things that depend on subset */
Expand Down
5 changes: 3 additions & 2 deletions src/shogun/labels/Labels.h
Expand Up @@ -106,10 +106,11 @@ class CLabels : public CSGObject
void init();

protected:
/* subset class to enable subset support for this class */

/** subset class to enable subset support for this class */
CSubsetStack* m_subset_stack;

/* confidences for labels */
/** confidences for labels */
SGVector<float64_t> m_confidences;
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/lib/DynamicArray.h
Expand Up @@ -624,7 +624,7 @@ template <class T> class CDynamicArray :public CSGObject
}
}

/* display array's size */
/** display array's size */
inline void display_size()
{
SG_PRINT( "DynamicArray of size: %dx%dx%d\n",dim1_size, dim2_size, dim3_size);
Expand Down
3 changes: 2 additions & 1 deletion src/shogun/lib/Map.h
Expand Up @@ -276,7 +276,7 @@ IGNORE_IN_CLASSLIST template<class K, class T> class CMap: public CSGObject
return array->get_array();
}

/*Assignment operator that copies map*/
/** assignment operator that copies map */
CMap& operator =(const CMap& orig)
{

Expand Down Expand Up @@ -477,6 +477,7 @@ IGNORE_IN_CLASSLIST template<class K, class T> class CMap: public CSGObject
DynArray<CMapNode<K, T>*>* array;

#ifdef HAVE_PTHREAD
/** lock */
PTHREAD_LOCK_T lock;
#endif
};
Expand Down
24 changes: 15 additions & 9 deletions src/shogun/lib/SGMatrix.h
Expand Up @@ -126,9 +126,11 @@ template<class T> class SGMatrix : public SGReferencedData
return result;
}

/** transpose matrix */
static void transpose_matrix(
T*& matrix, int32_t& num_feat, int32_t& num_vec);

/** create diagonal matrix */
static void create_diagonal_matrix(T* matrix, T* v,int32_t size)
{
for(int32_t i=0;i<size;i++)
Expand Down Expand Up @@ -197,8 +199,8 @@ template<class T> class SGMatrix : public SGReferencedData
void compute_few_eigenvectors(double* matrix_, double*& eigenvalues, double*& eigenvectors,
int n, int il, int iu);
#endif
/* Computes scale* A*B, where A and B may be transposed.
* Asserts for matching inner dimensions.
/** Computes scale* A*B, where A and B may be transposed.
* Asserts for matching inner dimensions.
* @param A matrix A
* @param transpose_A optional whether A should be transposed before
* @param B matrix B
Expand All @@ -210,17 +212,19 @@ template<class T> class SGMatrix : public SGReferencedData
bool transpose_A=false, bool transpose_B=false,
float64_t scale=1.0);
#ifdef HAVE_LAPACK
/// inverses square matrix in-place
/** inverses square matrix in-place */
static void inverse(SGMatrix<float64_t> matrix);

/// return the pseudo inverse for matrix
/// when matrix has shape (rows, cols) the pseudo inverse has (cols, rows)
/** return the pseudo inverse for matrix
* when matrix has shape (rows, cols) the pseudo inverse has (cols, rows)
*/
static float64_t* pinv(
float64_t* matrix, int32_t rows, int32_t cols,
float64_t* target=NULL);

#endif

/** compute trace */
static inline float64_t trace(
float64_t* mat, int32_t cols, int32_t rows)
{
Expand All @@ -230,7 +234,7 @@ template<class T> class SGMatrix : public SGReferencedData
return trace;
}

/* Sums up all rows of a matrix and returns the resulting rowvector */
/** sums up all rows of a matrix and returns the resulting rowvector */
static T* get_row_sum(T* matrix, int32_t m, int32_t n)
{
T* rowsums=SG_CALLOC(T, n);
Expand All @@ -243,7 +247,7 @@ template<class T> class SGMatrix : public SGReferencedData
return rowsums;
}

/* Sums up all columns of a matrix and returns the resulting columnvector */
/** sums up all columns of a matrix and returns the resulting columnvector */
static T* get_column_sum(T* matrix, int32_t m, int32_t n)
{
T* colsums=SG_CALLOC(T, m);
Expand All @@ -262,19 +266,21 @@ template<class T> class SGMatrix : public SGReferencedData
center_matrix(matrix, num_rows, num_cols);
}

/* Centers matrix (e.g. kernel matrix in feature space INPLACE */
/** Centers matrix (e.g. kernel matrix in feature space INPLACE */
static void center_matrix(T* matrix, int32_t m, int32_t n);

/** remove column mean */
void remove_column_mean();

/** display matrix */
void display_matrix(const char* name="matrix") const;

/// display matrix (useful for debugging)
/** display matrix (useful for debugging) */
static void display_matrix(
const T* matrix, int32_t rows, int32_t cols,
const char* name="matrix", const char* prefix="");

/** display matrix */
static void display_matrix(
const SGMatrix<T> matrix, const char* name="matrix",
const char* prefix="");
Expand Down
1 change: 1 addition & 0 deletions src/shogun/lib/SGReferencedData.h
Expand Up @@ -95,6 +95,7 @@ class SGReferencedData
}

protected:
/** copy refcount */
void copy_refcount(const SGReferencedData &orig)
{
m_refcount=orig.m_refcount;
Expand Down
6 changes: 6 additions & 0 deletions src/shogun/lib/SGSparseMatrix.h
Expand Up @@ -58,37 +58,43 @@ template <class T> class SGSparseMatrix : public SGReferencedData
copy_data(orig);
}

/** destructor */
virtual ~SGSparseMatrix()
{
unref();
}

/** index access operator */
inline const SGSparseVector<T>& operator[](index_t index) const
{
return sparse_matrix[index];
}

/** index access operator */
inline SGSparseVector<T>& operator[](index_t index)
{
return sparse_matrix[index];
}

protected:

/** copy data */
virtual void copy_data(const SGReferencedData& orig)
{
sparse_matrix = ((SGSparseMatrix*)(&orig))->sparse_matrix;
num_vectors = ((SGSparseMatrix*)(&orig))->num_vectors;
num_features = ((SGSparseMatrix*)(&orig))->num_features;
}

/** init data */
virtual void init_data()
{
sparse_matrix = NULL;
num_vectors = 0;
num_features = 0;
}

/** free data */
virtual void free_data()
{
for (int32_t i=0; i<num_vectors; i++)
Expand Down
1 change: 1 addition & 0 deletions src/shogun/lib/SGString.h
Expand Up @@ -46,6 +46,7 @@ template<class T> class SGString
SGString(const SGString &orig)
: string(orig.string), slen(orig.slen), do_free(orig.do_free) { }

/** equality operator */
bool operator==(const SGString & other) const
{
if (other.slen != slen)
Expand Down
11 changes: 8 additions & 3 deletions src/shogun/lib/SGVector.h
Expand Up @@ -158,6 +158,7 @@ template<class T> class SGVector : public SGReferencedData
*/
void add(const T x);

/** addition operator */
SGVector<T> operator+ (SGVector<T> x)
{
ASSERT(x.vector && vector);
Expand All @@ -168,18 +169,19 @@ template<class T> class SGVector : public SGReferencedData
return result;
}

/** inplace addition operator */
SGVector<T> operator+= (SGVector<T> x)
{
add(x);
return *this;
}

/** permute vector */
static void permute_vector(SGVector<T> vec);

/** create a random permutation in place */
void permute();


/** resize array from old_size to new_size (keeping as much array
* content as possible intact)
*/
Expand Down Expand Up @@ -454,8 +456,9 @@ template<class T> class SGVector : public SGReferencedData
/// return sum(abs(vec))
static bool fequal(T x, T y, float64_t precision=1e-6);

/* performs a inplace unique of a vector of type T using quicksort
* returns the new number of elements */
/** performs a inplace unique of a vector of type T using quicksort
* returns the new number of elements
*/
static int32_t unique(T* output, int32_t size);

/** display array size */
Expand Down Expand Up @@ -498,8 +501,10 @@ template<class T> class SGVector : public SGReferencedData
/** Helper functor for the function sorted_index */
struct IndexSorter
{
/** constructor */
IndexSorter(const SGVector<T> *vec) { data = vec->vector; }

/** access operator */
bool operator() (index_t i, index_t j) const
{
return data[i] < data[j];
Expand Down
5 changes: 5 additions & 0 deletions src/shogun/machine/KernelMachine.h
Expand Up @@ -292,6 +292,11 @@ class CKernelMachine : public CMachine

protected:

/** apply get outputs
*
* @param data features to compute outputs
* @return outputs
*/
SGVector<float64_t> apply_get_outputs(CFeatures* data);

/** Stores feature data of the SV indices and sets it to the lhs of the
Expand Down
5 changes: 5 additions & 0 deletions src/shogun/machine/LinearMachine.h
Expand Up @@ -157,6 +157,11 @@ class CLinearMachine : public CMachine

protected:

/** apply get outputs
*
* @param data features to compute outputs
* @return outputs
*/
virtual SGVector<float64_t> apply_get_outputs(CFeatures* data);

/** Stores feature data of underlying model. Does nothing because
Expand Down
7 changes: 6 additions & 1 deletion src/shogun/machine/Machine.h
Expand Up @@ -243,9 +243,13 @@ class CMachine : public CSGObject
*/
virtual CLabels* apply_locked(SGVector<index_t> indices);

virtual CBinaryLabels* apply_locked_binary(SGVector<index_t> indices);
/** applies a locked machine on a set of indices for binary problems */
virtual CBinaryLabels* apply_locked_binary(
SGVector<index_t> indices);
/** applies a locked machine on a set of indices for regression problems */
virtual CRegressionLabels* apply_locked_regression(
SGVector<index_t> indices);
/** applies a locked machine on a set of indices for multiclass problems */
virtual CMulticlassLabels* apply_locked_multiclass(
SGVector<index_t> indices);

Expand Down Expand Up @@ -333,6 +337,7 @@ class CMachine : public CSGObject
return true;
}

/** returns whether machine require labels for training */
virtual bool train_require_labels() const { return true; }

protected:
Expand Down
2 changes: 0 additions & 2 deletions src/shogun/regression/gp/FITCInferenceMethod.cpp
Expand Up @@ -47,8 +47,6 @@ void CFITCInferenceMethod::init()
{
m_latent_features = NULL;
m_ind_noise = 1e-10;
SG_ADD((CSGObject**)&m_latent_features, "latent_features",
"Latent Features", MS_NOT_AVAILABLE);
}

CFITCInferenceMethod::~CFITCInferenceMethod()
Expand Down

0 comments on commit df8cd27

Please sign in to comment.