]> gitweb.factorcode.org Git - factor.git/commitdiff
remove math.blas.syntax and merge parsing words into math.blas.vectors/matrices
authorJoe Groff <arcata@gmail.com>
Fri, 30 Jan 2009 17:42:43 +0000 (11:42 -0600)
committerJoe Groff <arcata@gmail.com>
Fri, 30 Jan 2009 17:42:43 +0000 (11:42 -0600)
13 files changed:
basis/math/blas/matrices/matrices-docs.factor
basis/math/blas/matrices/matrices-tests.factor
basis/math/blas/matrices/matrices.factor
basis/math/blas/syntax/authors.txt [deleted file]
basis/math/blas/syntax/summary.txt [deleted file]
basis/math/blas/syntax/syntax-docs.factor [deleted file]
basis/math/blas/syntax/syntax.factor [deleted file]
basis/math/blas/syntax/tags.txt [deleted file]
basis/math/blas/vectors/vectors-docs.factor
basis/math/blas/vectors/vectors-tests.factor
basis/math/blas/vectors/vectors.factor
extra/sequences/squish/.squish.factor.swo
extra/sequences/squish/squish.factor

index 01e0997405f3132ab2987f9355c93073ba097acd..f20a565e1f437a925f1d24552bf6d476c56c0100 100644 (file)
@@ -1,4 +1,4 @@
-USING: alien byte-arrays help.markup help.syntax math math.blas.vectors sequences strings ;
+USING: alien byte-arrays help.markup help.syntax math math.blas.vectors sequences strings multiline ;
 IN: math.blas.matrices
 
 ARTICLE: "math.blas-summary" "Basic Linear Algebra Subroutines (BLAS) interface"
@@ -21,8 +21,6 @@ ARTICLE: "math.blas-types" "BLAS interface types"
 { $subsection double-blas-matrix }
 { $subsection float-complex-blas-matrix }
 { $subsection double-complex-blas-matrix } 
-"Syntax words are provided for constructing literal vectors and matrices in the " { $vocab-link "math.blas.syntax" } " vocabulary:"
-{ $subsection "math.blas.syntax" }
 "There are BOA constructors for all vector and matrix types, which provide the most flexibility in specifying memory layout:"
 { $subsection <float-blas-vector> }
 { $subsection <double-blas-vector> }
@@ -74,7 +72,13 @@ ARTICLE: "math.blas.matrices" "BLAS interface matrix operations"
 { $subsection n*M! }
 { $subsection n*M }
 { $subsection M*n }
-{ $subsection M/n } ;
+{ $subsection M/n }
+"Literal syntax:"
+{ $subsection POSTPONE: smatrix{ }
+{ $subsection POSTPONE: dmatrix{ }
+{ $subsection POSTPONE: cmatrix{ }
+{ $subsection POSTPONE: zmatrix{ } ;
+
 
 ABOUT: "math.blas.matrices"
 
@@ -243,3 +247,43 @@ HELP: <empty-vector>
 { $values { "length" "The length of the new vector" } { "exemplar" blas-vector-base blas-matrix-base } { "vector" blas-vector-base } }
 { $description "Return a vector of zeros with the given " { $snippet "length" } " and the same element type as " { $snippet "v" } "." } ;
 
+HELP: smatrix{
+{ $syntax <" smatrix{
+    { 1.0 0.0 0.0 1.0 }
+    { 0.0 1.0 0.0 2.0 }
+    { 0.0 0.0 1.0 3.0 }
+    { 0.0 0.0 0.0 1.0 }
+} "> }
+{ $description "Construct a literal " { $link float-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
+
+HELP: dmatrix{
+{ $syntax <" dmatrix{
+    { 1.0 0.0 0.0 1.0 }
+    { 0.0 1.0 0.0 2.0 }
+    { 0.0 0.0 1.0 3.0 }
+    { 0.0 0.0 0.0 1.0 }
+} "> }
+{ $description "Construct a literal " { $link double-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
+
+HELP: cmatrix{
+{ $syntax <" cmatrix{
+    { 1.0 0.0           0.0 1.0           }
+    { 0.0 C{ 0.0 1.0 }  0.0 2.0           }
+    { 0.0 0.0          -1.0 3.0           }
+    { 0.0 0.0           0.0 C{ 0.0 -1.0 } }
+} "> }
+{ $description "Construct a literal " { $link float-complex-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
+
+HELP: zmatrix{
+{ $syntax <" zmatrix{
+    { 1.0 0.0           0.0 1.0           }
+    { 0.0 C{ 0.0 1.0 }  0.0 2.0           }
+    { 0.0 0.0          -1.0 3.0           }
+    { 0.0 0.0           0.0 C{ 0.0 -1.0 } }
+} "> }
+{ $description "Construct a literal " { $link double-complex-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
+
+{
+    POSTPONE: smatrix{ POSTPONE: dmatrix{
+    POSTPONE: cmatrix{ POSTPONE: zmatrix{
+} related-words
index dabf3c3ee92249b7b5df2310a84538a9bcb0ee9e..cf0c25745edca30dbd05c673f41fda43a1411f9e 100644 (file)
@@ -1,4 +1,4 @@
-USING: kernel math.blas.matrices math.blas.vectors math.blas.syntax
+USING: kernel math.blas.matrices math.blas.vectors
 sequences tools.test ;
 IN: math.blas.matrices.tests
 
index f6b98e3ae2641020a9f901f2c70da680def3d511..7b03ddf42a99086ef52b6430ffe37eede2aa5b3f 100755 (executable)
@@ -4,7 +4,8 @@ math math.blas.cblas math.blas.vectors math.blas.vectors.private
 math.complex math.functions math.order functors words
 sequences sequences.merged sequences.private shuffle
 specialized-arrays.direct.float specialized-arrays.direct.double
-specialized-arrays.float specialized-arrays.double ;
+specialized-arrays.float specialized-arrays.double
+parser prettyprint.backend prettyprint.custom ;
 IN: math.blas.matrices
 
 TUPLE: blas-matrix-base underlying ld rows cols transpose ;
@@ -258,6 +259,7 @@ XGERC       IS cblas_${T}ger${C}
 MATRIX      DEFINES ${TYPE}-blas-matrix
 <MATRIX>    DEFINES <${TYPE}-blas-matrix>
 >MATRIX     DEFINES >${TYPE}-blas-matrix
+XMATRIX{    DEFINES ${T}matrix{
 
 WHERE
 
@@ -291,6 +293,11 @@ M: MATRIX n*V(*)Vconj+M!
     [ TYPE>ARG ] (prepare-ger)
     [ XGERC ] dip ;
 
+: XMATRIX{ \ } [ >MATRIX ] parse-literal ; parsing
+
+M: MATRIX pprint-delims
+    drop \ XMATRIX{ \ } ;
+
 ;FUNCTOR
 
 
@@ -305,3 +312,6 @@ M: MATRIX n*V(*)Vconj+M!
 "double-complex" "z" define-complex-blas-matrix
 
 >>
+
+M: blas-matrix-base >pprint-sequence Mrows ;
+M: blas-matrix-base pprint* pprint-object ;
diff --git a/basis/math/blas/syntax/authors.txt b/basis/math/blas/syntax/authors.txt
deleted file mode 100644 (file)
index f13c9c1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Joe Groff
diff --git a/basis/math/blas/syntax/summary.txt b/basis/math/blas/syntax/summary.txt
deleted file mode 100644 (file)
index a71bebb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Literal syntax for BLAS vectors and matrices
diff --git a/basis/math/blas/syntax/syntax-docs.factor b/basis/math/blas/syntax/syntax-docs.factor
deleted file mode 100644 (file)
index 6b58df7..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-USING: help.markup help.syntax math.blas.matrices math.blas.vectors multiline ;
-IN: math.blas.syntax
-
-ARTICLE: "math.blas.syntax" "BLAS interface literal syntax"
-"Vectors:"
-{ $subsection POSTPONE: svector{ }
-{ $subsection POSTPONE: dvector{ }
-{ $subsection POSTPONE: cvector{ }
-{ $subsection POSTPONE: zvector{ }
-"Matrices:"
-{ $subsection POSTPONE: smatrix{ }
-{ $subsection POSTPONE: dmatrix{ }
-{ $subsection POSTPONE: cmatrix{ }
-{ $subsection POSTPONE: zmatrix{ } ;
-
-ABOUT: "math.blas.syntax"
-
-HELP: svector{
-{ $syntax "svector{ 1.0 -2.0 3.0 }" }
-{ $description "Construct a literal " { $link float-blas-vector } "." } ;
-
-HELP: dvector{
-{ $syntax "dvector{ 1.0 -2.0 3.0 }" }
-{ $description "Construct a literal " { $link double-blas-vector } "." } ;
-
-HELP: cvector{
-{ $syntax "cvector{ 1.0 -2.0 C{ 3.0 -1.0 } }" }
-{ $description "Construct a literal " { $link float-complex-blas-vector } "." } ;
-
-HELP: zvector{
-{ $syntax "dvector{ 1.0 -2.0 C{ 3.0 -1.0 } }" }
-{ $description "Construct a literal " { $link double-complex-blas-vector } "." } ;
-
-{
-    POSTPONE: svector{ POSTPONE: dvector{
-    POSTPONE: cvector{ POSTPONE: zvector{
-} related-words
-
-HELP: smatrix{
-{ $syntax <" smatrix{
-    { 1.0 0.0 0.0 1.0 }
-    { 0.0 1.0 0.0 2.0 }
-    { 0.0 0.0 1.0 3.0 }
-    { 0.0 0.0 0.0 1.0 }
-} "> }
-{ $description "Construct a literal " { $link float-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
-
-HELP: dmatrix{
-{ $syntax <" dmatrix{
-    { 1.0 0.0 0.0 1.0 }
-    { 0.0 1.0 0.0 2.0 }
-    { 0.0 0.0 1.0 3.0 }
-    { 0.0 0.0 0.0 1.0 }
-} "> }
-{ $description "Construct a literal " { $link double-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
-
-HELP: cmatrix{
-{ $syntax <" cmatrix{
-    { 1.0 0.0           0.0 1.0           }
-    { 0.0 C{ 0.0 1.0 }  0.0 2.0           }
-    { 0.0 0.0          -1.0 3.0           }
-    { 0.0 0.0           0.0 C{ 0.0 -1.0 } }
-} "> }
-{ $description "Construct a literal " { $link float-complex-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
-
-HELP: zmatrix{
-{ $syntax <" zmatrix{
-    { 1.0 0.0           0.0 1.0           }
-    { 0.0 C{ 0.0 1.0 }  0.0 2.0           }
-    { 0.0 0.0          -1.0 3.0           }
-    { 0.0 0.0           0.0 C{ 0.0 -1.0 } }
-} "> }
-{ $description "Construct a literal " { $link double-complex-blas-matrix } ". Note that although BLAS matrices are stored in column-major order, the literal is specified in row-major order." } ;
-
-{
-    POSTPONE: smatrix{ POSTPONE: dmatrix{
-    POSTPONE: cmatrix{ POSTPONE: zmatrix{
-} related-words
diff --git a/basis/math/blas/syntax/syntax.factor b/basis/math/blas/syntax/syntax.factor
deleted file mode 100644 (file)
index 2d171a8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-USING: kernel math.blas.vectors math.blas.matrices parser
-arrays prettyprint.backend prettyprint.custom sequences ;
-IN: math.blas.syntax
-
-: svector{
-    \ } [ >float-blas-vector ] parse-literal ; parsing
-: dvector{
-    \ } [ >double-blas-vector ] parse-literal ; parsing
-: cvector{
-    \ } [ >float-complex-blas-vector ] parse-literal ; parsing
-: zvector{
-    \ } [ >double-complex-blas-vector ] parse-literal ; parsing
-
-: smatrix{
-    \ } [ >float-blas-matrix ] parse-literal ; parsing
-: dmatrix{
-    \ } [ >double-blas-matrix ] parse-literal ; parsing
-: cmatrix{
-    \ } [ >float-complex-blas-matrix ] parse-literal ; parsing
-: zmatrix{
-    \ } [ >double-complex-blas-matrix ] parse-literal ; parsing
-
-M: float-blas-vector pprint-delims
-    drop \ svector{ \ } ;
-M: double-blas-vector pprint-delims
-    drop \ dvector{ \ } ;
-M: float-complex-blas-vector pprint-delims
-    drop \ cvector{ \ } ;
-M: double-complex-blas-vector pprint-delims
-    drop \ zvector{ \ } ;
-
-M: float-blas-matrix pprint-delims
-    drop \ smatrix{ \ } ;
-M: double-blas-matrix pprint-delims
-    drop \ dmatrix{ \ } ;
-M: float-complex-blas-matrix pprint-delims
-    drop \ cmatrix{ \ } ;
-M: double-complex-blas-matrix pprint-delims
-    drop \ zmatrix{ \ } ;
-
-M: blas-vector-base >pprint-sequence ;
-M: blas-vector-base pprint* pprint-object ;
-M: blas-matrix-base >pprint-sequence Mrows ;
-M: blas-matrix-base pprint* pprint-object ;
diff --git a/basis/math/blas/syntax/tags.txt b/basis/math/blas/syntax/tags.txt
deleted file mode 100644 (file)
index ede10ab..0000000
+++ /dev/null
@@ -1 +0,0 @@
-math
index cb26d67334a4080c18ac701b86c44f12a1459366..b37a4b966ea3684282296f2ed67047f7e9d7548d 100644 (file)
@@ -23,7 +23,12 @@ ARTICLE: "math.blas.vectors" "BLAS interface vector operations"
 { $subsection V- }
 "Vector inner products:"
 { $subsection V. }
-{ $subsection V.conj } ;
+{ $subsection V.conj }
+"Literal syntax:"
+{ $subsection POSTPONE: svector{ }
+{ $subsection POSTPONE: dvector{ }
+{ $subsection POSTPONE: cvector{ }
+{ $subsection POSTPONE: zvector{ } ;
 
 ABOUT: "math.blas.vectors"
 
@@ -129,3 +134,25 @@ HELP: V/n
 HELP: Vsub
 { $values { "v" blas-vector-base } { "start" integer } { "length" integer } { "sub" blas-vector-base } }
 { $description "Slice a subvector out of " { $snippet "v" } " starting at " { $snippet "start" } " with the given " { $snippet "length" } ". The subvector will share storage with the parent vector." } ;
+
+HELP: svector{
+{ $syntax "svector{ 1.0 -2.0 3.0 }" }
+{ $description "Construct a literal " { $link float-blas-vector } "." } ;
+
+HELP: dvector{
+{ $syntax "dvector{ 1.0 -2.0 3.0 }" }
+{ $description "Construct a literal " { $link double-blas-vector } "." } ;
+
+HELP: cvector{
+{ $syntax "cvector{ 1.0 -2.0 C{ 3.0 -1.0 } }" }
+{ $description "Construct a literal " { $link float-complex-blas-vector } "." } ;
+
+HELP: zvector{
+{ $syntax "dvector{ 1.0 -2.0 C{ 3.0 -1.0 } }" }
+{ $description "Construct a literal " { $link double-complex-blas-vector } "." } ;
+
+{
+    POSTPONE: svector{ POSTPONE: dvector{
+    POSTPONE: cvector{ POSTPONE: zvector{
+} related-words
+
index 5f9e8fdc42a6c82e659e245a1882ebc07589b0c7..da271a4fc7d4b1f4fa015ce93f9c8d1a8bb1efe6 100644 (file)
@@ -1,4 +1,4 @@
-USING: kernel math.blas.vectors math.blas.syntax sequences tools.test ;
+USING: kernel math.blas.vectors sequences tools.test ;
 IN: math.blas.vectors.tests
 
 ! clone
index c86fa30115953f8cf5b375b23fc53eeea7067914..3b7f89f730dd0c68bd86f56a43a436f57ce45ba9 100755 (executable)
@@ -2,7 +2,7 @@ USING: accessors alien alien.c-types arrays byte-arrays combinators
 combinators.short-circuit fry kernel math math.blas.cblas
 math.complex math.functions math.order sequences.complex
 sequences.complex-components sequences sequences.private
-functors words locals
+functors words locals parser prettyprint.backend prettyprint.custom
 specialized-arrays.float specialized-arrays.double
 specialized-arrays.direct.float specialized-arrays.direct.double ;
 IN: math.blas.vectors
@@ -138,6 +138,8 @@ VECTOR         DEFINES ${TYPE}-blas-vector
 <VECTOR>       DEFINES <${TYPE}-blas-vector>
 >VECTOR        DEFINES >${TYPE}-blas-vector
 
+XVECTOR{       DEFINES ${T}vector{
+
 WHERE
 
 TUPLE: VECTOR < blas-vector-base ;
@@ -165,6 +167,11 @@ M: VECTOR (blas-direct-array)
     [ [ length>> ] [ inc>> ] bi * ] bi
     <DIRECT-ARRAY> ;
 
+: XVECTOR{ \ } [ >VECTOR ] parse-literal ; parsing
+
+M: VECTOR pprint-delims
+    drop \ XVECTOR{ \ } ;
+
 ;FUNCTOR
 
 
@@ -270,3 +277,5 @@ M: VECTOR n*V!
 
 >>
 
+M: blas-vector-base >pprint-sequence ;
+M: blas-vector-base pprint* pprint-object ;
index 71a1d2add76591b46e66acf75ed3a2f34376dc7d..ca9453dd0caf1e72273bb82674e6c764e9f681da 100644 (file)
Binary files a/extra/sequences/squish/.squish.factor.swo and b/extra/sequences/squish/.squish.factor.swo differ
index c42747af47a1f4fb0208717cf946c08891d9da67..214c6895e28569a7b760a5a1b3899000315119dc 100644 (file)
@@ -10,4 +10,3 @@ IN: sequences.squish
 
 : squish-strings ( seq -- seq' )
     [ { [ sequence? ] [ integer? not ] } 1&& ] "" squish ;
-