Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/numeric/ublas/lu.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
61 | 61 |
62 template<class PM, class MV> | 62 template<class PM, class MV> |
63 BOOST_UBLAS_INLINE | 63 BOOST_UBLAS_INLINE |
64 void swap_rows (const PM &pm, MV &mv, vector_tag) { | 64 void swap_rows (const PM &pm, MV &mv, vector_tag) { |
65 typedef typename PM::size_type size_type; | 65 typedef typename PM::size_type size_type; |
66 typedef typename MV::value_type value_type; | |
67 | 66 |
68 size_type size = pm.size (); | 67 size_type size = pm.size (); |
69 for (size_type i = 0; i < size; ++ i) { | 68 for (size_type i = 0; i < size; ++ i) { |
70 if (i != pm (i)) | 69 if (i != pm (i)) |
71 std::swap (mv (i), mv (pm (i))); | 70 std::swap (mv (i), mv (pm (i))); |
73 } | 72 } |
74 template<class PM, class MV> | 73 template<class PM, class MV> |
75 BOOST_UBLAS_INLINE | 74 BOOST_UBLAS_INLINE |
76 void swap_rows (const PM &pm, MV &mv, matrix_tag) { | 75 void swap_rows (const PM &pm, MV &mv, matrix_tag) { |
77 typedef typename PM::size_type size_type; | 76 typedef typename PM::size_type size_type; |
78 typedef typename MV::value_type value_type; | |
79 | 77 |
80 size_type size = pm.size (); | 78 size_type size = pm.size (); |
81 for (size_type i = 0; i < size; ++ i) { | 79 for (size_type i = 0; i < size; ++ i) { |
82 if (i != pm (i)) | 80 if (i != pm (i)) |
83 row (mv, i).swap (row (mv, pm (i))); | 81 row (mv, i).swap (row (mv, pm (i))); |
91 } | 89 } |
92 | 90 |
93 // LU factorization without pivoting | 91 // LU factorization without pivoting |
94 template<class M> | 92 template<class M> |
95 typename M::size_type lu_factorize (M &m) { | 93 typename M::size_type lu_factorize (M &m) { |
96 typedef M matrix_type; | 94 |
97 typedef typename M::size_type size_type; | 95 typedef typename M::size_type size_type; |
98 typedef typename M::value_type value_type; | 96 typedef typename M::value_type value_type; |
99 | 97 |
100 #if BOOST_UBLAS_TYPE_CHECK | 98 #if BOOST_UBLAS_TYPE_CHECK |
99 typedef M matrix_type; | |
101 matrix_type cm (m); | 100 matrix_type cm (m); |
102 #endif | 101 #endif |
103 size_type singular = 0; | 102 size_type singular = 0; |
104 size_type size1 = m.size1 (); | 103 size_type size1 = m.size1 (); |
105 size_type size2 = m.size2 (); | 104 size_type size2 = m.size2 (); |
127 } | 126 } |
128 | 127 |
129 // LU factorization with partial pivoting | 128 // LU factorization with partial pivoting |
130 template<class M, class PM> | 129 template<class M, class PM> |
131 typename M::size_type lu_factorize (M &m, PM &pm) { | 130 typename M::size_type lu_factorize (M &m, PM &pm) { |
132 typedef M matrix_type; | |
133 typedef typename M::size_type size_type; | 131 typedef typename M::size_type size_type; |
134 typedef typename M::value_type value_type; | 132 typedef typename M::value_type value_type; |
135 | 133 |
136 #if BOOST_UBLAS_TYPE_CHECK | 134 #if BOOST_UBLAS_TYPE_CHECK |
135 typedef M matrix_type; | |
137 matrix_type cm (m); | 136 matrix_type cm (m); |
138 #endif | 137 #endif |
139 size_type singular = 0; | 138 size_type singular = 0; |
140 size_type size1 = m.size1 (); | 139 size_type size1 = m.size1 (); |
141 size_type size2 = m.size2 (); | 140 size_type size2 = m.size2 (); |
263 } | 262 } |
264 | 263 |
265 // LU substitution | 264 // LU substitution |
266 template<class M, class E> | 265 template<class M, class E> |
267 void lu_substitute (const M &m, vector_expression<E> &e) { | 266 void lu_substitute (const M &m, vector_expression<E> &e) { |
267 #if BOOST_UBLAS_TYPE_CHECK | |
268 typedef const M const_matrix_type; | 268 typedef const M const_matrix_type; |
269 typedef vector<typename E::value_type> vector_type; | 269 typedef vector<typename E::value_type> vector_type; |
270 | 270 |
271 #if BOOST_UBLAS_TYPE_CHECK | |
272 vector_type cv1 (e); | 271 vector_type cv1 (e); |
273 #endif | 272 #endif |
274 inplace_solve (m, e, unit_lower_tag ()); | 273 inplace_solve (m, e, unit_lower_tag ()); |
275 #if BOOST_UBLAS_TYPE_CHECK | 274 #if BOOST_UBLAS_TYPE_CHECK |
276 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (triangular_adaptor<const_matrix_type, unit_lower> (m), e), cv1), internal_logic ()); | 275 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (triangular_adaptor<const_matrix_type, unit_lower> (m), e), cv1), internal_logic ()); |
281 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (triangular_adaptor<const_matrix_type, upper> (m), e), cv2), internal_logic ()); | 280 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (triangular_adaptor<const_matrix_type, upper> (m), e), cv2), internal_logic ()); |
282 #endif | 281 #endif |
283 } | 282 } |
284 template<class M, class E> | 283 template<class M, class E> |
285 void lu_substitute (const M &m, matrix_expression<E> &e) { | 284 void lu_substitute (const M &m, matrix_expression<E> &e) { |
285 #if BOOST_UBLAS_TYPE_CHECK | |
286 typedef const M const_matrix_type; | 286 typedef const M const_matrix_type; |
287 typedef matrix<typename E::value_type> matrix_type; | 287 typedef matrix<typename E::value_type> matrix_type; |
288 | 288 |
289 #if BOOST_UBLAS_TYPE_CHECK | |
290 matrix_type cm1 (e); | 289 matrix_type cm1 (e); |
291 #endif | 290 #endif |
292 inplace_solve (m, e, unit_lower_tag ()); | 291 inplace_solve (m, e, unit_lower_tag ()); |
293 #if BOOST_UBLAS_TYPE_CHECK | 292 #if BOOST_UBLAS_TYPE_CHECK |
294 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (triangular_adaptor<const_matrix_type, unit_lower> (m), e), cm1), internal_logic ()); | 293 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (triangular_adaptor<const_matrix_type, unit_lower> (m), e), cm1), internal_logic ()); |
304 swap_rows (pm, mv); | 303 swap_rows (pm, mv); |
305 lu_substitute (m, mv); | 304 lu_substitute (m, mv); |
306 } | 305 } |
307 template<class E, class M> | 306 template<class E, class M> |
308 void lu_substitute (vector_expression<E> &e, const M &m) { | 307 void lu_substitute (vector_expression<E> &e, const M &m) { |
308 #if BOOST_UBLAS_TYPE_CHECK | |
309 typedef const M const_matrix_type; | 309 typedef const M const_matrix_type; |
310 typedef vector<typename E::value_type> vector_type; | 310 typedef vector<typename E::value_type> vector_type; |
311 | 311 |
312 #if BOOST_UBLAS_TYPE_CHECK | |
313 vector_type cv1 (e); | 312 vector_type cv1 (e); |
314 #endif | 313 #endif |
315 inplace_solve (e, m, upper_tag ()); | 314 inplace_solve (e, m, upper_tag ()); |
316 #if BOOST_UBLAS_TYPE_CHECK | 315 #if BOOST_UBLAS_TYPE_CHECK |
317 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (e, triangular_adaptor<const_matrix_type, upper> (m)), cv1), internal_logic ()); | 316 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (e, triangular_adaptor<const_matrix_type, upper> (m)), cv1), internal_logic ()); |
322 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (e, triangular_adaptor<const_matrix_type, unit_lower> (m)), cv2), internal_logic ()); | 321 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (e, triangular_adaptor<const_matrix_type, unit_lower> (m)), cv2), internal_logic ()); |
323 #endif | 322 #endif |
324 } | 323 } |
325 template<class E, class M> | 324 template<class E, class M> |
326 void lu_substitute (matrix_expression<E> &e, const M &m) { | 325 void lu_substitute (matrix_expression<E> &e, const M &m) { |
326 #if BOOST_UBLAS_TYPE_CHECK | |
327 typedef const M const_matrix_type; | 327 typedef const M const_matrix_type; |
328 typedef matrix<typename E::value_type> matrix_type; | 328 typedef matrix<typename E::value_type> matrix_type; |
329 | 329 |
330 #if BOOST_UBLAS_TYPE_CHECK | |
331 matrix_type cm1 (e); | 330 matrix_type cm1 (e); |
332 #endif | 331 #endif |
333 inplace_solve (e, m, upper_tag ()); | 332 inplace_solve (e, m, upper_tag ()); |
334 #if BOOST_UBLAS_TYPE_CHECK | 333 #if BOOST_UBLAS_TYPE_CHECK |
335 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (e, triangular_adaptor<const_matrix_type, upper> (m)), cm1), internal_logic ()); | 334 BOOST_UBLAS_CHECK (detail::expression_type_check (prod (e, triangular_adaptor<const_matrix_type, upper> (m)), cm1), internal_logic ()); |