Changeset 808
- Timestamp:
- Mar 15, 2007, 9:07:01 PM (16 years ago)
- Location:
- trunk/yat
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/classifier/NBC.cc
r768 r808 106 106 assert(data_.rows()==input.rows()); 107 107 108 // utility 109 //for (size_t i=0; 110 111 108 112 prediction = utility::matrix(centroids_.columns(),input.columns()); 109 113 for (size_t c=0; c<centroids_.columns(); ++c) { -
trunk/yat/classifier/NBC.h
r768 r808 82 82 83 83 84 / //85 /// For each sample, calculate the probabilies the sample belong86 ///to the corresponding class.87 ///84 /** 85 For each sample, calculate the probabilities the sample belong 86 to the corresponding class. 87 */ 88 88 void predict(const DataLookup2D& data, utility::matrix& res) const; 89 89 -
trunk/yat/utility/matrix.cc
r796 r808 5 5 Copyright (C) 2004 Jari Häkkinen, Peter Johansson 6 6 Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér 7 Copyright (C) 2007 Jari Häkkinen 7 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 8 8 9 9 This file is part of the yat library, http://lev.thep.lu.se/trac/yat … … 269 269 270 270 271 void matrix::resize(size_t r, size_t c, double init_value) 272 { 273 if (view_) 274 delete view_; 275 else if (view_const_) 276 delete view_const_; 277 else if (m_) 278 gsl_matrix_free(m_); 279 proxy_m_ = m_ = gsl_matrix_alloc(r,c); 280 if (!m_) 281 throw utility::GSL_error("matrix::matrix failed to allocate memory"); 282 set_all(init_value); 283 284 // no need to delete blas_result_ if the number of rows fit, it 285 // may be useful later. 286 if (blas_result_ && (blas_result_->size1!=rows())) { 287 gsl_matrix_free(blas_result_); 288 blas_result_=NULL; 289 } 290 } 291 292 271 293 size_t matrix::rows(void) const 272 294 { -
trunk/yat/utility/matrix.h
r792 r808 9 9 Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér 10 10 Copyright (C) 2006 Jari Häkkinen, Peter Johansson 11 Copyright (C) 2007 Jari Häkkinen 11 Copyright (C) 2007 Jari Häkkinen, Peter Johansson 12 12 13 13 This file is part of the yat library, http://lev.thep.lu.se/trac/yat … … 146 146 147 147 This function will make a deep copy of \a other. Memory is 148 resized and view state is changed if needed.148 resized and view state is changed to same as in other. 149 149 */ 150 150 const matrix& clone(const matrix& other); … … 201 201 */ 202 202 void mul(const matrix& b); 203 204 /// 205 /// @breif resize matrix 206 /// 207 /// All elements are set to @a init_value. 208 /// 209 void resize(size_t, size_t, double init_value=0); 203 210 204 211 /// -
trunk/yat/utility/vector.cc
r791 r808 291 291 292 292 293 void vector::resize(size_t n, double init_value) 294 { 295 if (view_) 296 delete view_; 297 else if (view_const_) 298 delete view_const_; 299 else if (v_) 300 gsl_vector_free(v_); 301 proxy_v_ = v_ = gsl_vector_alloc(n); 302 303 if (!v_) 304 throw utility::GSL_error("vector::vector failed to allocate memory"); 305 set_all(init_value); 306 } 307 308 293 309 void vector::reverse(void) 294 310 { -
trunk/yat/utility/vector.h
r791 r808 267 267 void mul(const vector& other); 268 268 269 /// 270 /// @breif resize vector 271 /// 272 /// All elements are set to @a init_value. 273 /// 274 void resize(size_t, double init_value=0); 275 269 276 /** 270 277 \brief Reverse the order of elements in the vector.
Note: See TracChangeset
for help on using the changeset viewer.