 Timestamp:
 Sep 9, 2008, 3:39:43 PM (13 years ago)
 Location:
 trunk/yat/classifier
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/classifier/MatrixLookupWeighted.cc
r1437 r1482 26 26 #include "MatrixLookupWeighted.h" 27 27 #include "MatrixLookup.h" 28 #include "yat/utility/DataIterator.h" 28 29 #include "yat/utility/Matrix.h" 29 30 #include "yat/utility/MatrixWeighted.h" 31 #include "yat/utility/WeightIterator.h" 32 33 #include <algorithm> 30 34 #include <cassert> 31 35 #include <fstream> … … 35 39 namespace yat { 36 40 namespace classifier { 41 42 MatrixLookupWeighted::MatrixLookupWeighted(const utility::MatrixWeighted& m, 43 const utility::Index& rows, 44 const utility::Index& columns) 45 : column_index_(columns), row_index_(rows) 46 { 47 utility::Matrix* data = new utility::Matrix(m.rows(), m.columns()); 48 utility::Matrix* weight = new utility::Matrix(m.rows(), m.columns()); 49 for (size_t i=0; i<m.rows(); ++i) 50 for (size_t j=0; j<m.columns(); ++j) { 51 (*data)(i,j) = m(i,j).data(); 52 (*weight)(i,j) = m(i,j).weight(); 53 } 54 // smart pointers are taking ownership 55 data_ = MatrixP(data); 56 weights_ = MatrixP(weight); 57 } 58 59 60 MatrixLookupWeighted::MatrixLookupWeighted(const utility::MatrixWeighted& m) 61 : column_index_(utility::Index(m.columns())), 62 row_index_(utility::Index(m.rows())) 63 { 64 utility::Matrix* data = new utility::Matrix(m.rows(), m.columns()); 65 utility::Matrix* weight = new utility::Matrix(m.rows(), m.columns()); 66 for (size_t i=0; i<m.rows(); ++i) 67 for (size_t j=0; j<m.columns(); ++j) { 68 (*data)(i,j) = m(i,j).data(); 69 (*weight)(i,j) = m(i,j).weight(); 70 } 71 // smart pointers are taking ownership 72 data_ = MatrixP(data); 73 weights_ = MatrixP(weight); 74 } 75 37 76 38 77 MatrixLookupWeighted::MatrixLookupWeighted(const utility::Matrix& data, 
trunk/yat/classifier/MatrixLookupWeighted.h
r1437 r1482 41 41 42 42 namespace utility { 43 class Index; 43 44 class Matrix; 45 class MatrixWeighted; 44 46 } 45 47 … … 92 94 typedef const_iterator const_row_iterator; 93 95 96 /** 97 \brief Create a lookup into \a matrix. 98 99 The created lookup, mlw, will fullfil: mlw(i,j) = 100 matrix(rows(i), columns(j)) 101 */ 102 MatrixLookupWeighted(const utility::MatrixWeighted& matrix, 103 const utility::Index& rows, 104 const utility::Index& columns); 105 106 /** 107 \brief Create a lookup into entire \a matrix. 108 */ 109 MatrixLookupWeighted(const utility::MatrixWeighted& matrix); 110 94 111 /// 95 112 /// Constructor creating a lookup into the entire \a matrix and \a
Note: See TracChangeset
for help on using the changeset viewer.