[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost-commit
Subject:    [Boost-commit] svn:boost r50916 - in trunk/libs/numeric/ublas/doc:
From:       guwi17 () gmx ! de
Date:       2009-01-30 21:12:33
Message-ID: 20090130211233.97FF93B000D () wowbagger ! osl ! iu ! edu
[Download RAW message or body]

Author: guwi17
Date: 2009-01-30 16:12:32 EST (Fri, 30 Jan 2009)
New Revision: 50916
URL: http://svn.boost.org/trac/boost/changeset/50916

Log:
* fix and close #2686

* replaced the word "upper" by "lower" because the description is for lower triangular matrices

* added more detailed example for the use of triangular matrices and adaptors


Added:
   trunk/libs/numeric/ublas/doc/samples/ex_triangular.cpp   (contents, props changed)
Text files modified: 
   trunk/libs/numeric/ublas/doc/samples/Jamfile.v2 |     4 ++++                                    
   trunk/libs/numeric/ublas/doc/triangular.htm     |     6 +++++-                                  
   2 files changed, 9 insertions(+), 1 deletions(-)

Modified: trunk/libs/numeric/ublas/doc/samples/Jamfile.v2
==============================================================================
--- trunk/libs/numeric/ublas/doc/samples/Jamfile.v2	(original)
+++ trunk/libs/numeric/ublas/doc/samples/Jamfile.v2	2009-01-30 16:12:32 EST (Fri, 30 Jan 2009)
@@ -222,3 +222,7 @@
 exe triangular_adaptor
     : triangular_adaptor.cpp
     ;
+
+exe ex_triangular
+    : ex_triangular.cpp
+    ;

Added: trunk/libs/numeric/ublas/doc/samples/ex_triangular.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/numeric/ublas/doc/samples/ex_triangular.cpp	2009-01-30 16:12:32 EST (Fri, 30 Jan 2009)
@@ -0,0 +1,58 @@
+//          Copyright Gunter Winkler 2004 - 2009.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <iostream>
+
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/triangular.hpp>
+
+#include <boost/numeric/ublas/io.hpp>
+
+using std::cout;
+using std::endl;
+
+
+
+namespace ublas = boost::numeric::ublas;
+
+
+int main(int argc, char * argv[] ) {
+
+  ublas::matrix<double> M (3, 3);
+  for (std::size_t i=0; i < M.data().size(); ++i) { M.data()[i] = 1+i ; }
+
+  std::cout << "full         M  = " << M << "\n" ;
+
+  ublas::triangular_matrix<double, ublas::lower> L;
+  ublas::triangular_matrix<double, ublas::unit_lower> UL;
+  ublas::triangular_matrix<double, ublas::strict_lower> SL;
+  
+  L  = ublas::triangular_adaptor<ublas::matrix<double>, ublas::lower> (M);
+  SL = ublas::triangular_adaptor<ublas::matrix<double>, ublas::strict_lower> (M); 
+  UL = ublas::triangular_adaptor<ublas::matrix<double>, ublas::unit_lower> (M);  
+  
+  std::cout << "lower        L  = " << L << "\n" 
+            << "strict lower SL = " << SL << "\n" 
+            << "unit lower   UL = " << UL << "\n" ;
+
+  ublas::triangular_matrix<double, ublas::upper> U;
+  ublas::triangular_matrix<double, ublas::unit_upper> UU;
+  ublas::triangular_matrix<double, ublas::strict_upper> SU;
+  
+  U =  ublas::triangular_adaptor<ublas::matrix<double>, ublas::upper> (M);
+  SU = ublas::triangular_adaptor<ublas::matrix<double>, ublas::strict_upper> (M); 
+  UU = ublas::triangular_adaptor<ublas::matrix<double>, ublas::unit_upper> (M);  
+
+  std::cout << "upper        U  = " << U << "\n" 
+            << "strict upper SU = " << SU << "\n" 
+            << "unit upper   UU = " << UU << "\n" ;
+
+  std::cout << "M = L + SU ? " << ((norm_inf( M - (L + SU) ) == 0.0)?"ok":"failed") << "\n";
+  std::cout << "M = U + SL ? " << ((norm_inf( M - (U + SL) ) == 0.0)?"ok":"failed") << "\n";
+
+}
+
+

Modified: trunk/libs/numeric/ublas/doc/triangular.htm
==============================================================================
--- trunk/libs/numeric/ublas/doc/triangular.htm	(original)
+++ trunk/libs/numeric/ublas/doc/triangular.htm	2009-01-30 16:12:32 EST (Fri, 30 Jan 2009)
@@ -21,7 +21,7 @@
 <em>t</em><sub><em>i, j</em></sub> <em>= 0</em> , if <em>i &gt;
 j</em>. If furthermore holds t<sub><em>i, i</em></sub><em>= 1</em>
 the matrix is called unit lower triangular. For a <em>(n x n</em>
-)-dimensional upper triangular matrix and <em>0 &lt;= i &lt;
+)-dimensional lower triangular matrix and <em>0 &lt;= i &lt;
 n</em>,<em>0 &lt;= j &lt; n</em> holds <em>t</em><sub><em>i,
 j</em></sub> <em>= 0</em> , if <em>i &lt; j</em>. If furthermore
 holds t<sub><em>i, i</em></sub><em>= 1</em> the matrix is called
@@ -46,6 +46,8 @@
     std::cout &lt;&lt; mu &lt;&lt; std::endl;
 }
 </pre>
+<p>Please read the <a href="samples/ex_triangular.cpp">full triangular example</a> for more details.</p>
+
 <h4>Definition</h4>
 <p>Defined in the header triangular.hpp.</p>
 <h4>Template parameters</h4>
@@ -348,6 +350,8 @@
     std::cout &lt;&lt; tau &lt;&lt; std::endl;
 }
 </pre>
+<p>Please read the <a href="samples/ex_triangular.cpp">full triangular example</a> for more details.</p>
+
 <h4>Definition</h4>
 <p>Defined in the header triangular.hpp.</p>
 <h4>Template parameters</h4>
_______________________________________________
Boost-commit mailing list
Boost-commit@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic