TensorCore.hadamard!
— Functionhadamard!(dest, A, B)
Similar to hadamard(A, B)
(which can also be written A ⊙ B
), but stores its results in the pre-allocated array dest
.
diff --git a/dev/index.html b/dev/index.html index 6b09fbb..5f5f21b 100644 --- a/dev/index.html +++ b/dev/index.html @@ -9,13 +9,13 @@ julia> a ⊙ [5] ERROR: DimensionMismatch: Axes of `A` and `B` must match, got (Base.OneTo(2),) and (Base.OneTo(1),) -[...]
See also hadamard!(y, a, b)
.
TensorCore.hadamard!
— Functionhadamard!(dest, A, B)
Similar to hadamard(A, B)
(which can also be written A ⊙ B
), but stores its results in the pre-allocated array dest
.
TensorCore.tensor
— Functiontensor(A, B)
+[...]
See also hadamard!(y, a, b)
.
TensorCore.hadamard!
— Functionhadamard!(dest, A, B)
Similar to hadamard(A, B)
(which can also be written A ⊙ B
), but stores its results in the pre-allocated array dest
.
TensorCore.tensor
— Functiontensor(A, B)
A ⊗ B
Compute the tensor product of A
and B
. If C = A ⊗ B
, then C[i1, ..., im, j1, ..., jn] = A[i1, ... im] * B[j1, ..., jn]
.
For vectors v
and w
, the Kronecker product is related to the tensor product by kron(v,w) == vec(w ⊗ v)
or w ⊗ v == reshape(kron(v,w), (length(w), length(v)))
.
Examples
julia> a = [2, 3]; b = [5, 7, 11];
julia> a ⊗ b
2×3 Matrix{Int64}:
10 14 22
- 15 21 33
See also tensor!(Y,A,B)
.
TensorCore.tensor!
— Functiontensor!(dest, A, B)
Similar to tensor(A, B)
(which can also be written A ⊗ B
), but stores its results in the pre-allocated array dest
.
TensorCore.boxdot
— Functionboxdot(A,B) = A ⊡ B # \boxdot
Generalised matrix multiplication: Contracts the last dimension of A
with the first dimension of B
, for any ndims(A)
& ndims(B)
. If both are vectors, then it returns a scalar == sum(A .* B)
.
Examples
julia> A = rand(3,4,5); B = rand(5,6,7);
+ 15 21 33
See also tensor!(Y,A,B)
.
TensorCore.tensor!
— Functiontensor!(dest, A, B)
Similar to tensor(A, B)
(which can also be written A ⊗ B
), but stores its results in the pre-allocated array dest
.
TensorCore.boxdot
— Functionboxdot(A,B) = A ⊡ B # \boxdot
Generalised matrix multiplication: Contracts the last dimension of A
with the first dimension of B
, for any ndims(A)
& ndims(B)
. If both are vectors, then it returns a scalar == sum(A .* B)
.
Examples
julia> A = rand(3,4,5); B = rand(5,6,7);
julia> size(A ⊡ B)
(3, 4, 6, 7)
@@ -36,4 +36,4 @@
LinearAlgebra.Adjoint{Float64, Vector{Float64}}
julia> typeof(v' ⊡ v)
-Float64
See also boxdot!(Y,A,B)
, which is to ⊡
as mul!
is to *
.
TensorCore.boxdot!
— Functionboxdot!(Y, A, B, α=1, β=0)
In-place version of boxdot
, i.e. Y .= (A ⊡ B) .* β .+ Y .* α
. Like 5-argument mul!
, the use of α, β
here requires Julia 1.3 or later.
Settings
This document was generated with Documenter.jl on Tuesday 4 June 2024. Using Julia version 1.10.4.