math.blas.matrices: port back to new functors
parent
41859c47e7
commit
a40fef851a
|
@ -96,10 +96,10 @@ ARTICLE: "math.blas.matrices" "BLAS interface matrix operations"
|
|||
}
|
||||
"Literal syntax:"
|
||||
{ $subsections
|
||||
postpone: \smatrix{
|
||||
postpone: \dmatrix{
|
||||
postpone: \cmatrix{
|
||||
postpone: \zmatrix{
|
||||
postpone: \Smatrix{
|
||||
postpone: \Dmatrix{
|
||||
postpone: \Cmatrix{
|
||||
postpone: \Zmatrix{
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -270,8 +270,8 @@ 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{
|
||||
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 }
|
||||
|
@ -279,8 +279,8 @@ HELP: \smatrix{
|
|||
}" }
|
||||
{ $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{
|
||||
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 }
|
||||
|
@ -288,8 +288,8 @@ HELP: \dmatrix{
|
|||
}" }
|
||||
{ $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{
|
||||
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 }
|
||||
|
@ -297,8 +297,8 @@ HELP: \cmatrix{
|
|||
}" }
|
||||
{ $description "Construct a literal " { $link complex-float-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{
|
||||
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 }
|
||||
|
@ -307,6 +307,6 @@ HELP: \zmatrix{
|
|||
{ $description "Construct a literal " { $link complex-double-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{
|
||||
postpone: \Smatrix{ postpone: \Dmatrix{
|
||||
postpone: \Cmatrix{ postpone: \Zmatrix{
|
||||
} related-words
|
||||
|
|
|
@ -4,76 +4,76 @@ IN: math.blas.matrices.tests
|
|||
|
||||
! clone
|
||||
|
||||
{ smatrix{
|
||||
{ Smatrix{
|
||||
{ 1.0 2.0 3.0 }
|
||||
{ 4.0 5.0 6.0 }
|
||||
{ 7.0 8.0 9.0 }
|
||||
} } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 2.0 3.0 }
|
||||
{ 4.0 5.0 6.0 }
|
||||
{ 7.0 8.0 9.0 }
|
||||
} clone
|
||||
] unit-test
|
||||
{ f } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 2.0 3.0 }
|
||||
{ 4.0 5.0 6.0 }
|
||||
{ 7.0 8.0 9.0 }
|
||||
} dup clone eq?
|
||||
] unit-test
|
||||
|
||||
{ dmatrix{
|
||||
{ Dmatrix{
|
||||
{ 1.0 2.0 3.0 }
|
||||
{ 4.0 5.0 6.0 }
|
||||
{ 7.0 8.0 9.0 }
|
||||
} } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 2.0 3.0 }
|
||||
{ 4.0 5.0 6.0 }
|
||||
{ 7.0 8.0 9.0 }
|
||||
} clone
|
||||
] unit-test
|
||||
{ f } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 2.0 3.0 }
|
||||
{ 4.0 5.0 6.0 }
|
||||
{ 7.0 8.0 9.0 }
|
||||
} dup clone eq?
|
||||
] unit-test
|
||||
|
||||
{ cmatrix{
|
||||
{ Cmatrix{
|
||||
{ C{ 1.0 1.0 } 2.0 3.0 }
|
||||
{ 4.0 C{ 5.0 2.0 } 6.0 }
|
||||
{ 7.0 8.0 C{ 9.0 3.0 } }
|
||||
} } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ C{ 1.0 1.0 } 2.0 3.0 }
|
||||
{ 4.0 C{ 5.0 2.0 } 6.0 }
|
||||
{ 7.0 8.0 C{ 9.0 3.0 } }
|
||||
} clone
|
||||
] unit-test
|
||||
{ f } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ C{ 1.0 1.0 } 2.0 3.0 }
|
||||
{ 4.0 C{ 5.0 2.0 } 6.0 }
|
||||
{ 7.0 8.0 C{ 9.0 3.0 } }
|
||||
} dup clone eq?
|
||||
] unit-test
|
||||
|
||||
{ zmatrix{
|
||||
{ Zmatrix{
|
||||
{ C{ 1.0 1.0 } 2.0 3.0 }
|
||||
{ 4.0 C{ 5.0 2.0 } 6.0 }
|
||||
{ 7.0 8.0 C{ 9.0 3.0 } }
|
||||
} } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ C{ 1.0 1.0 } 2.0 3.0 }
|
||||
{ 4.0 C{ 5.0 2.0 } 6.0 }
|
||||
{ 7.0 8.0 C{ 9.0 3.0 } }
|
||||
} clone
|
||||
] unit-test
|
||||
{ f } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ C{ 1.0 1.0 } 2.0 3.0 }
|
||||
{ 4.0 C{ 5.0 2.0 } 6.0 }
|
||||
{ 7.0 8.0 C{ 9.0 3.0 } }
|
||||
|
@ -82,148 +82,148 @@ IN: math.blas.matrices.tests
|
|||
|
||||
! M.V
|
||||
|
||||
{ svector{ 3.0 1.0 6.0 } } [
|
||||
smatrix{
|
||||
{ Svector{ 3.0 1.0 6.0 } } [
|
||||
Smatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 0.0 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
}
|
||||
svector{ 1.0 2.0 3.0 1.0 }
|
||||
Svector{ 1.0 2.0 3.0 1.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
{ svector{ -2.0 1.0 3.0 14.0 } } [
|
||||
smatrix{
|
||||
{ Svector{ -2.0 1.0 3.0 14.0 } } [
|
||||
Smatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 0.0 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
} Mtranspose
|
||||
svector{ 1.0 2.0 3.0 }
|
||||
Svector{ 1.0 2.0 3.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
|
||||
{ dvector{ 3.0 1.0 6.0 } } [
|
||||
dmatrix{
|
||||
{ Dvector{ 3.0 1.0 6.0 } } [
|
||||
Dmatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 0.0 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
}
|
||||
dvector{ 1.0 2.0 3.0 1.0 }
|
||||
Dvector{ 1.0 2.0 3.0 1.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
{ dvector{ -2.0 1.0 3.0 14.0 } } [
|
||||
dmatrix{
|
||||
{ Dvector{ -2.0 1.0 3.0 14.0 } } [
|
||||
Dmatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 0.0 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
} Mtranspose
|
||||
dvector{ 1.0 2.0 3.0 }
|
||||
Dvector{ 1.0 2.0 3.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
|
||||
{ cvector{ 3.0 C{ 1.0 2.0 } 6.0 } } [
|
||||
cmatrix{
|
||||
{ Cvector{ 3.0 C{ 1.0 2.0 } 6.0 } } [
|
||||
Cmatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
}
|
||||
cvector{ 1.0 2.0 3.0 1.0 }
|
||||
Cvector{ 1.0 2.0 3.0 1.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
{ cvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } } [
|
||||
cmatrix{
|
||||
{ Cvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } } [
|
||||
Cmatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
} Mtranspose
|
||||
cvector{ 1.0 2.0 3.0 }
|
||||
Cvector{ 1.0 2.0 3.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
|
||||
{ zvector{ 3.0 C{ 1.0 2.0 } 6.0 } } [
|
||||
zmatrix{
|
||||
{ Zvector{ 3.0 C{ 1.0 2.0 } 6.0 } } [
|
||||
Zmatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
}
|
||||
zvector{ 1.0 2.0 3.0 1.0 }
|
||||
Zvector{ 1.0 2.0 3.0 1.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
{ zvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } } [
|
||||
zmatrix{
|
||||
{ Zvector{ -2.0 C{ 1.0 2.0 } 3.0 14.0 } } [
|
||||
Zmatrix{
|
||||
{ 0.0 1.0 0.0 1.0 }
|
||||
{ -1.0 C{ 0.0 1.0 } 0.0 2.0 }
|
||||
{ 0.0 0.0 1.0 3.0 }
|
||||
} Mtranspose
|
||||
zvector{ 1.0 2.0 3.0 }
|
||||
Zvector{ 1.0 2.0 3.0 }
|
||||
M.V
|
||||
] unit-test
|
||||
|
||||
! V(*)
|
||||
|
||||
{ smatrix{
|
||||
{ Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 4.0 6.0 8.0 }
|
||||
{ 3.0 6.0 9.0 12.0 }
|
||||
} } [
|
||||
svector{ 1.0 2.0 3.0 } svector{ 1.0 2.0 3.0 4.0 } V(*)
|
||||
Svector{ 1.0 2.0 3.0 } Svector{ 1.0 2.0 3.0 4.0 } V(*)
|
||||
] unit-test
|
||||
|
||||
{ dmatrix{
|
||||
{ Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 4.0 6.0 8.0 }
|
||||
{ 3.0 6.0 9.0 12.0 }
|
||||
} } [
|
||||
dvector{ 1.0 2.0 3.0 } dvector{ 1.0 2.0 3.0 4.0 } V(*)
|
||||
Dvector{ 1.0 2.0 3.0 } Dvector{ 1.0 2.0 3.0 4.0 } V(*)
|
||||
] unit-test
|
||||
|
||||
{ cmatrix{
|
||||
{ Cmatrix{
|
||||
{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 }
|
||||
{ 2.0 4.0 C{ 6.0 -6.0 } 8.0 }
|
||||
{ C{ 3.0 3.0 } C{ 6.0 6.0 } 18.0 C{ 12.0 12.0 } }
|
||||
} } [
|
||||
cvector{ 1.0 2.0 C{ 3.0 3.0 } } cvector{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 } V(*)
|
||||
Cvector{ 1.0 2.0 C{ 3.0 3.0 } } Cvector{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 } V(*)
|
||||
] unit-test
|
||||
|
||||
{ zmatrix{
|
||||
{ Zmatrix{
|
||||
{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 }
|
||||
{ 2.0 4.0 C{ 6.0 -6.0 } 8.0 }
|
||||
{ C{ 3.0 3.0 } C{ 6.0 6.0 } 18.0 C{ 12.0 12.0 } }
|
||||
} } [
|
||||
zvector{ 1.0 2.0 C{ 3.0 3.0 } } zvector{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 } V(*)
|
||||
Zvector{ 1.0 2.0 C{ 3.0 3.0 } } Zvector{ 1.0 2.0 C{ 3.0 -3.0 } 4.0 } V(*)
|
||||
] unit-test
|
||||
|
||||
! M.
|
||||
|
||||
{ smatrix{
|
||||
{ Smatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 0.0 -3.0 0.0 0.0 }
|
||||
{ 0.0 4.0 0.0 0.0 10.0 }
|
||||
{ 0.0 0.0 0.0 0.0 0.0 }
|
||||
} } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
{ 0.0 0.0 0.0 }
|
||||
} smatrix{
|
||||
} Smatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 2.0 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} M.
|
||||
] unit-test
|
||||
|
||||
{ smatrix{
|
||||
{ Smatrix{
|
||||
{ 1.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 -3.0 0.0 0.0 }
|
||||
{ 4.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 10.0 0.0 }
|
||||
} } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 2.0 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} Mtranspose smatrix{
|
||||
} Mtranspose Smatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
|
@ -231,36 +231,36 @@ IN: math.blas.matrices.tests
|
|||
} Mtranspose M.
|
||||
] unit-test
|
||||
|
||||
{ dmatrix{
|
||||
{ Dmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 0.0 -3.0 0.0 0.0 }
|
||||
{ 0.0 4.0 0.0 0.0 10.0 }
|
||||
{ 0.0 0.0 0.0 0.0 0.0 }
|
||||
} } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
{ 0.0 0.0 0.0 }
|
||||
} dmatrix{
|
||||
} Dmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 2.0 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} M.
|
||||
] unit-test
|
||||
|
||||
{ dmatrix{
|
||||
{ Dmatrix{
|
||||
{ 1.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 -3.0 0.0 0.0 }
|
||||
{ 4.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 10.0 0.0 }
|
||||
} } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 2.0 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} Mtranspose dmatrix{
|
||||
} Mtranspose Dmatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
|
@ -268,36 +268,36 @@ IN: math.blas.matrices.tests
|
|||
} Mtranspose M.
|
||||
] unit-test
|
||||
|
||||
{ cmatrix{
|
||||
{ Cmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 0.0 -3.0 0.0 0.0 }
|
||||
{ 0.0 C{ 4.0 -4.0 } 0.0 0.0 10.0 }
|
||||
{ 0.0 0.0 0.0 0.0 0.0 }
|
||||
} } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
{ 0.0 0.0 0.0 }
|
||||
} cmatrix{
|
||||
} Cmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 C{ 2.0 -2.0 } 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} M.
|
||||
] unit-test
|
||||
|
||||
{ cmatrix{
|
||||
{ Cmatrix{
|
||||
{ 1.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 C{ 4.0 -4.0 } 0.0 }
|
||||
{ 0.0 -3.0 0.0 0.0 }
|
||||
{ 4.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 10.0 0.0 }
|
||||
} } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 C{ 2.0 -2.0 } 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} Mtranspose cmatrix{
|
||||
} Mtranspose Cmatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
|
@ -305,36 +305,36 @@ IN: math.blas.matrices.tests
|
|||
} Mtranspose M.
|
||||
] unit-test
|
||||
|
||||
{ zmatrix{
|
||||
{ Zmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 0.0 -3.0 0.0 0.0 }
|
||||
{ 0.0 C{ 4.0 -4.0 } 0.0 0.0 10.0 }
|
||||
{ 0.0 0.0 0.0 0.0 0.0 }
|
||||
} } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
{ 0.0 0.0 0.0 }
|
||||
} zmatrix{
|
||||
} Zmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 C{ 2.0 -2.0 } 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} M.
|
||||
] unit-test
|
||||
|
||||
{ zmatrix{
|
||||
{ Zmatrix{
|
||||
{ 1.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 C{ 4.0 -4.0 } 0.0 }
|
||||
{ 0.0 -3.0 0.0 0.0 }
|
||||
{ 4.0 0.0 0.0 0.0 }
|
||||
{ 0.0 0.0 10.0 0.0 }
|
||||
} } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ 1.0 0.0 0.0 4.0 0.0 }
|
||||
{ 0.0 C{ 2.0 -2.0 } 0.0 0.0 5.0 }
|
||||
{ 0.0 0.0 3.0 0.0 0.0 }
|
||||
} Mtranspose zmatrix{
|
||||
} Mtranspose Zmatrix{
|
||||
{ 1.0 0.0 0.0 }
|
||||
{ 0.0 0.0 -1.0 }
|
||||
{ 0.0 2.0 0.0 }
|
||||
|
@ -344,41 +344,41 @@ IN: math.blas.matrices.tests
|
|||
|
||||
! n*M
|
||||
|
||||
{ smatrix{
|
||||
{ Smatrix{
|
||||
{ 2.0 0.0 }
|
||||
{ 0.0 2.0 }
|
||||
} } [
|
||||
2.0 smatrix{
|
||||
2.0 Smatrix{
|
||||
{ 1.0 0.0 }
|
||||
{ 0.0 1.0 }
|
||||
} n*M
|
||||
] unit-test
|
||||
|
||||
{ dmatrix{
|
||||
{ Dmatrix{
|
||||
{ 2.0 0.0 }
|
||||
{ 0.0 2.0 }
|
||||
} } [
|
||||
2.0 dmatrix{
|
||||
2.0 Dmatrix{
|
||||
{ 1.0 0.0 }
|
||||
{ 0.0 1.0 }
|
||||
} n*M
|
||||
] unit-test
|
||||
|
||||
{ cmatrix{
|
||||
{ Cmatrix{
|
||||
{ C{ 2.0 1.0 } 0.0 }
|
||||
{ 0.0 C{ -1.0 2.0 } }
|
||||
} } [
|
||||
C{ 2.0 1.0 } cmatrix{
|
||||
C{ 2.0 1.0 } Cmatrix{
|
||||
{ 1.0 0.0 }
|
||||
{ 0.0 C{ 0.0 1.0 } }
|
||||
} n*M
|
||||
] unit-test
|
||||
|
||||
{ zmatrix{
|
||||
{ Zmatrix{
|
||||
{ C{ 2.0 1.0 } 0.0 }
|
||||
{ 0.0 C{ -1.0 2.0 } }
|
||||
} } [
|
||||
C{ 2.0 1.0 } zmatrix{
|
||||
C{ 2.0 1.0 } Zmatrix{
|
||||
{ 1.0 0.0 }
|
||||
{ 0.0 C{ 0.0 1.0 } }
|
||||
} n*M
|
||||
|
@ -386,228 +386,228 @@ IN: math.blas.matrices.tests
|
|||
|
||||
! Mrows, Mcols
|
||||
|
||||
{ svector{ 3.0 3.0 3.0 } } [
|
||||
2 smatrix{
|
||||
{ Svector{ 3.0 3.0 3.0 } } [
|
||||
2 Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mcols nth
|
||||
] unit-test
|
||||
{ svector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 smatrix{
|
||||
{ Svector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mrows nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mrows length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mcols length
|
||||
] unit-test
|
||||
{ svector{ 3.0 3.0 3.0 } } [
|
||||
2 smatrix{
|
||||
{ Svector{ 3.0 3.0 3.0 } } [
|
||||
2 Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mrows nth
|
||||
] unit-test
|
||||
{ svector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 smatrix{
|
||||
{ Svector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mcols nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mcols length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mrows length
|
||||
] unit-test
|
||||
|
||||
{ dvector{ 3.0 3.0 3.0 } } [
|
||||
2 dmatrix{
|
||||
{ Dvector{ 3.0 3.0 3.0 } } [
|
||||
2 Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mcols nth
|
||||
] unit-test
|
||||
{ dvector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 dmatrix{
|
||||
{ Dvector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mrows nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mrows length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mcols length
|
||||
] unit-test
|
||||
{ dvector{ 3.0 3.0 3.0 } } [
|
||||
2 dmatrix{
|
||||
{ Dvector{ 3.0 3.0 3.0 } } [
|
||||
2 Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mrows nth
|
||||
] unit-test
|
||||
{ dvector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 dmatrix{
|
||||
{ Dvector{ 3.0 2.0 3.0 4.0 } } [
|
||||
2 Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mcols nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mcols length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 1.0 2.0 3.0 4.0 }
|
||||
{ 2.0 2.0 3.0 4.0 }
|
||||
{ 3.0 2.0 3.0 4.0 }
|
||||
} Mtranspose Mrows length
|
||||
] unit-test
|
||||
|
||||
{ cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 cmatrix{
|
||||
{ Cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mcols nth
|
||||
] unit-test
|
||||
{ cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 cmatrix{
|
||||
{ Cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mrows nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mrows length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mcols length
|
||||
] unit-test
|
||||
{ cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 cmatrix{
|
||||
{ Cvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mtranspose Mrows nth
|
||||
] unit-test
|
||||
{ cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 cmatrix{
|
||||
{ Cvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mtranspose Mcols nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mtranspose Mcols length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mtranspose Mrows length
|
||||
] unit-test
|
||||
|
||||
{ zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 zmatrix{
|
||||
{ Zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mcols nth
|
||||
] unit-test
|
||||
{ zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 zmatrix{
|
||||
{ Zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mrows nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mrows length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mcols length
|
||||
] unit-test
|
||||
{ zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 zmatrix{
|
||||
{ Zvector{ C{ 3.0 1.0 } C{ 3.0 2.0 } C{ 3.0 3.0 } } } [
|
||||
2 Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mtranspose Mrows nth
|
||||
] unit-test
|
||||
{ zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 zmatrix{
|
||||
{ Zvector{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } } } [
|
||||
2 Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mtranspose Mcols nth
|
||||
] unit-test
|
||||
{ 3 } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
} Mtranspose Mcols length
|
||||
] unit-test
|
||||
{ 4 } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ C{ 1.0 1.0 } C{ 2.0 1.0 } C{ 3.0 1.0 } C{ 4.0 1.0 } }
|
||||
{ C{ 1.0 2.0 } C{ 2.0 2.0 } C{ 3.0 2.0 } C{ 4.0 2.0 } }
|
||||
{ C{ 1.0 3.0 } C{ 2.0 3.0 } C{ 3.0 3.0 } C{ 4.0 3.0 } }
|
||||
|
@ -616,92 +616,92 @@ IN: math.blas.matrices.tests
|
|||
|
||||
! Msub
|
||||
|
||||
{ smatrix{
|
||||
{ Smatrix{
|
||||
{ 3.0 2.0 1.0 }
|
||||
{ 0.0 1.0 0.0 }
|
||||
} } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 3.0 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
} 1 2 2 3 Msub
|
||||
] unit-test
|
||||
|
||||
{ smatrix{
|
||||
{ Smatrix{
|
||||
{ 3.0 0.0 }
|
||||
{ 2.0 1.0 }
|
||||
{ 1.0 0.0 }
|
||||
} } [
|
||||
smatrix{
|
||||
Smatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 3.0 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
} Mtranspose 2 1 3 2 Msub
|
||||
] unit-test
|
||||
|
||||
{ dmatrix{
|
||||
{ Dmatrix{
|
||||
{ 3.0 2.0 1.0 }
|
||||
{ 0.0 1.0 0.0 }
|
||||
} } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 3.0 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
} 1 2 2 3 Msub
|
||||
] unit-test
|
||||
|
||||
{ dmatrix{
|
||||
{ Dmatrix{
|
||||
{ 3.0 0.0 }
|
||||
{ 2.0 1.0 }
|
||||
{ 1.0 0.0 }
|
||||
} } [
|
||||
dmatrix{
|
||||
Dmatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 3.0 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
} Mtranspose 2 1 3 2 Msub
|
||||
] unit-test
|
||||
|
||||
{ cmatrix{
|
||||
{ Cmatrix{
|
||||
{ C{ 3.0 3.0 } 2.0 1.0 }
|
||||
{ 0.0 1.0 0.0 }
|
||||
} } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
} 1 2 2 3 Msub
|
||||
] unit-test
|
||||
|
||||
{ cmatrix{
|
||||
{ Cmatrix{
|
||||
{ C{ 3.0 3.0 } 0.0 }
|
||||
{ 2.0 1.0 }
|
||||
{ 1.0 0.0 }
|
||||
} } [
|
||||
cmatrix{
|
||||
Cmatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
} Mtranspose 2 1 3 2 Msub
|
||||
] unit-test
|
||||
|
||||
{ zmatrix{
|
||||
{ Zmatrix{
|
||||
{ C{ 3.0 3.0 } 2.0 1.0 }
|
||||
{ 0.0 1.0 0.0 }
|
||||
} } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
} 1 2 2 3 Msub
|
||||
] unit-test
|
||||
|
||||
{ zmatrix{
|
||||
{ Zmatrix{
|
||||
{ C{ 3.0 3.0 } 0.0 }
|
||||
{ 2.0 1.0 }
|
||||
{ 1.0 0.0 }
|
||||
} } [
|
||||
zmatrix{
|
||||
Zmatrix{
|
||||
{ 0.0 1.0 2.0 3.0 2.0 }
|
||||
{ 1.0 0.0 C{ 3.0 3.0 } 2.0 1.0 }
|
||||
{ 2.0 3.0 0.0 1.0 0.0 }
|
||||
|
|
|
@ -5,7 +5,7 @@ math.blas.ffi math.blas.vectors math.blas.vectors.private
|
|||
math.complex math.functions math.order functors words
|
||||
sequences sequences.merged sequences.private shuffle
|
||||
parser prettyprint.backend prettyprint.custom ascii
|
||||
specialized-arrays ;
|
||||
specialized-arrays functors2 strings ;
|
||||
FROM: alien.c-types => float ;
|
||||
SPECIALIZED-ARRAY: float
|
||||
SPECIALIZED-ARRAY: double
|
||||
|
@ -246,70 +246,67 @@ M: blas-matrix-base equal?
|
|||
} 2&& ;
|
||||
|
||||
<<
|
||||
INLINE-FUNCTOR: blas-matrix ( type: name t: string u: string c: string -- ) [[
|
||||
! VECTOR IS ${TYPE}-blas-vector
|
||||
! <VECTOR> IS <${TYPE}-blas-vector>
|
||||
! XGEMV IS ${T}GEMV
|
||||
! XGEMM IS ${T}GEMM
|
||||
! XGERU IS ${T}GER${U}
|
||||
! XGERC IS ${T}GER${C}
|
||||
|
||||
<FUNCTOR: (define-blas-matrix) ( TYPE T U C -- )
|
||||
! MATRIX DEFINES-CLASS ${TYPE}-blas-matrix
|
||||
! <MATRIX> DEFINES <${TYPE}-blas-matrix>
|
||||
! >MATRIX DEFINES >${TYPE}-blas-matrix
|
||||
|
||||
VECTOR IS ${TYPE}-blas-vector
|
||||
<VECTOR> IS <${TYPE}-blas-vector>
|
||||
XGEMV IS ${T}GEMV
|
||||
XGEMM IS ${T}GEMM
|
||||
XGERU IS ${T}GER${U}
|
||||
XGERC IS ${T}GER${C}
|
||||
! t [ T >lower ]
|
||||
|
||||
MATRIX DEFINES-CLASS ${TYPE}-blas-matrix
|
||||
<MATRIX> DEFINES <${TYPE}-blas-matrix>
|
||||
>MATRIX DEFINES >${TYPE}-blas-matrix
|
||||
! XMATRIX{ DEFINES ${t}matrix{
|
||||
|
||||
t [ T >lower ]
|
||||
TUPLE: ${type}-blas-matrix < blas-matrix-base ;
|
||||
: <${type}-blas-matrix> ( underlying ld rows cols transpose -- matrix )
|
||||
${type}-blas-matrix boa ; inline
|
||||
: >${type}-blas-matrix ( arrays -- matrix )
|
||||
[ ${type} >c-array underlying>> ] (>matrix) <${type}-blas-matrix> ;
|
||||
|
||||
SYNTAX: ${t}matrix{ \ } [ >${type}-blas-matrix ] parse-literal ;
|
||||
|
||||
XMATRIX{ DEFINES ${t}matrix{
|
||||
M: ${type}-blas-matrix element-type
|
||||
drop ${type} ;
|
||||
M: ${type}-blas-matrix (blas-matrix-like)
|
||||
drop <${type}-blas-matrix> ;
|
||||
M: ${type}-blas-vector (blas-matrix-like)
|
||||
drop <${type}-blas-matrix> ;
|
||||
M: ${type}-blas-matrix (blas-vector-like)
|
||||
drop <${type}-blas-vector> ;
|
||||
|
||||
WHERE
|
||||
|
||||
TUPLE: MATRIX < blas-matrix-base ;
|
||||
: <MATRIX> ( underlying ld rows cols transpose -- matrix )
|
||||
MATRIX boa ; inline
|
||||
|
||||
M: MATRIX element-type
|
||||
drop TYPE ;
|
||||
M: MATRIX (blas-matrix-like)
|
||||
drop <MATRIX> ;
|
||||
M: VECTOR (blas-matrix-like)
|
||||
drop <MATRIX> ;
|
||||
M: MATRIX (blas-vector-like)
|
||||
drop <VECTOR> ;
|
||||
|
||||
: >MATRIX ( arrays -- matrix )
|
||||
[ TYPE >c-array underlying>> ] (>matrix) <MATRIX> ;
|
||||
|
||||
M: VECTOR n*M.V+n*V!
|
||||
(prepare-gemv) [ XGEMV ] dip ;
|
||||
M: MATRIX n*M.M+n*M!
|
||||
(prepare-gemm) [ XGEMM ] dip ;
|
||||
M: MATRIX n*V(*)V+M!
|
||||
(prepare-ger) [ XGERU ] dip ;
|
||||
M: MATRIX n*V(*)Vconj+M!
|
||||
(prepare-ger) [ XGERC ] dip ;
|
||||
|
||||
SYNTAX: XMATRIX{ \ } [ >MATRIX ] parse-literal ;
|
||||
|
||||
M: MATRIX pprint-delims
|
||||
drop \ XMATRIX{ \ } ;
|
||||
|
||||
;FUNCTOR>
|
||||
|
||||
|
||||
: define-real-blas-matrix ( TYPE T -- )
|
||||
"" "" (define-blas-matrix) ;
|
||||
: define-complex-blas-matrix ( TYPE T -- )
|
||||
"U" "C" (define-blas-matrix) ;
|
||||
|
||||
float "S" define-real-blas-matrix
|
||||
double "D" define-real-blas-matrix
|
||||
complex-float "C" define-complex-blas-matrix
|
||||
complex-double "Z" define-complex-blas-matrix
|
||||
M: ${type}-blas-vector n*M.V+n*V!
|
||||
(prepare-gemv) [ ${t}GEMV ] dip ;
|
||||
M: ${type}-blas-matrix n*M.M+n*M!
|
||||
(prepare-gemm) [ ${t}GEMM ] dip ;
|
||||
M: ${type}-blas-matrix n*V(*)V+M!
|
||||
(prepare-ger) [ ${t}GER${u} ] dip ;
|
||||
M: ${type}-blas-matrix n*V(*)Vconj+M!
|
||||
(prepare-ger) [ ${t}GER${c} ] dip ;
|
||||
|
||||
M: ${type}-blas-matrix pprint-delims
|
||||
drop \ ${t}matrix{ \ } ;
|
||||
]]
|
||||
>>
|
||||
|
||||
|
||||
! : define-real-blas-matrix ( TYPE T -- )
|
||||
! "" "" (define-blas-matrix) ;
|
||||
! : define-complex-blas-matrix ( TYPE T -- )
|
||||
! "U" "C" (define-blas-matrix) ;
|
||||
|
||||
! float "S" define-real-blas-matrix
|
||||
! double "D" define-real-blas-matrix
|
||||
! complex-float "C" define-complex-blas-matrix
|
||||
! complex-double "Z" define-complex-blas-matrix
|
||||
BLAS-MATRIX: float "S" "" ""
|
||||
BLAS-MATRIX: double "D" "" ""
|
||||
BLAS-MATRIX: complex-float "C" "U" "C"
|
||||
BLAS-MATRIX: complex-double "Z" "U" "C"
|
||||
|
||||
M: blas-matrix-base >pprint-sequence Mrows ;
|
||||
M: blas-matrix-base pprint* pprint-object ;
|
||||
|
|
Loading…
Reference in New Issue