Docs: more matrix-related documentation

db4
Björn Lindqvist 2014-04-10 18:45:34 +02:00 committed by John Benediktsson
parent 7c9f106018
commit a48567b8af
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,38 @@
USING: help.markup help.syntax math sequences ;
IN: math.matrices.elimination
HELP: inverse
{ $values { "matrix" sequence } { "matrix" sequence } }
{ $description "Computes the multiplicative inverse of a matrix. Assuming the matrix is invertible." }
{ $examples
"A matrix multiplied by its inverse is the identity matrix."
{ $example
"USING: math.matrices math.matrices.elimination prettyprint ;"
"{ { 3 4 } { 7 9 } } dup inverse m. 2 identity-matrix = ."
"t"
}
} ;
HELP: echelon
{ $values { "matrix" sequence } { "matrix'" sequence } }
{ $description "Computes the reduced row-echelon form of the matrix." } ;
HELP: nonzero-rows
{ $values { "matrix" sequence } { "matrix'" sequence } }
{ $description "Removes all all-zero rows from the matrix" }
{ $examples
{ $example
"USING: math.matrices.elimination prettyprint ;"
"{ { 0 0 } { 5 6 } { 0 0 } { 4 0 } } nonzero-rows ."
"{ { 5 6 } { 4 0 } }"
}
} ;
HELP: leading
{ $values
{ "seq" sequence }
{ "n" "the index of the first match, or " { $snippet f } "." }
{ "elt" "the first non-zero element, or " { $snippet f } "." }
}
{ $description "Find the first non-zero element of a sequence." } ;

View File

@ -47,6 +47,17 @@ HELP: m+
} }
} ; } ;
HELP: m-
{ $values { "m" sequence } { "m" sequence } { "m" sequence } }
{ $description "Subtracts the matrices component-wise." }
{ $examples
{ $example
"USING: math.matrices prettyprint ;"
"{ { 5 9 } { 15 17 } } { { 3 2 } { 4 9 } } m- ."
"{ { 2 7 } { 11 8 } }"
}
} ;
HELP: kron HELP: kron
{ $values { "m1" sequence } { "m2" sequence } { "m" sequence } } { $values { "m1" sequence } { "m2" sequence } { "m" sequence } }
{ $description "Calculates the Kronecker product of two matrices." } { $description "Calculates the Kronecker product of two matrices." }