diff --git a/basis/math/matrices/elimination/elimination-docs.factor b/basis/math/matrices/elimination/elimination-docs.factor new file mode 100644 index 0000000000..4a3bcabac0 --- /dev/null +++ b/basis/math/matrices/elimination/elimination-docs.factor @@ -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." } ; diff --git a/basis/math/matrices/matrices-docs.factor b/basis/math/matrices/matrices-docs.factor index 99a7c62356..3a1eb0a542 100644 --- a/basis/math/matrices/matrices-docs.factor +++ b/basis/math/matrices/matrices-docs.factor @@ -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 { $values { "m1" sequence } { "m2" sequence } { "m" sequence } } { $description "Calculates the Kronecker product of two matrices." }