11#
2- """
3- $SIGNATURES
4-
2+ TENSOR_PROD_DOC = """
53Computes the lazy pairwise Kronecker product, or tensor product,
64operator of `AbstractMatrix`, and `AbstractSciMLOperator` subtypes.
75Calling `⊗(ops...)` is equivalent to `Base.kron(ops...)`. Fast
@@ -10,11 +8,18 @@ product operator.
108
119```
1210TensorProductOperator(A, B) = A ⊗ B
11+ TensorProductOperator(A, B, C) = A ⊗ B ⊗ C
1312
1413(A ⊗ B)(u) = vec(B * reshape(u, M, N) * transpose(A))
1514```
1615where `M = size(B, 2)`, and `N = size(A, 2)`
1716"""
17+
18+ """
19+ $SIGNATURES
20+
21+ $TENSOR_PROD_DOC
22+ """
1823struct TensorProductOperator{T,O,C} <: AbstractSciMLOperator{T}
1924 ops:: O
2025 cache:: C
@@ -54,18 +59,7 @@ TensorProductOperator(ii1::IdentityOperator, ii2::IdentityOperator) = IdentityOp
5459"""
5560$SIGNATURES
5661
57- Computes the lazy pairwise Kronecker product, or tensor product,
58- operator of `AbstractMatrix`, and `AbstractSciMLOperator` subtypes.
59- Calling `⊗(ops...)` is equivalent to `Base.kron(ops...)`. Fast
60- operator evaluation is performed without forming the full tensor
61- product operator.
62-
63- ```
64- TensorProductOperator(A, B) = A ⊗ B
65-
66- (A ⊗ B)(u) = vec(B * reshape(u, M, N) * transpose(A))
67- ```
68- where `M = size(B, 2)`, and `N = size(A, 2)`
62+ $TENSOR_PROD_DOC
6963"""
7064⊗ (ops:: Union{AbstractMatrix,AbstractSciMLOperator} ...) = TensorProductOperator (ops... )
7165
@@ -82,8 +76,7 @@ Base.kron(A::AbstractSciMLOperator, B::AbstractSciMLOperator) = TensorProductOpe
8276Base. kron (A:: AbstractMatrix , B:: AbstractSciMLOperator ) = TensorProductOperator (A, B)
8377Base. kron (A:: AbstractSciMLOperator , B:: AbstractMatrix ) = TensorProductOperator (A, B)
8478
85- # convert to matrix
86- Base. kron (ops:: AbstractSciMLOperator... ) = kron (convert .(AbstractMatrix, ops)... )
79+ Base. kron (ops:: AbstractSciMLOperator... ) = TensorProductOperator (ops... )
8780
8881function Base. convert (:: Type{AbstractMatrix} , L:: TensorProductOperator )
8982 kron (convert .(AbstractMatrix, L. ops)... )
0 commit comments