]> gitweb.factorcode.org Git - factor.git/commitdiff
Docs: more matrix-related documentation
authorBjörn Lindqvist <bjourne@gmail.com>
Thu, 10 Apr 2014 16:45:34 +0000 (18:45 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 14 Apr 2014 15:42:09 +0000 (08:42 -0700)
basis/math/matrices/elimination/elimination-docs.factor [new file with mode: 0644]
basis/math/matrices/matrices-docs.factor

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