diff --git a/extra/math/blas/matrices/matrices-docs.factor b/extra/math/blas/matrices/matrices-docs.factor index 7ac72af58f..12cc579610 100644 --- a/extra/math/blas/matrices/matrices-docs.factor +++ b/extra/math/blas/matrices/matrices-docs.factor @@ -81,17 +81,17 @@ HELP: Mheight HELP: n*M.V+n*V-in-place { $values { "alpha" "a number" } { "A" "an M-row, N-column BLAS matrix inherited from " { $link blas-matrix-base } } { "x" "an N-element BLAS vector inherited from " { $link blas-vector-base } } { "beta" "a number" } { "y" "an M-element BLAS vector inherited from " { $link blas-vector-base } } } { $description "Calculate the matrix-vector product " { $snippet "αAx + βy" } ", and overwrite the current contents of " { $snippet "y" } " with the result. The width of " { $snippet "A" } " must match the length of " { $snippet "x" } ", and the height must match the length of " { $snippet "y" } ". Corresponds to the xGEMV routines in BLAS." } -{ $side-effects "The memory used by " { $snippet "y" } " is overwritten with the result." } ; +{ $side-effects "y" } ; HELP: n*V(*)V+M-in-place { $values { "alpha" "a number" } { "x" "an M-element BLAS vector inherited from " { $link blas-vector-base } } { "y" "an N-element BLAS vector inherited from " { $link blas-vector-base } } { "A" "an M-row, N-column BLAS matrix inherited from " { $link blas-matrix-base } } } { $description "Calculate the outer product " { $snippet "αx⊗y + A" } " and overwrite the current contents of A with the result. The width of " { $snippet "A" } " must match the length of " { $snippet "y" } ", and its height must match the length of " { $snippet "x" } ". Corresponds to the xGER and xGERU routines in BLAS." } -{ $side-effects "The memory used by " { $snippet "A" } " is overwritten with the result." } ; +{ $side-effects "A" } ; HELP: n*V(*)Vconj+M-in-place { $values { "alpha" "a number" } { "x" "an M-element complex BLAS vector inherited from " { $link blas-vector-base } } { "y" "an N-element complex BLAS vector inherited from " { $link blas-vector-base } } { "A" "an M-row, N-column complex BLAS matrix inherited from " { $link blas-matrix-base } } } { $description "Calculate the conjugate outer product " { $snippet "αx⊗y̅ + A" } " and overwrite the current contents of A with the result. The width of " { $snippet "A" } " must match the length of " { $snippet "y" } ", and its height must match the length of " { $snippet "x" } ". Corresponds to the xGERC routines in BLAS." } -{ $side-effects "The memory used by " { $snippet "A" } " is overwritten with the result." } ; +{ $side-effects "A" } ; HELP: n*M.M+n*M-in-place { $values { "alpha" "a number" } { "A" "an M-row, K-column BLAS matrix inherited from " { $link blas-matrix-base } } { "B" "a K-row, N-column BLAS matrix inherited from " { $link blas-matrix-base } } { "beta" "a number" } { "C" "an M-row, N-column BLAS matrix inherited from " { $link blas-matrix-base } } } @@ -172,7 +172,7 @@ HELP: Mcols HELP: n*M-in-place { $values { "n" "a number" } { "A" "A BLAS matrix inheriting from " { $link blas-matrix-base } } } { $description "Calculate the scalar-matrix product " { $snippet "nA" } " and overwrite the current contents of A with the result." } -{ $side-effects "The memory used by " { $snippet "A" } " is overwritten with the result." } ; +{ $side-effects "A" } ; HELP: n*M { $values { "n" "a number" } { "A" "A BLAS matrix inheriting from " { $link blas-matrix-base } } } @@ -191,3 +191,12 @@ HELP: M/n HELP: Mtranspose { $values { "matrix" "A BLAS matrix inheriting from " { $link blas-matrix-base } } } { $description "Returns the transpose of " { $snippet "matrix" } ". The returned matrix shares storage with the original matrix." } ; + +HELP: element-type +{ $values { "v" "a BLAS vector inheriting from " { $link blas-vector-base } ", or a BLAS matrix inheriting from " { $link blas-matrix-base } } } +{ $description "Return the C type of the elements in the given BLAS vector or matrix." } ; + +HELP: +{ $values { "length" "The length of the new vector" } { "exemplar" "a BLAS vector inheriting from " { $link blas-vector-base } ", or a BLAS matrix inheriting from " { $link blas-matrix-base } } } +{ $description "Return a vector of zeros with the given length and the same element type as " { $snippet "v" } "." } ; + diff --git a/extra/math/blas/vectors/vectors-docs.factor b/extra/math/blas/vectors/vectors-docs.factor index 9ebfd40d1c..1518bffd95 100644 --- a/extra/math/blas/vectors/vectors-docs.factor +++ b/extra/math/blas/vectors/vectors-docs.factor @@ -21,19 +21,19 @@ HELP: float-blas-vector HELP: double-blas-vector { $class-description "A vector of double-precision floating-point values. For details on the tuple layout, see " { $link blas-vector-base } "." } ; HELP: float-complex-blas-vector -{ $class-description "A vector of single-precision floating-point complex values. Complex values are stored in memory as two consecutive float values, real part then imaginary part. For details on the tuple layout, see " { $link blas-matrix-base } "." } ; +{ $class-description "A vector of single-precision floating-point complex values. Complex values are stored in memory as two consecutive float values, real part then imaginary part. For details on the tuple layout, see " { $link blas-vector-base } "." } ; HELP: double-complex-blas-vector -{ $class-description "A vector of single-precision floating-point complex values. Complex values are stored in memory as two consecutive float values, real part then imaginary part. For details on the tuple layout, see " { $link blas-matrix-base } "." } ; +{ $class-description "A vector of single-precision floating-point complex values. Complex values are stored in memory as two consecutive float values, real part then imaginary part. For details on the tuple layout, see " { $link blas-vector-base } "." } ; HELP: n*V+V-in-place { $values { "alpha" "a number" } { "x" "a BLAS vector inheriting from " { $link blas-vector-base } } { "y" "a BLAS vector inheriting from " { $link blas-vector-base } } } { $description "Calculate the vector sum " { $snippet "αx + y" } " and replace the existing contents of y with the result. Corresponds to the xAXPY routines in BLAS." } -{ $side-effects "The memory used by y is overwritten with the result." } ; +{ $side-effects "y" } ; HELP: n*V-in-place { $values { "alpha" "a number" } { "x" "a BLAS vector inheriting from " { $link blas-vector-base } } } { $description "Calculate the scalar-vector product " { $snippet "αx" } " and replace the existing contents of x with the result. Corresponds to the xSCAL routines in BLAS." } -{ $side-effects "The memory used by x is overwritten with the result." } ; +{ $side-effects "x" } ; HELP: V. { $values { "x" "a BLAS vector inheriting from " { $link blas-vector-base } } { "y" "a BLAS vector inheriting from " { $link blas-vector-base } } } @@ -54,7 +54,7 @@ HELP: Vasum HELP: Vswap { $values { "x" "a BLAS vector inheriting from " { $link blas-vector-base } } { "y" "a BLAS vector inheriting from " { $link blas-vector-base } } } { $description "Swap the contents of " { $snippet "x" } " and " { $snippet "y" } " in place. Corresponds to the xSWAP routines in BLAS." } -{ $side-effects "The memory contents of the two vectors are exchanged." } ; +{ $side-effects "x" "y" } ; HELP: Viamax { $values { "x" "a BLAS vector inheriting from " { $link blas-vector-base } } } @@ -66,18 +66,10 @@ HELP: Vamax { Viamax Vamax } related-words -HELP: element-type -{ $values { "v" "a BLAS vector inheriting from " { $link blas-vector-base } ", or a BLAS matrix inheriting from " { $link blas-matrix-base } } } -{ $description "Return the C type of the elements in the given BLAS vector or matrix." } ; - HELP: -{ $values { "exemplar" "a BLAS vector inheriting from " { $link blas-vector-base } " } } +{ $values { "exemplar" "a BLAS vector inheriting from " { $link blas-vector-base } } } { $description "Return a vector of zeros with the same length and element type as " { $snippet "v" } ". The vector is constructed with an " { $snippet "inc" } " of zero, so it is not suitable for receiving results from BLAS functions; it is intended to be used as a term in other vector calculations. To construct an empty vector that can be used to receive results, see " { $link } "." } ; -HELP: -{ $values { "length" "The length of the new vector" } { "exemplar" "a BLAS vector inheriting from " { $link blas-vector-base } " } } -{ $description "Return a vector of zeros with the given length and the same element type as " { $snippet "v" } "." } ; - HELP: n*V+V { $values { "alpha" "a number" } { "x" "a BLAS vector inheriting from " { $link blas-vector-base } } { "y" "a BLAS vector inheriting from " { $link blas-vector-base } } } { $description "Calculate the vector sum " { $snippet "αx + y" } " and return a freshly-allocated vector with the same length as " { $snippet "x" } " and " { $snippet "y" } " containing the result. Corresponds to the xAXPY routines in BLAS." } ; diff --git a/extra/math/blas/vectors/vectors.factor b/extra/math/blas/vectors/vectors.factor index b8b8283781..bd3b54c7eb 100644 --- a/extra/math/blas/vectors/vectors.factor +++ b/extra/math/blas/vectors/vectors.factor @@ -26,11 +26,11 @@ GENERIC: n*V-in-place ( alpha x -- x=alpha*x ) GENERIC: V. ( x y -- x.y ) GENERIC: V.conj ( x y -- xconj.y ) -GENERIC: Vnorm ( x -- norm2(x) ) -GENERIC: Vasum ( x -- sum(norm1(x[i])) +GENERIC: Vnorm ( x -- norm ) +GENERIC: Vasum ( x -- sum ) GENERIC: Vswap ( x y -- x=y y=x ) -GENERIC: Viamax ( x -- i-where-x[i]=max(norm1(x[i])) ) +GENERIC: Viamax ( x -- max-i ) GENERIC: element-type ( v -- type )