Changeset 30
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Makefile.am
r29 r30 6 6 7 7 libc___tools_a_SOURCES = matrix.cc vector.cc SVD.cc PCA.cc \ 8 random_singleton.cc histogram.cc Kernel.cc PolynomialKernelFunction.cc\9 SVM.cc8 random_singleton.cc histogram.cc Kernel.cc\ 9 PolynomialKernelFunction.cc SVM.cc 10 10 11 11 INCLUDES = -I/usr/local_bio/include -I/usr/local_bio 12 13 AM_CXXFLAGS = -g -
trunk/src/PolynomialKernelFunction.cc
r25 r30 31 31 nof_valid_datapairs++; 32 32 } 33 cout << nof_valid_datapairs << endl;33 //cout << nof_valid_datapairs << endl; 34 34 if (nof_valid_datapairs == 0) 35 35 cerr << "data file error: two columns " 36 36 << " have no pair of valid data\n"; 37 tmp/=nof_valid_datapairs * a.size(); 37 38 tmp/=nof_valid_datapairs / a.size(); //correcting for missing values 39 38 40 if(order_>1) 39 41 return pow(1+tmp,order_); -
trunk/src/PolynomialKernelFunction.h
r26 r30 27 27 PolynomialKernelFunction(int = 1); 28 28 /** 29 Destructor 30 */ 31 virtual ~PolynomialKernelFunction(void) {}; 32 /** 29 33 returning the scalar product of two vectors in feature space using 30 34 the polynomial kernel. -
trunk/src/matrix.cc
r29 r30 85 85 is.clear(std::ios::goodbit); 86 86 // convert the data to a gsl matrix 87 cout << "nof_rows: " << nof_rows << ", nof_columns: " << nof_columns88 << endl;89 87 m_ = gsl_matrix_alloc ( nof_rows, nof_columns ); 90 88 for(u_int i=0;i<nof_rows;i++) … … 325 323 return v_sum; 326 324 } 325 326 vector matrix::operator[]( const size_t& i ) const 327 { 328 gsl_vector* tmp_vector = gsl_vector_calloc( cols() ); 329 assert( i >= 0 && i < rows() ); 330 gsl_matrix_get_row( tmp_vector, m_, i ); 331 return vector( tmp_vector ); 332 } 333 334 -
trunk/src/matrix.h
r21 r30 215 215 friend std::ostream& operator<< ( std::ostream& s_out, const matrix& ); 216 216 217 218 219 217 /** 218 Getting vector operator 219 */ 220 vector operator[]( const size_t& i ) const; 221 220 222 private: 221 223 gsl_matrix* new_copy( const gsl_matrix* ); … … 232 234 233 235 #endif 234 235 -
trunk/src/vector.cc
r28 r30 65 65 while (line >> tmp_string) { 66 66 if(!is.good()) { 67 cerr << " matrix::matrix(std::istream&): "67 cerr << "vector::vector(std::istream&): " 68 68 << "error reading data file!" << endl; 69 69 exit(1); … … 85 85 data_matrix.push_back(v); 86 86 } 87 87 88 // manipulate the state of the stream to be good 89 is.clear(std::ios::goodbit); 90 88 91 // convert the data to a gsl vector and check that data file is a 89 92 // column vector or a row vector … … 166 169 } 167 170 168 171 vector vector::operator-() const 172 { 173 vector res( *this ); 174 gsl_vector_scale (res.get_gsl_vector() , -1.); 175 return res; 176 } 169 177 double vector::operator*( const vector &other ) const 170 178 { -
trunk/src/vector.h
r28 r30 114 114 115 115 /** 116 set_all( val ) will make vi = val in matrix A116 set_all( val ) will make vi = val in vector v 117 117 for all "i" 118 118 */ … … 153 153 int operator/=( const double& c ); 154 154 int operator/=( const vector& other ) const; 155 vector operator-() const; 155 156 /** 156 157 This operator is implemented as dot-product.
Note: See TracChangeset
for help on using the changeset viewer.