update docs and packaging

master
David Manura 2011-12-03 18:49:52 -05:00
parent 611c5f5066
commit 58790b6b7c
13 changed files with 169 additions and 55 deletions

View File

@ -13,9 +13,9 @@ install_lua_module ( matrix lua/matrix.lua )
install_data ( README.txt LICENSE.txt )
install_doc ( doc/complex_changelog.txt doc/fit_changelog.txt doc/matrix_changelog.txt )
install_example ( samples/fit.lua )
install_test ( tests/test_complex.lua )
install_test ( tests/test_fit.lua )
install_test ( tests/test.lua )
install_test ( tests/test_matrix.lua )
install_test ( test/test_complex.lua )
install_test ( test/test_fit.lua )
install_test ( test/test.lua )
install_test ( test/test_matrix.lua )
add_lua_test ( tests/test.lua )
add_lua_test ( test/test.lua )

18
MANIFEST Normal file
View File

@ -0,0 +1,18 @@
README.txt
LICENSE.txt
dist.info
rockspec.in
MANIFEST
CMakeLists.txt
dist.cmake
util.mk
lua/matrix.lua
lua/complex.lua
test/test.lua
test/test_matrix.lua
test/test_fit.lua
test/test_complex.lua
doc/complex_changelog.txt
doc/fit_changelog.txt
doc/matrix_changelog.txt
samples/fit.lua

View File

@ -1,14 +1,15 @@
--- This file is part of LuaDist project
name = "lua-matrix"
version = "0.2.8"
version = "0.2.10"
desc = "'LuaMatrix' provides a good selection of matrix functions."
author = "Michael Lutz, David Manura"
license = "MIT"
url = "http://luaforge.net/projects/luamatrix/"
maintainer = "Peter Kapec"
-- lua-users.org/wiki/LuaMatrix
maintainer = "David Manura"
depends = {
"lua ~> 5.1"
"lua ~> 5.1" -- including 5.2
}

View File

@ -1,5 +1,8 @@
complex changelog
v 0.3.2: 2011-12-03
- Add _VERSION
v 0.3.1: 2007-11-12
[ David Manura ]
rename mulconjugate to norm2

View File

@ -1,5 +1,8 @@
matrix changelog
v 0.2.10
- Add _VERSION to modules.
v 0.2.9: 2008-08-26
[ David Manura ]
- decoupled symbol class from matrix class:

View File

@ -1,30 +1,65 @@
-- complex 0.3.1
-- Lua 5.1
--[[
LUA MODULE
complex v$(_VERSION) - complex numbers implemented as Lua tables
SYNOPSIS
-- 'complex' provides common tasks with complex numbers
local complex = require 'complex'
local cx1 = complex "2+3i" -- or complex.new(2, 3)
local cx2 = complex "3+2i"
assert( complex.add(cx1,cx2) == complex "5+5i" )
assert( tostring(cx1) == "2+3i" )
DESCRIPTION
'complex' provides common tasks with complex numbers
-- function complex.to( arg ); complex( arg )
-- returns a complex number on success, nil on failure
-- arg := number or { number,number } or ( "(-)<number>" and/or "(+/-)<number>i" )
-- e.g. 5; {2,3}; "2", "2+i", "-2i", "2^2*3+1/3i"
-- note: 'i' is always in the numerator, spaces are not allowed
function complex.to( arg ); complex( arg )
returns a complex number on success, nil on failure
arg := number or { number,number } or ( "(-)<number>" and/or "(+/-)<number>i" )
e.g. 5; {2,3}; "2", "2+i", "-2i", "2^2*3+1/3i"
note: 'i' is always in the numerator, spaces are not allowed
-- a complex number is defined as carthesic complex number
-- complex number := { real_part, imaginary_part }
-- this gives fast access to both parts of the number for calculation
-- the access is faster than in a hash table
-- the metatable is just a add on, when it comes to speed, one is faster using a direct function call
A complex number is defined as Cartesian complex number
complex number := { real_part, imaginary_part } .
This gives fast access to both parts of the number for calculation.
The access is faster than in a hash table
The metatable is just an add on. When it comes to speed, one is faster using a direct function call.
-- http://luamatrix.luaforge.net
API
-- Licensed under the same terms as Lua itself.
See code and test_complex.lua.
DEPENDENCIES
None (other than Lua 5.1 or 5.2).
HOME PAGE
http://luamatrix.luaforge.net
http://lua-users.org/wiki/LuaMatrix
DOWNLOAD/INSTALL
./util.mk
cd tmp/*
luarocks make
Licensed under the same terms as Lua itself.
Developers:
Michael Lutz (chillcode)
David Manura http://lua-users.org/wiki/DavidManura (maintainer)
--]]
--/////////////--
--// complex //--
--/////////////--
-- link to complex table
local complex = {}
local complex = {_TYPE='module', _NAME='complex', _VERSION='0.3.2.20111203'}
-- link to complex metatable
local complex_meta = {}

View File

@ -1,17 +1,25 @@
--[[
matrix v 0.2.9
Lua 5.1 compatible
'matrix' provides a good selection of matrix functions.
With simple matrices this script is quite useful, though for more
exact calculations, one would probably use a program like Matlab instead.
Matrices of size 100x100 can still be handled very well.
The error for the determinant and the inverted matrix is around 10^-9
with a 100x100 matrix and an element range from -100 to 100.
LUA MODULE
matrix v$(_VERSION) - matrix functions implemented with Lua tables
SYNOPSIS
local matrix = require 'matrix'
m1 = matrix{{8,4,1},{6,8,3}}
m2 = matrix{{-8,1,3},{5,2,1}}
assert(m1 + m2 == matrix{{0,5,4},{11,10,4}})
DESCRIPTION
With simple matrices this script is quite useful, though for more
exact calculations, one would probably use a program like Matlab instead.
Matrices of size 100x100 can still be handled very well.
The error for the determinant and the inverted matrix is around 10^-9
with a 100x100 matrix and an element range from -100 to 100.
Characteristics:
Characteristics:
- functions called via matrix.<function> should be able to handle
any table matrix of structure t[i][j] = value
@ -24,14 +32,14 @@
since one gets a Lua error on incorrect use anyways
- uses mainly Gauss-Jordan elimination
- for Lua tables optimised determinant calculation (fast)
but not invoking any checks for special types of matrices
but not invoking any checks for special types of matrices
- vectors can be set up via vec1 = matrix{{ 1,2,3 }}^'T' or matrix{1,2,3}
- vectors can be multiplied scalar via num = vec1^'T' * vec2
where num will be a matrix with the result in mtx[1][1],
or use num = vec1:scalar( vec2 ), where num is a number
Site: http://luamatrix.luaforge.net
- vectors can be multiplied to a scalar via num = vec1^'T' * vec2
where num will be a matrix with the result in mtx[1][1],
or use num = vec1:scalar( vec2 ), where num is a number
API
matrix function list:
matrix.add
@ -75,20 +83,38 @@
matrix.tostring
matrix.transpose
matrix.type
See code and test_matrix.lua.
DEPENDENCIES
None (other than Lua 5.1 or 5.2). May be used with complex.lua.
HOME PAGE
http://luamatrix.luaforge.net
http://lua-users.org/wiki/LuaMatrix
DOWNLOAD/INSTALL
./util.mk
cd tmp/*
luarocks make
LICENSE
Licensed under the same terms as Lua itself.
Licensed under the same terms as Lua itself.
Developers:
Michael Lutz (chillcode)
David Manura http://lua-users.org/wiki/DavidManura
]]--
Developers:
Michael Lutz (chillcode) - original author
David Manura http://lua-users.org/wiki/DavidManura
--]]
--////////////
--// matrix //
--////////////
local matrix = {}
local matrix = {_TYPE='module', _NAME='matrix', _VERSION='0.2.10.20111203'}
-- access to the metatable we set at the end of the file
local matrix_meta = {}
@ -1228,4 +1254,4 @@ return matrix
--///////////////--
--// chillcode //--
--///////////////--
--///////////////--

View File

@ -1,7 +1,8 @@
package = "LuaMatrix"
version = "[VERSION]"
package = "lua-matrix"
version = "$(_VERSION)"
source = {
url = "[URL]",
url = "git://github.com/davidm/lua-matrix.git",
tag='v$(_VERSION)'
}
description = {
summary = "Matrices and matrix operations implemented in pure Lua.",
@ -11,11 +12,11 @@ description = {
Includes a complex number data type too.
]],
license = "MIT/X11",
homepage = "http://luamatrix.luaforge.net/",
homepage = "http://lua-users.org/wiki/LuaMatrix",
maintainer = "David Manura <http://lua-users.org/wiki/DavidManura>",
}
dependencies = {
"lua >= 5.1",
"lua >= 5.1", -- including 5.2
}
build = {
type = "none",
@ -28,4 +29,4 @@ build = {
copy_directories = {"doc", "samples", "tests"},
}
-- test: tests/test.lua
-- _VERSION from lua/matrix.lua

27
util.mk Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/make -f
# utility commands for package maintainers
VERSIONFROM:=$(shell sed -n 's,.*_VERSION \+from \+\([^ ]\+\).*,\1,p' rockspec.in)
VERSION:=$(shell sed -n "s,.*_VERSION='\([^']*\)'.*,\1,p" $(VERSIONFROM))-1
NAME=$(shell lua -e 'dofile"rockspec.in"; print(package)')
dist :
rm -fr tmp/$(NAME)-$(VERSION) tmp/$(NAME)-$(VERSION).zip
for x in `cat MANIFEST`; do install -D $$x tmp/$(NAME)-$(VERSION)/$$x || exit; done
sed 's,$$(_VERSION),$(VERSION),g' tmp/$(NAME)-$(VERSION)/rockspec.in > tmp/$(NAME)-$(VERSION)/$(NAME)-$(VERSION).rockspec
cd tmp && zip -r $(NAME)-$(VERSION).zip $(NAME)-$(VERSION)
install : dist
cd tmp/$(NAME)-$(VERSION) && luarocks make
test :
@if [ -e test.lua ]; then lua test.lua; fi
@if [ -e test/test.lua ]; then lua test/test.lua; fi
tag :
git tag -f v$(VERSION)
version :
@echo $(NAME)-$(VERSION)
.PHONY : dist install test tag version