blob: 4c373460911cea9a968e1a8afe8efd484c76a469 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
@code{(require 'determinant)}
@ftindex determinant
@noindent
A Matrix can be either a list of lists (rows) or an array.
Unlike linear-algebra texts, this package uses 0-based coordinates.
@defun matrix->lists matrix
Returns the list-of-lists form of @var{matrix}.
@end defun
@defun matrix->array matrix
Returns the array form of @var{matrix}.
@end defun
@defun determinant matrix
@var{matrix} must be a square matrix.
@code{determinant} returns the determinant of @var{matrix}.
@example
(require 'determinant)
(determinant '((1 2) (3 4))) @result{} -2
(determinant '((1 2 3) (4 5 6) (7 8 9))) @result{} 0
@end example
@end defun
@defun transpose matrix
Returns a copy of @var{matrix} flipped over the diagonal containing the 1,1
element.
@end defun
@defun matrix:sum m1 m2
Returns the element-wise sum of matricies @var{m1} and @var{m2}.
@end defun
@defun matrix:difference m1 m2
Returns the element-wise difference of matricies @var{m1} and @var{m2}.
@end defun
@defun matrix:product m1 m2
Returns the product of matrices @var{m1} and @var{m2}.
@end defun
@defun matrix:product m1 z
Returns matrix @var{m1} times scalar @var{z}.
@end defun
@defun matrix:product z m1
Returns matrix @var{m1} times scalar @var{z}.
@end defun
@defun matrix:inverse matrix
@var{matrix} must be a square matrix.
If @var{matrix} is singular, then @code{matrix:inverse} returns #f; otherwise @code{matrix:inverse} returns the
@code{matrix:product} inverse of @var{matrix}.
@end defun
|