Examples update to conform to new semantic of multiplication operator. - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/examples/eigensystems.lua
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2011年02月09日 14:12:08 +0100
committerfrancesco-ST <francesco.abbate@st.com>2011年02月09日 14:12:08 +0100
commit7b42e27a13e86b32e0ad1a86cdb05ba93993b45d (patch)
tree82cc5ad66f863ee9e97b9c6dc7c2a366e570121e /examples/eigensystems.lua
parent94bc532ac06039825456a1645b5aa754fe447ff0 (diff)
downloadgsl-shell-7b42e27a13e86b32e0ad1a86cdb05ba93993b45d.tar.gz
Examples update to conform to new semantic of multiplication operator.
Diffstat (limited to 'examples/eigensystems.lua')
-rw-r--r--examples/eigensystems.lua 22
1 files changed, 12 insertions, 10 deletions
diff --git a/examples/eigensystems.lua b/examples/eigensystems.lua
index a4b00a7b..fc25b2e3 100644
--- a/examples/eigensystems.lua
+++ b/examples/eigensystems.lua
@@ -7,29 +7,31 @@ end
function demo1()
local m = new(4, 4, |i,j| 1/(i+j-1))
- print('Matrix:')
- print(m, '\n')
+ echo 'Matrix:'
+ print(m)
local e, v = eigsv(m)
- print('Eigenvalues:', ilist(|i| e[i], 4), '\n')
+ echo('Eigenvalues:')
+ print(ilist(|i| e[i], 4))
-- the following expression will give a diagonal matrix with the eigenvalues
--- along the diagonal
- print('Matrix diagonal form:')
- print(prod(v,mul(m,v)))
+ echo('Matrix diagonal form:')
+ print(prod(v, m*v))
end
function demo2()
local m = vandermonde {-1, -2, 3, 4}
- print('Matrix:')
- print(m, '\n')
+ echo 'Matrix:'
+ print(m)
local e, v = eignsv(m)
- print('Eigenvalues:', ilist(|i| e[i], 4), '\n')
+ echo 'Eigenvalues:'
+ print(ilist(|i| e[i], 4))
-- the following expression will give a diagonal matrix with the eigenvalues
--- along the diagonal
- print('Matrix diagonal form:')
- print(mul(inv(v),m,v))
+ echo('Matrix diagonal form:')
+ print(inv(v) * m * v)
end
echo([[
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月22日 14:49:53 +0000

AltStyle によって変換されたページ (->オリジナル) /