Changeset 1706
- Timestamp:
- Jan 8, 2009, 10:36:27 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/matrix_weighted_test.cc
r1487 r1706 2 2 3 3 /* 4 Copyright (C) 2008 Peter Johansson4 Copyright (C) 2008, 2009 Peter Johansson 5 5 6 6 This file is part of the yat library, http://dev.thep.lu.se/yat … … 32 32 void test_constructor_const(test::Suite& suite); 33 33 void test_constructor_matrix(test::Suite& suite); 34 void test_swap(test::Suite& suite); 34 35 35 36 int main(int argc, char* argv[]) … … 40 41 test_constructor_const(suite); 41 42 test_constructor_matrix(suite); 43 test_swap(suite); 42 44 43 45 suite.return_value(); … … 92 94 } 93 95 96 void test_swap(test::Suite& suite) 97 { 98 MatrixWeighted x(3,10); 99 MatrixWeighted y(0,0); 100 x.swap(y); 101 suite.add(x.columns()==0); 102 suite.add(x.rows()==0); 103 suite.add(y.columns()==10); 104 suite.add(y.rows()==3); 105 } 94 106 107 -
trunk/yat/utility/MatrixWeighted.cc
r1589 r1706 6 6 Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér 7 7 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009 Peter Johansson 8 9 9 10 This file is part of the yat library, http://dev.thep.lu.se/yat … … 167 168 168 169 170 void MatrixWeighted::swap(MatrixWeighted& other) 171 { 172 std::swap(vec_, other.vec_); 173 std::swap(columns_, other.columns_); 174 } 175 176 169 177 void MatrixWeighted::resize(size_t rows, size_t columns) 170 178 { … … 199 207 } 200 208 209 210 void swap(MatrixWeighted& lhs, MatrixWeighted& rhs) 211 { 212 lhs.swap(rhs); 213 } 214 201 215 }}} // of namespace utility, yat and thep -
trunk/yat/utility/MatrixWeighted.h
r1589 r1706 9 9 Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér 10 10 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 11 Copyright (C) 2009 Peter Johansson 11 12 12 13 This file is part of the yat library, http://dev.thep.lu.se/yat … … 114 115 115 116 /** 116 \brief The istreamconstructor.117 \brief constructor. 117 118 118 119 Data is copied from \a other and weights are calculated using … … 210 211 211 212 /** 213 \brief swap objects 214 215 Takes constant time. Invalidates iterators. 216 */ 217 void swap(MatrixWeighted& other); 218 219 /** 212 220 \brief Resize Matrix 213 221 … … 258 266 Takes constant time. 259 267 260 \ throw std::runtime_error if the two matrices disagree in size.268 \see MatrixWeighted::swap(MatrixWeighted&) 261 269 */ 262 270 void swap(MatrixWeighted&, MatrixWeighted&);
Note: See TracChangeset
for help on using the changeset viewer.