|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59157 - sandbox/numeric_bindings/libs/numeric/bindings/atlas
From: rutger_at_[hidden]
Date: 2010-01-20 09:51:10
Author: rutger
Date: 2010-01-20 09:51:10 EST (Wed, 20 Jan 2010)
New Revision: 59157
URL: http://svn.boost.org/trac/boost/changeset/59157
Log:
Extended the gesv5 case a bit (so we have more differentation in dimensions / sizes / strides ), for testing / debugging purposes
Text files modified:
sandbox/numeric_bindings/libs/numeric/bindings/atlas/ublas_gesv5.cc | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
Modified: sandbox/numeric_bindings/libs/numeric/bindings/atlas/ublas_gesv5.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/atlas/ublas_gesv5.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/atlas/ublas_gesv5.cc 2010-01-20 09:51:10 EST (Wed, 20 Jan 2010)
@@ -22,7 +22,7 @@
typedef ublas::c_matrix<double, 4, 4> m4x4_t;
typedef ublas::c_matrix<double, 3, 3> m3x3_t;
-typedef ublas::c_matrix<double, 1, 3> mrhs_t;
+typedef ublas::c_matrix<double, 3, 2> mrhs_t;
typedef ublas::c_vector<double, 5> v5_t;
int main() {
@@ -31,28 +31,47 @@
size_t n = 3;
m4x4_t a (n, n); // system matrix
+
+// [,1] [,2] [,3]
+// [1,] 1 1 1
+// [2,] 2 3 1
+// [3,] 1 -1 -1
+
a(0,0) = 1.; a(0,1) = 1.; a(0,2) = 1.;
a(1,0) = 2.; a(1,1) = 3.; a(1,2) = 1.;
a(2,0) = 1.; a(2,1) = -1.; a(2,2) = -1.;
- mrhs_t b (1, n); // right-hand side vector
- b(0,0) = 4.;
- b(0,1) = 9.;
- b(0,2) = -2.;
+ mrhs_t b (n, 2); // right-hand side matrix
+
+// [,1] [,2]
+// [1,] 4 10
+// [2,] 9 11
+// [3,] 2 12
+
+ b(0,0) = 4.; b(0,1) = 10.;
+ b(1,0) = 9.; b(1,1) = 11.;
+ b(2,0) = -2.; b(2,1) = 12.;
#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
m3x3_t a2; // for part 2
a2 = project (a, ublas::range (0,3), ublas::range (0,3));
v5_t b2 (n);
- b2 = row (b, 0);
+ b2 = column (b, 0);
#endif
// part 1:
cout << "A: " << a << endl;
cout << "B: " << b << endl;
- std::vector< int > pivota( bindings::size1( a ) );
+ std::vector< int > pivota( 100 );
lapack::gesv (a, pivota, b);
+
+// X should be
+// [,1] [,2]
+// [1,] 3 11
+// [2,] 1 -5
+// [3,] 0 4
+
cout << "X: " << b << endl;
cout << endl;
@@ -62,8 +81,8 @@
cout << "A: " << a2 << endl;
cout << "B: " << b2 << endl;
- std::vector< int > pivota2( bindings::size1( a2 ) );
- lapack::gesv (a2, pivota2, b2);
+ std::vector< int > pivota2( 100 );
+ lapack::gesv (a2, pivota2, b2);
cout << "X: " << b2 << endl;
cout << endl;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk