Merge branch 'master' into maverick
This commit is contained in:
@ -1,20 +1,20 @@
|
||||
1.1 2 3 4 5 6 7 8 9 9
|
||||
2 3.1 4 5 6 7 8 9 9 8
|
||||
3 4 5.1 6 7 8 9 9 8 7
|
||||
3 4 5 6.1 7 8 9 9 8 7
|
||||
1 2 3 4 5 7.2 7 8 9 9
|
||||
1 2 3 4 1 6 7 8.3 9 9
|
||||
6 2 3 4 5 6 7 8 9.8 9
|
||||
1 2 3 3 5 6 7 8 9 9.8
|
||||
1 2 3 4 6 6 7 8 9 9
|
||||
6 2 3 4 5 4 7 8 9 9
|
||||
3
|
||||
1
|
||||
4
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
1
|
||||
2
|
||||
6
|
||||
1.1 2 3 4 5 6 7 8 9 9
|
||||
2 3.1 4 5 6 7 8 9 9 8
|
||||
3 4 5.1 6 7 8 9 9 8 7
|
||||
3 4 5 6.1 7 8 9 9 8 7
|
||||
1 2 3 4 5 7.2 7 8 9 9
|
||||
1 2 3 4 1 6 7 8.3 9 9
|
||||
6 2 3 4 5 6 7 8 9.8 9
|
||||
1 2 3 3 5 6 7 8 9 9.8
|
||||
1 2 3 4 6 6 7 8 9 9
|
||||
6 2 3 4 5 4 7 8 9 9
|
||||
3
|
||||
1
|
||||
4
|
||||
1
|
||||
2
|
||||
3
|
||||
1
|
||||
1
|
||||
2
|
||||
6
|
||||
|
@ -1,62 +1,62 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# file: makefile.msc
|
||||
# desc: makefile for matrix library package under Microsoft C/C++ v7.0
|
||||
# by: patrick ko
|
||||
# date: 16 Apr 94
|
||||
#
|
||||
# note: a slim matrix library matrix.lib will be generated
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
OBJS = matcreat.obj matdump.obj materr.obj matadd.obj matsub.obj \
|
||||
matmul.obj matinv.obj matsolve.obj matdet.obj mattran.obj matdurbn.obj \
|
||||
mattoepz.obj matsubx.obj
|
||||
|
||||
CC = cl -c
|
||||
C = cl
|
||||
|
||||
demo.exe: demo.c matrix.lib
|
||||
$(C) demo.c matrix.lib
|
||||
|
||||
matrix.lib: $(OBJS)
|
||||
lib matrix +matcreat +matdump +materr +matadd.obj ,,
|
||||
lib matrix +matsub +matmul +matinv +matsolve +matdet.obj ,,
|
||||
lib matrix +mattran +matdurbn +mattoepz +matsubx ,,
|
||||
|
||||
matcreat.obj: matcreat.c matrix.h
|
||||
$(CC) matcreat.c
|
||||
|
||||
matdump.obj: matdump.c matrix.h
|
||||
$(CC) matdump.c
|
||||
|
||||
materr.obj: materr.c matrix.h
|
||||
$(CC) materr.c
|
||||
|
||||
matadd.obj: matadd.c matrix.h
|
||||
$(CC) matadd.c
|
||||
|
||||
matsub.obj: matsub.c matrix.h
|
||||
$(CC) matsub.c
|
||||
|
||||
matmul.obj: matmul.c matrix.h
|
||||
$(CC) matmul.c
|
||||
|
||||
matinv.obj: matinv.c matrix.h
|
||||
$(CC) matinv.c
|
||||
|
||||
matsolve.obj: matsolve.c matrix.h
|
||||
$(CC) matsolve.c
|
||||
|
||||
mattran.obj: mattran.c matrix.h
|
||||
$(CC) mattran.c
|
||||
|
||||
matdet.obj: matdet.c matrix.h
|
||||
$(CC) matdet.c
|
||||
|
||||
matdurbn.obj: matdurbn.c matrix.h
|
||||
$(CC) matdurbn.c
|
||||
|
||||
mattoepz.obj: mattoepz.c matrix.h
|
||||
$(CC) mattoepz.c
|
||||
|
||||
matsubx.obj: matsubx.c matrix.h
|
||||
$(CC) matsubx.c
|
||||
#------------------------------------------------------------------------------
|
||||
# file: makefile.msc
|
||||
# desc: makefile for matrix library package under Microsoft C/C++ v7.0
|
||||
# by: patrick ko
|
||||
# date: 16 Apr 94
|
||||
#
|
||||
# note: a slim matrix library matrix.lib will be generated
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
OBJS = matcreat.obj matdump.obj materr.obj matadd.obj matsub.obj \
|
||||
matmul.obj matinv.obj matsolve.obj matdet.obj mattran.obj matdurbn.obj \
|
||||
mattoepz.obj matsubx.obj
|
||||
|
||||
CC = cl -c
|
||||
C = cl
|
||||
|
||||
demo.exe: demo.c matrix.lib
|
||||
$(C) demo.c matrix.lib
|
||||
|
||||
matrix.lib: $(OBJS)
|
||||
lib matrix +matcreat +matdump +materr +matadd.obj ,,
|
||||
lib matrix +matsub +matmul +matinv +matsolve +matdet.obj ,,
|
||||
lib matrix +mattran +matdurbn +mattoepz +matsubx ,,
|
||||
|
||||
matcreat.obj: matcreat.c matrix.h
|
||||
$(CC) matcreat.c
|
||||
|
||||
matdump.obj: matdump.c matrix.h
|
||||
$(CC) matdump.c
|
||||
|
||||
materr.obj: materr.c matrix.h
|
||||
$(CC) materr.c
|
||||
|
||||
matadd.obj: matadd.c matrix.h
|
||||
$(CC) matadd.c
|
||||
|
||||
matsub.obj: matsub.c matrix.h
|
||||
$(CC) matsub.c
|
||||
|
||||
matmul.obj: matmul.c matrix.h
|
||||
$(CC) matmul.c
|
||||
|
||||
matinv.obj: matinv.c matrix.h
|
||||
$(CC) matinv.c
|
||||
|
||||
matsolve.obj: matsolve.c matrix.h
|
||||
$(CC) matsolve.c
|
||||
|
||||
mattran.obj: mattran.c matrix.h
|
||||
$(CC) mattran.c
|
||||
|
||||
matdet.obj: matdet.c matrix.h
|
||||
$(CC) matdet.c
|
||||
|
||||
matdurbn.obj: matdurbn.c matrix.h
|
||||
$(CC) matdurbn.c
|
||||
|
||||
mattoepz.obj: mattoepz.c matrix.h
|
||||
$(CC) mattoepz.c
|
||||
|
||||
matsubx.obj: matsubx.c matrix.h
|
||||
$(CC) matsubx.c
|
||||
|
@ -1,74 +1,74 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# file: makefile.tc
|
||||
# desc: makefile for matrix library package under Turbo C v2.0
|
||||
# by: patrick ko
|
||||
# date: 16 Apr 94
|
||||
#
|
||||
# note: a slim matrix library matrix.lib will be generated
|
||||
#------------------------------------------------------------------------------
|
||||
DRIVE = C:
|
||||
|
||||
OBJS = matcreat.obj matdump.obj materr.obj matadd.obj matsub.obj \
|
||||
matmul.obj matinv.obj matsolve.obj matdet.obj mattran.obj matdurbn.obj \
|
||||
mattoepz.obj matsubx.obj
|
||||
|
||||
LIB = -L$(DRIVE)\TC\LIB
|
||||
INC = -I$(DRIVE)\TC\INCLUDE
|
||||
CC = tcc -c -mh $(INC)
|
||||
C = tcc -mh $(LIB) $(INC)
|
||||
LL = tlib matrix.lib
|
||||
|
||||
demo.exe: demo.c $(OBJS)
|
||||
$(C) demo.c matrix.lib
|
||||
|
||||
matcreat.obj: matcreat.c matrix.h
|
||||
$(CC) matcreat.c
|
||||
$(LL) -+matcreat.obj
|
||||
|
||||
matdump.obj: matdump.c matrix.h
|
||||
$(CC) matdump.c
|
||||
$(LL) -+matdump.obj
|
||||
|
||||
materr.obj: materr.c matrix.h
|
||||
$(CC) materr.c
|
||||
$(LL) -+materr.obj
|
||||
|
||||
matadd.obj: matadd.c matrix.h
|
||||
$(CC) matadd.c
|
||||
$(LL) -+matadd.obj
|
||||
|
||||
matsub.obj: matsub.c matrix.h
|
||||
$(CC) matsub.c
|
||||
$(LL) -+matsub.obj
|
||||
|
||||
matmul.obj: matmul.c matrix.h
|
||||
$(CC) matmul.c
|
||||
$(LL) -+matmul.obj
|
||||
|
||||
matinv.obj: matinv.c matrix.h
|
||||
$(CC) matinv.c
|
||||
$(LL) -+matinv.obj
|
||||
|
||||
matsolve.obj: matsolve.c matrix.h
|
||||
$(CC) matsolve.c
|
||||
$(LL) -+matsolve.obj
|
||||
|
||||
mattran.obj: mattran.c matrix.h
|
||||
$(CC) mattran.c
|
||||
$(LL) -+mattran.obj
|
||||
|
||||
matdet.obj: matdet.c matrix.h
|
||||
$(CC) matdet.c
|
||||
$(LL) -+matdet.obj
|
||||
|
||||
matdurbn.obj: matdurbn.c matrix.h
|
||||
$(CC) matdurbn.c
|
||||
$(LL) -+matdurbn.obj
|
||||
|
||||
mattoepz.obj: mattoepz.c matrix.h
|
||||
$(CC) mattoepz.c
|
||||
$(LL) -+mattoepz.obj
|
||||
|
||||
matsubx.obj: matsubx.c matrix.h
|
||||
$(CC) matsubx.c
|
||||
$(LL) -+matsubx.obj
|
||||
#------------------------------------------------------------------------------
|
||||
# file: makefile.tc
|
||||
# desc: makefile for matrix library package under Turbo C v2.0
|
||||
# by: patrick ko
|
||||
# date: 16 Apr 94
|
||||
#
|
||||
# note: a slim matrix library matrix.lib will be generated
|
||||
#------------------------------------------------------------------------------
|
||||
DRIVE = C:
|
||||
|
||||
OBJS = matcreat.obj matdump.obj materr.obj matadd.obj matsub.obj \
|
||||
matmul.obj matinv.obj matsolve.obj matdet.obj mattran.obj matdurbn.obj \
|
||||
mattoepz.obj matsubx.obj
|
||||
|
||||
LIB = -L$(DRIVE)\TC\LIB
|
||||
INC = -I$(DRIVE)\TC\INCLUDE
|
||||
CC = tcc -c -mh $(INC)
|
||||
C = tcc -mh $(LIB) $(INC)
|
||||
LL = tlib matrix.lib
|
||||
|
||||
demo.exe: demo.c $(OBJS)
|
||||
$(C) demo.c matrix.lib
|
||||
|
||||
matcreat.obj: matcreat.c matrix.h
|
||||
$(CC) matcreat.c
|
||||
$(LL) -+matcreat.obj
|
||||
|
||||
matdump.obj: matdump.c matrix.h
|
||||
$(CC) matdump.c
|
||||
$(LL) -+matdump.obj
|
||||
|
||||
materr.obj: materr.c matrix.h
|
||||
$(CC) materr.c
|
||||
$(LL) -+materr.obj
|
||||
|
||||
matadd.obj: matadd.c matrix.h
|
||||
$(CC) matadd.c
|
||||
$(LL) -+matadd.obj
|
||||
|
||||
matsub.obj: matsub.c matrix.h
|
||||
$(CC) matsub.c
|
||||
$(LL) -+matsub.obj
|
||||
|
||||
matmul.obj: matmul.c matrix.h
|
||||
$(CC) matmul.c
|
||||
$(LL) -+matmul.obj
|
||||
|
||||
matinv.obj: matinv.c matrix.h
|
||||
$(CC) matinv.c
|
||||
$(LL) -+matinv.obj
|
||||
|
||||
matsolve.obj: matsolve.c matrix.h
|
||||
$(CC) matsolve.c
|
||||
$(LL) -+matsolve.obj
|
||||
|
||||
mattran.obj: mattran.c matrix.h
|
||||
$(CC) mattran.c
|
||||
$(LL) -+mattran.obj
|
||||
|
||||
matdet.obj: matdet.c matrix.h
|
||||
$(CC) matdet.c
|
||||
$(LL) -+matdet.obj
|
||||
|
||||
matdurbn.obj: matdurbn.c matrix.h
|
||||
$(CC) matdurbn.c
|
||||
$(LL) -+matdurbn.obj
|
||||
|
||||
mattoepz.obj: mattoepz.c matrix.h
|
||||
$(CC) mattoepz.c
|
||||
$(LL) -+mattoepz.obj
|
||||
|
||||
matsubx.obj: matsubx.c matrix.h
|
||||
$(CC) matsubx.c
|
||||
$(LL) -+matsubx.obj
|
||||
|
@ -1,54 +1,54 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# file: makefile.ux
|
||||
# desc: makefile for matrix library package under Unix
|
||||
# by: patrick ko
|
||||
# date: 16 Apr 94
|
||||
#------------------------------------------------------------------------------
|
||||
OBJS = matcreat.o matdump.o materr.o matadd.o matsub.o \
|
||||
matmul.o matinv.o matsolve.o mattran.o matdet.o mattoepz.o matdurbn.o
|
||||
|
||||
CC = cc -c
|
||||
C = cc
|
||||
CO = -lm -g
|
||||
|
||||
demo: demo.c $(OBJS)
|
||||
$(C) demo.c -o demo $(OBJS) $(CO)
|
||||
|
||||
matcreat.o: matcreat.c matrix.h
|
||||
$(CC) matcreat.c
|
||||
|
||||
matdump.o: matdump.c matrix.h
|
||||
$(CC) matdump.c
|
||||
|
||||
materr.o: materr.c matrix.h
|
||||
$(CC) materr.c
|
||||
|
||||
matadd.o: matadd.c matrix.h
|
||||
$(CC) matadd.c
|
||||
|
||||
matsub.o: matsub.c matrix.h
|
||||
$(CC) matsub.c
|
||||
|
||||
matmul.o: matmul.c matrix.h
|
||||
$(CC) matmul.c
|
||||
|
||||
matinv.o: matinv.c matrix.h
|
||||
$(CC) matinv.c
|
||||
|
||||
matsolve.o: matsolve.c matrix.h
|
||||
$(CC) matsolve.c
|
||||
|
||||
mattran.o: mattran.c matrix.h
|
||||
$(CC) mattran.c
|
||||
|
||||
matdet.o: matdet.c matrix.h
|
||||
$(CC) matdet.c
|
||||
|
||||
mattoepz.o: mattoepz.c matrix.h
|
||||
$(CC) mattoepz.c
|
||||
|
||||
matdurbn.o: matdurbn.c matrix.h
|
||||
$(CC) matdurbn.c
|
||||
|
||||
matsubx.o: matsubx.c matrix.h
|
||||
$(CC) matsubx.c
|
||||
#------------------------------------------------------------------------------
|
||||
# file: makefile.ux
|
||||
# desc: makefile for matrix library package under Unix
|
||||
# by: patrick ko
|
||||
# date: 16 Apr 94
|
||||
#------------------------------------------------------------------------------
|
||||
OBJS = matcreat.o matdump.o materr.o matadd.o matsub.o \
|
||||
matmul.o matinv.o matsolve.o mattran.o matdet.o mattoepz.o matdurbn.o
|
||||
|
||||
CC = cc -c
|
||||
C = cc
|
||||
CO = -lm -g
|
||||
|
||||
demo: demo.c $(OBJS)
|
||||
$(C) demo.c -o demo $(OBJS) $(CO)
|
||||
|
||||
matcreat.o: matcreat.c matrix.h
|
||||
$(CC) matcreat.c
|
||||
|
||||
matdump.o: matdump.c matrix.h
|
||||
$(CC) matdump.c
|
||||
|
||||
materr.o: materr.c matrix.h
|
||||
$(CC) materr.c
|
||||
|
||||
matadd.o: matadd.c matrix.h
|
||||
$(CC) matadd.c
|
||||
|
||||
matsub.o: matsub.c matrix.h
|
||||
$(CC) matsub.c
|
||||
|
||||
matmul.o: matmul.c matrix.h
|
||||
$(CC) matmul.c
|
||||
|
||||
matinv.o: matinv.c matrix.h
|
||||
$(CC) matinv.c
|
||||
|
||||
matsolve.o: matsolve.c matrix.h
|
||||
$(CC) matsolve.c
|
||||
|
||||
mattran.o: mattran.c matrix.h
|
||||
$(CC) mattran.c
|
||||
|
||||
matdet.o: matdet.c matrix.h
|
||||
$(CC) matdet.c
|
||||
|
||||
mattoepz.o: mattoepz.c matrix.h
|
||||
$(CC) mattoepz.c
|
||||
|
||||
matdurbn.o: matdurbn.c matrix.h
|
||||
$(CC) matdurbn.c
|
||||
|
||||
matsubx.o: matsubx.c matrix.h
|
||||
$(CC) matsubx.c
|
||||
|
224
matrix/READ.ME
224
matrix/READ.ME
@ -1,112 +1,112 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Small Matrix Toolbox for C programmers
|
||||
version 0.42
|
||||
(Support Unix and DOS)
|
||||
|
||||
by Patrick KO Shu-pui
|
||||
|
||||
Copyright (c) 1992, 1993, 1994 All Rights Reserved.
|
||||
-------------------------------------------------------------------------------
|
||||
ADDRESS TO CONTACT:
|
||||
|
||||
fidonet: 6:700/132 BiG Programming Club
|
||||
[852] 663-0223 19.2 kbps
|
||||
[852] 663-0236 16.8 kbps
|
||||
|
||||
internet: pko@hk.super.net
|
||||
|
||||
mailing: Patrick Ko
|
||||
G.P.O. Box 7468
|
||||
Hong Kong
|
||||
-------------------------------------------------------------------------------
|
||||
MATRX042.ZIP contains
|
||||
|
||||
READ .ME - this file
|
||||
DEMO .C - demo how to use this package
|
||||
DEMO .DAT - demo data
|
||||
DEMO .EXE - demo executable for DOS
|
||||
MAKEFILE.MSC - makefile for Microsoft C/C++ 7.0 on DOS
|
||||
MAKEFILE.TC - makefile for Turbo C 2.0 on DOS
|
||||
MAKEFILE.UX - makefile for Unix
|
||||
MATRIX .DOC - matrix toolbox interface document
|
||||
MATRIX .H - matrix header file (must include it)
|
||||
MATADD .C - matrix addition
|
||||
MATCREAT.C - matrix creation
|
||||
MATDET .C - find minor, cofactor, determinant
|
||||
MATDUMP .C - matrix dump
|
||||
MATERR .C - matrix error handling routine
|
||||
MATINV .C - matrix inversion
|
||||
MATMUL .C - matrix multiplication
|
||||
MATSOLVE.C - linear equations solver
|
||||
MATSUB .C - matrix substraction
|
||||
MATSUBX .C - submatrix operation
|
||||
MATTOEPZ.C - create symmetric Toeplitz matrix
|
||||
MATDURBN.C - Symmetrix Toeplitz matrix fast solving algorithm
|
||||
MATTRAN .C - matrix transpose
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
WHATS NEW in v0.1:
|
||||
- +, -, *, inverse matrix operations
|
||||
|
||||
WHATS NEW in v0.2:
|
||||
- Linear equation solver
|
||||
- C-programmer-friendly C sources
|
||||
|
||||
WHATS NEW in v0.3:
|
||||
- better data structure (more Object-Oriented)
|
||||
- finding minors, cofactors, determinants
|
||||
- Levinson-Durbin algorithm for symmetric Toeplitz matrix
|
||||
|
||||
WHATS NEW in v0.4:
|
||||
- Revised method for minors, cofactors and determinants
|
||||
whose time complexity is T(n^3) instead of nearly T(n!).
|
||||
This is important when you want to find the determinant
|
||||
of a matrix whose size is over 10 x 10.
|
||||
- submatrix operator
|
||||
- matrix formmated dump function
|
||||
- brief matrix toolbox interface document included
|
||||
|
||||
WHATS NEW in v0.41:
|
||||
- bug fix for unit matrix creation
|
||||
|
||||
WHATS NEW in v0.42:
|
||||
- support Microsoft C/C++ 7.0
|
||||
|
||||
HOW TO COMPILE:
|
||||
|
||||
1. All Unix environment - make -f makefile.ux
|
||||
2. DOS (Turbo C v2.0) - make -fmakefile.tc
|
||||
3. DOS (Microsoft C/C++ v7.0) - nmake -fmakefile.msc
|
||||
|
||||
REFERENCES
|
||||
|
||||
[1] Mary L.Boas, "Mathematical Methods in the Physical Sciene,"
|
||||
John Wiley & Sons, 2nd Ed., 1983. Chap 3.
|
||||
|
||||
[2] Kendall E.Atkinson, "An Introduction to Numberical Analysis,"
|
||||
John Wiley & Sons, 1978.
|
||||
|
||||
[3] Shuzo Saito, Kazuo Nakata, "Fundamentals of Speech Signal
|
||||
Processing," Academic Press, 1985.
|
||||
|
||||
[4] Alfred V.Aho, John E.Hopcroft, Jeffrey D.Ullman, "The Design
|
||||
and Analysis of Computer Algorithms," 1974.
|
||||
|
||||
AUTHOR
|
||||
All the sources are written by Patrick KO Shu Pui
|
||||
BiG Programming Club (6:700/132, fidonet)
|
||||
|
||||
===============================================================================
|
||||
AUTHORIZATION NOTICE
|
||||
|
||||
This C source package MATRX042.ZIP is FREE for ACADEMIC purpose only.
|
||||
|
||||
For COMMERCIAL use, authorization is required from the author.
|
||||
Please send US$25 for registration.
|
||||
===============================================================================
|
||||
DISCLAIMER (I hate this but I have to do that)
|
||||
|
||||
You are on your own risk - the author is not responsible for any lost due
|
||||
to the use of this toolbox.
|
||||
===============================================================================
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Small Matrix Toolbox for C programmers
|
||||
version 0.42
|
||||
(Support Unix and DOS)
|
||||
|
||||
by Patrick KO Shu-pui
|
||||
|
||||
Copyright (c) 1992, 1993, 1994 All Rights Reserved.
|
||||
-------------------------------------------------------------------------------
|
||||
ADDRESS TO CONTACT:
|
||||
|
||||
fidonet: 6:700/132 BiG Programming Club
|
||||
[852] 663-0223 19.2 kbps
|
||||
[852] 663-0236 16.8 kbps
|
||||
|
||||
internet: pko@hk.super.net
|
||||
|
||||
mailing: Patrick Ko
|
||||
G.P.O. Box 7468
|
||||
Hong Kong
|
||||
-------------------------------------------------------------------------------
|
||||
MATRX042.ZIP contains
|
||||
|
||||
READ .ME - this file
|
||||
DEMO .C - demo how to use this package
|
||||
DEMO .DAT - demo data
|
||||
DEMO .EXE - demo executable for DOS
|
||||
MAKEFILE.MSC - makefile for Microsoft C/C++ 7.0 on DOS
|
||||
MAKEFILE.TC - makefile for Turbo C 2.0 on DOS
|
||||
MAKEFILE.UX - makefile for Unix
|
||||
MATRIX .DOC - matrix toolbox interface document
|
||||
MATRIX .H - matrix header file (must include it)
|
||||
MATADD .C - matrix addition
|
||||
MATCREAT.C - matrix creation
|
||||
MATDET .C - find minor, cofactor, determinant
|
||||
MATDUMP .C - matrix dump
|
||||
MATERR .C - matrix error handling routine
|
||||
MATINV .C - matrix inversion
|
||||
MATMUL .C - matrix multiplication
|
||||
MATSOLVE.C - linear equations solver
|
||||
MATSUB .C - matrix substraction
|
||||
MATSUBX .C - submatrix operation
|
||||
MATTOEPZ.C - create symmetric Toeplitz matrix
|
||||
MATDURBN.C - Symmetrix Toeplitz matrix fast solving algorithm
|
||||
MATTRAN .C - matrix transpose
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
WHATS NEW in v0.1:
|
||||
- +, -, *, inverse matrix operations
|
||||
|
||||
WHATS NEW in v0.2:
|
||||
- Linear equation solver
|
||||
- C-programmer-friendly C sources
|
||||
|
||||
WHATS NEW in v0.3:
|
||||
- better data structure (more Object-Oriented)
|
||||
- finding minors, cofactors, determinants
|
||||
- Levinson-Durbin algorithm for symmetric Toeplitz matrix
|
||||
|
||||
WHATS NEW in v0.4:
|
||||
- Revised method for minors, cofactors and determinants
|
||||
whose time complexity is T(n^3) instead of nearly T(n!).
|
||||
This is important when you want to find the determinant
|
||||
of a matrix whose size is over 10 x 10.
|
||||
- submatrix operator
|
||||
- matrix formmated dump function
|
||||
- brief matrix toolbox interface document included
|
||||
|
||||
WHATS NEW in v0.41:
|
||||
- bug fix for unit matrix creation
|
||||
|
||||
WHATS NEW in v0.42:
|
||||
- support Microsoft C/C++ 7.0
|
||||
|
||||
HOW TO COMPILE:
|
||||
|
||||
1. All Unix environment - make -f makefile.ux
|
||||
2. DOS (Turbo C v2.0) - make -fmakefile.tc
|
||||
3. DOS (Microsoft C/C++ v7.0) - nmake -fmakefile.msc
|
||||
|
||||
REFERENCES
|
||||
|
||||
[1] Mary L.Boas, "Mathematical Methods in the Physical Sciene,"
|
||||
John Wiley & Sons, 2nd Ed., 1983. Chap 3.
|
||||
|
||||
[2] Kendall E.Atkinson, "An Introduction to Numberical Analysis,"
|
||||
John Wiley & Sons, 1978.
|
||||
|
||||
[3] Shuzo Saito, Kazuo Nakata, "Fundamentals of Speech Signal
|
||||
Processing," Academic Press, 1985.
|
||||
|
||||
[4] Alfred V.Aho, John E.Hopcroft, Jeffrey D.Ullman, "The Design
|
||||
and Analysis of Computer Algorithms," 1974.
|
||||
|
||||
AUTHOR
|
||||
All the sources are written by Patrick KO Shu Pui
|
||||
BiG Programming Club (6:700/132, fidonet)
|
||||
|
||||
===============================================================================
|
||||
AUTHORIZATION NOTICE
|
||||
|
||||
This C source package MATRX042.ZIP is FREE for ACADEMIC purpose only.
|
||||
|
||||
For COMMERCIAL use, authorization is required from the author.
|
||||
Please send US$25 for registration.
|
||||
===============================================================================
|
||||
DISCLAIMER (I hate this but I have to do that)
|
||||
|
||||
You are on your own risk - the author is not responsible for any lost due
|
||||
to the use of this toolbox.
|
||||
===============================================================================
|
||||
|
||||
|
182
matrix/demo.c
182
matrix/demo.c
@ -1,92 +1,92 @@
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
* file: demo.c
|
||||
* desc: demostrate how to use Patrick's matrix toolbox
|
||||
* by: ko shu pui, patrick
|
||||
* date: 24 nov 91 v0.1
|
||||
* revi: 14 may 92 v0.2
|
||||
* 24 may 92 v0.4
|
||||
* ref:
|
||||
* [1] Mary L.Boas, "Mathematical Methods in the Physical Sciene,"
|
||||
* John Wiley & Sons, 2nd Ed., 1983. Chap 3.
|
||||
*
|
||||
* [2] Kendall E.Atkinson, "An Introduction to Numberical Analysis,"
|
||||
* John Wiley & Sons, 1978.
|
||||
*
|
||||
* [3] Alfred V.Aho, John E.Hopcroft, Jeffrey D.Ullman, "The Design
|
||||
* and Analysis of Computer Algorithms," 1974.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "matrix.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
MATRIX A, B, X, M;
|
||||
FILE *fp;
|
||||
double result;
|
||||
time_t t1, t2;
|
||||
int tinv, tdet, tmul;
|
||||
|
||||
A = mat_creat( 10, 10, UNDEFINED );
|
||||
B = mat_creat( 10, 1, UNDEFINED );
|
||||
|
||||
if ((fp = fopen( "demo.dat", "r" )) == NULL)
|
||||
{
|
||||
fprintf( stderr, "file cannot be opened\n" );
|
||||
exit (0);
|
||||
}
|
||||
|
||||
fgetmat( A, fp );
|
||||
printf( "|- Matrix A -|\n");
|
||||
mat_dumpf( A, "%+06.1f " );
|
||||
|
||||
t1 = time(&t1);
|
||||
result = mat_det(A);
|
||||
t2 = time(&t2);
|
||||
tdet = t2 - t1;
|
||||
printf( "\n\nDet(A) = %f\n", result );
|
||||
|
||||
printf( "|- Inv A -|\n");
|
||||
t1 = time(&t1);
|
||||
X = mat_inv( A );
|
||||
t2 = time(&t2);
|
||||
tinv = t2 - t1;
|
||||
|
||||
if (X == NULL)
|
||||
printf( "A is a singular matrix\n" );
|
||||
else
|
||||
{
|
||||
mat_dumpf(X, "%+06.1f ");
|
||||
|
||||
printf( "|- A x Inv A -|\n");
|
||||
t1 = time(&t1);
|
||||
M = mat_mul( X, A );
|
||||
t2 = time(&t2);
|
||||
tmul = t2 - t1;
|
||||
mat_dumpf( M, "%+06.1f " );
|
||||
|
||||
mat_free(M);
|
||||
mat_free(X);
|
||||
}
|
||||
|
||||
fgetmat( B, fp );
|
||||
printf( "|- Matrix B -|\n");
|
||||
mat_dumpf( B, "%+06.1f " );
|
||||
|
||||
printf( "|- A x B -|\n");
|
||||
mat_free(mat_dumpf(mat_mul(A, B), "%+06.1f "));
|
||||
|
||||
printf( "time for finding 10 x 10 matrix inversion is less than %d secs\n", tinv );
|
||||
printf( "time for finding 10 x 10 matrix determinant is less than %d secs\n", tdet );
|
||||
printf( "time for finding 10 x 10 matrix multiplication is less than %d secs\n", tmul );
|
||||
|
||||
mat_free( A );
|
||||
mat_free( B );
|
||||
|
||||
fclose(fp);
|
||||
|
||||
}
|
||||
/*
|
||||
*-----------------------------------------------------------------------------
|
||||
* file: demo.c
|
||||
* desc: demostrate how to use Patrick's matrix toolbox
|
||||
* by: ko shu pui, patrick
|
||||
* date: 24 nov 91 v0.1
|
||||
* revi: 14 may 92 v0.2
|
||||
* 24 may 92 v0.4
|
||||
* ref:
|
||||
* [1] Mary L.Boas, "Mathematical Methods in the Physical Sciene,"
|
||||
* John Wiley & Sons, 2nd Ed., 1983. Chap 3.
|
||||
*
|
||||
* [2] Kendall E.Atkinson, "An Introduction to Numberical Analysis,"
|
||||
* John Wiley & Sons, 1978.
|
||||
*
|
||||
* [3] Alfred V.Aho, John E.Hopcroft, Jeffrey D.Ullman, "The Design
|
||||
* and Analysis of Computer Algorithms," 1974.
|
||||
*
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "matrix.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
MATRIX A, B, X, M;
|
||||
FILE *fp;
|
||||
double result;
|
||||
time_t t1, t2;
|
||||
int tinv, tdet, tmul;
|
||||
|
||||
A = mat_creat( 10, 10, UNDEFINED );
|
||||
B = mat_creat( 10, 1, UNDEFINED );
|
||||
|
||||
if ((fp = fopen( "demo.dat", "r" )) == NULL)
|
||||
{
|
||||
fprintf( stderr, "file cannot be opened\n" );
|
||||
exit (0);
|
||||
}
|
||||
|
||||
fgetmat( A, fp );
|
||||
printf( "|- Matrix A -|\n");
|
||||
mat_dumpf( A, "%+06.1f " );
|
||||
|
||||
t1 = time(&t1);
|
||||
result = mat_det(A);
|
||||
t2 = time(&t2);
|
||||
tdet = t2 - t1;
|
||||
printf( "\n\nDet(A) = %f\n", result );
|
||||
|
||||
printf( "|- Inv A -|\n");
|
||||
t1 = time(&t1);
|
||||
X = mat_inv( A );
|
||||
t2 = time(&t2);
|
||||
tinv = t2 - t1;
|
||||
|
||||
if (X == NULL)
|
||||
printf( "A is a singular matrix\n" );
|
||||
else
|
||||
{
|
||||
mat_dumpf(X, "%+06.1f ");
|
||||
|
||||
printf( "|- A x Inv A -|\n");
|
||||
t1 = time(&t1);
|
||||
M = mat_mul( X, A );
|
||||
t2 = time(&t2);
|
||||
tmul = t2 - t1;
|
||||
mat_dumpf( M, "%+06.1f " );
|
||||
|
||||
mat_free(M);
|
||||
mat_free(X);
|
||||
}
|
||||
|
||||
fgetmat( B, fp );
|
||||
printf( "|- Matrix B -|\n");
|
||||
mat_dumpf( B, "%+06.1f " );
|
||||
|
||||
printf( "|- A x B -|\n");
|
||||
mat_free(mat_dumpf(mat_mul(A, B), "%+06.1f "));
|
||||
|
||||
printf( "time for finding 10 x 10 matrix inversion is less than %d secs\n", tinv );
|
||||
printf( "time for finding 10 x 10 matrix determinant is less than %d secs\n", tdet );
|
||||
printf( "time for finding 10 x 10 matrix multiplication is less than %d secs\n", tmul );
|
||||
|
||||
mat_free( A );
|
||||
mat_free( B );
|
||||
|
||||
fclose(fp);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user