summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-21 19:49:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-21 19:49:32 +0000
commit178dafefa9057ea0eb16e89d5f703e6077b2ddab (patch)
tree4b4b57421de5b71a5cc54701d625da0bc734bd40 /ext/bigdecimal/lib/bigdecimal/ludcmp.rb
parentd9bfa822ea7e23dcc0dd1572773495419d89e145 (diff)
* ext/bigdecimal/lib/*.rb: fixed indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/lib/bigdecimal/ludcmp.rb')
-rw-r--r--ext/bigdecimal/lib/bigdecimal/ludcmp.rb38
1 files changed, 19 insertions, 19 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
index 176ed84caf..e18446d55b 100644
--- a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
+++ b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb
@@ -12,24 +12,24 @@ module LUSolve
nrmrow = zero
ixn = i*n
for j in 0...n do
- biggst = a[ixn+j].abs
- nrmrow = biggst if biggst>nrmrow
+ biggst = a[ixn+j].abs
+ nrmrow = biggst if biggst>nrmrow
end
if nrmrow>zero then
- scales <<= one.div(nrmrow,prec)
+ scales <<= one.div(nrmrow,prec)
else
- raise "Singular matrix"
+ raise "Singular matrix"
end
end
n1 = n - 1
for k in 0...n1 do # Gaussian elimination with partial pivoting.
biggst = zero;
for i in k...n do
- size = a[ps[i]*n+k].abs*scales[ps[i]]
- if size>biggst then
- biggst = size
- pividx = i
- end
+ size = a[ps[i]*n+k].abs*scales[ps[i]]
+ if size>biggst then
+ biggst = size
+ pividx = i
+ end
end
raise "Singular matrix" if biggst<=zero
if pividx!=k then
@@ -42,10 +42,10 @@ module LUSolve
psin = ps[i]*n
a[psin+k] = mult = a[psin+k].div(pivot,prec)
if mult!=zero then
- pskn = ps[k]*n
- for j in (k+1)...n do
- a[psin+j] -= mult.mult(a[pskn+j],prec)
- end
+ pskn = ps[k]*n
+ for j in (k+1)...n do
+ a[psin+j] -= mult.mult(a[pskn+j],prec)
+ end
end
end
end
@@ -72,12 +72,12 @@ module LUSolve
x <<= b[ps[i]] - dot
end
(n-1).downto(0) do |i|
- dot = zero
- psin = ps[i]*n
- for j in (i+1)...n do
- dot = a[psin+j].mult(x[j],prec) + dot
- end
- x[i] = (x[i]-dot).div(a[psin+i],prec)
+ dot = zero
+ psin = ps[i]*n
+ for j in (i+1)...n do
+ dot = a[psin+j].mult(x[j],prec) + dot
+ end
+ x[i] = (x[i]-dot).div(a[psin+i],prec)
end
x
end