summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-29 09:09:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-29 09:09:33 +0000
commit60bf66e0cd2c9f519f7dfb27eca134b86ea5dd8b (patch)
treedcc53a834964d3813864acd28a1cecd6777d74d2 /ext/bigdecimal/lib/bigdecimal/ludcmp.rb
parent0c11152794d4f07970a5c36981e95eb176d5fdc8 (diff)
* ext/bigdecimal/bigdecimal.c: add RDoc document. a patch from
mathew <meta at pobox.com>. [ruby-core:07050] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/lib/bigdecimal/ludcmp.rb')
-rw-r--r--ext/bigdecimal/lib/bigdecimal/ludcmp.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
index 1d5d3170ccf..8f4888725ef 100644
--- a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
+++ b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
@@ -1,7 +1,8 @@
#
-# ludcmp.rb
+# Solves a*x = b for x, using LU decomposition.
#
module LUSolve
+ # Performs LU decomposition of the n by n matrix a.
def ludecomp(a,n,zero=0,one=1)
prec = BigDecimal.limit(nil)
ps = []
@@ -52,6 +53,12 @@ module LUSolve
ps
end
+ # Solves a*x = b for x, using LU decomposition.
+ #
+ # a is a matrix, b is a constant vector, x is the solution vector.
+ #
+ # ps is the pivot, a vector which indicates the permutation of rows performed
+ # during LU decomposition.
def lusolve(a,b,ps,zero=0.0)
prec = BigDecimal.limit(nil)
n = ps.size