<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Kronecker/Tensor Products</title>
    <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 21:33:37 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 21:33:37 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Kronecker/Tensor Products</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Kronecker/Tensor Products</title>
      <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products</link>
    </image>
    <item>
      <title>Kronecker / tensor products</title>
      <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products?ref=Feed:MaplePrimes:Kronecker/Tensor Products:Comments#answer78998</link>
      <itunes:summary>Hi,

what kind of objects do you like to tensor? A rather general way to produce variouse tensor products (though only tested in a particular realm) come with the Clifford/Bigebra packages, see http://www.math.tntech.edu/rafal/

If you just need a tensor product for matrices, that ships with maple, see the linalg (or newer Matrix) packages.

In principle maple should provide via the 'define' mechanism a way to produce a multilinear operator (aka tensor product) However, till now maples ability in this direction is very limited, since you canne e.g. specify over which domain (base field) your tensor product is linear.
Using the define which ships with Clifford/Bigebra you can e.g. define a tenor product linear over polynomails in x with integer coefficients etc.

If you are interested in characters of the general linear groups (Schur functions) I can mail you a package which does that (see the old version at http://clifford.physik.uni-konstanz.de/~fauser/) I hope to finish the new version (over 50 procedures) by end of teh jear and post it on the web page of Rafal Ablamowicz (see link above)

ciao
BF.
</itunes:summary>
      <description>Hi,

what kind of objects do you like to tensor? A rather general way to produce variouse tensor products (though only tested in a particular realm) come with the Clifford/Bigebra packages, see http://www.math.tntech.edu/rafal/

If you just need a tensor product for matrices, that ships with maple, see the linalg (or newer Matrix) packages.

In principle maple should provide via the 'define' mechanism a way to produce a multilinear operator (aka tensor product) However, till now maples ability in this direction is very limited, since you canne e.g. specify over which domain (base field) your tensor product is linear.
Using the define which ships with Clifford/Bigebra you can e.g. define a tenor product linear over polynomails in x with integer coefficients etc.

If you are interested in characters of the general linear groups (Schur functions) I can mail you a package which does that (see the old version at http://clifford.physik.uni-konstanz.de/~fauser/) I hope to finish the new version (over 50 procedures) by end of teh jear and post it on the web page of Rafal Ablamowicz (see link above)

ciao
BF.
</description>
      <guid>78998</guid>
      <pubDate>Tue, 21 Nov 2006 07:52:03 Z</pubDate>
      <itunes:author>bfauser</itunes:author>
      <author>bfauser</author>
    </item>
    <item>
      <title>simple matrix tensor product with linalg in maple 9?</title>
      <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products?ref=Feed:MaplePrimes:Kronecker/Tensor Products:Comments#answer78848</link>
      <itunes:summary>uh, you didn't really answer the question.

using linalg, define two matrices using "matrix".  How do you take the tensor product of these in maple 9?  

I've looked online and through help but am not finding it as quick as I should be as usual. 

Maybe Maple 10 is better.

</itunes:summary>
      <description>uh, you didn't really answer the question.

using linalg, define two matrices using "matrix".  How do you take the tensor product of these in maple 9?  

I've looked online and through help but am not finding it as quick as I should be as usual. 

Maybe Maple 10 is better.

</description>
      <guid>78848</guid>
      <pubDate>Sun, 03 Dec 2006 22:41:35 Z</pubDate>
      <itunes:author>cottrell</itunes:author>
      <author>cottrell</author>
    </item>
    <item>
      <title>Matrix tensor product</title>
      <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products?ref=Feed:MaplePrimes:Kronecker/Tensor Products:Comments#answer78843</link>
      <itunes:summary>For Vectors and Matrices (but not for Arrays), the tensor product can be defined as &lt;pre&gt;&lt;strong&gt;TensorProduct:=module()
export `*`;
option package;
`*`:=overload([proc(A::rtable,B::rtable) option overload; 
rtable(&amp;lt;seq(seq(`*`(A[i,[rtable_dims(A)][2..-1][]],
B[j,[rtable_dims(B)][2..-1][]]),
j=[rtable_dims(B)][1]),i=[rtable_dims(A)][1])&amp;gt;, 
select(has,{rtable_options(A)} intersect {rtable_options(B)},
{datatype,subtype,order,rectangular,sparse})[]) end,
:-`*`]) end:

with(TensorProduct):&lt;/strong&gt;&lt;/pre&gt;For example, &lt;pre&gt;&lt;strong&gt;A:=&amp;lt;&amp;lt;1 | 2&amp;gt; , &amp;lt;3 | 4&amp;gt;&amp;gt;;
                            &lt;maple&gt;Matrix([[1,2],[3,4]])&lt;/maple&gt;
     
B:=&amp;lt;&amp;lt;1 | 2 | 3&amp;gt; , &amp;lt;4 | 5 | 6&amp;gt; , &amp;lt;7 | 8 | 9&amp;gt;&amp;gt;;

                         &lt;maple&gt;Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])&lt;/maple&gt;

A*B;

                 &lt;maple&gt;Matrix([[1, 2, 3, 2, 4, 6], [4, 5, 6, 8, 10, 12], [7, 8, 9, 14, 16, 18], [3, 6, 9, 4, 8, 12], [12, 15, 18, 16, 20, 24], [21, 24, 27, 28, 32, 36]])&lt;/maple&gt;&lt;/strong&gt;&lt;/pre&gt;

I didn't test it with all possible options, and it might give wrong results for some of them, but it seems to work OK with dense matrices with rectangular storage. If there is a need of using other options, the procedure should be correspondingly adjusted. In particular, it is not optimized for sparse matrices (but neither do many other procedures in LinearAlgebra package).  

__________
Alec Mihailovs 
&lt;a href="http://mihailovs.com/Alec/"&gt;http://mihailovs.com/Alec/&lt;/a&gt;</itunes:summary>
      <description>For Vectors and Matrices (but not for Arrays), the tensor product can be defined as &lt;pre&gt;&lt;strong&gt;TensorProduct:=module()
export `*`;
option package;
`*`:=overload([proc(A::rtable,B::rtable) option overload; 
rtable(&amp;lt;seq(seq(`*`(A[i,[rtable_dims(A)][2..-1][]],
B[j,[rtable_dims(B)][2..-1][]]),
j=[rtable_dims(B)][1]),i=[rtable_dims(A)][1])&amp;gt;, 
select(has,{rtable_options(A)} intersect {rtable_options(B)},
{datatype,subtype,order,rectangular,sparse})[]) end,
:-`*`]) end:

with(TensorProduct):&lt;/strong&gt;&lt;/pre&gt;For example, &lt;pre&gt;&lt;strong&gt;A:=&amp;lt;&amp;lt;1 | 2&amp;gt; , &amp;lt;3 | 4&amp;gt;&amp;gt;;
                            &lt;maple&gt;Matrix([[1,2],[3,4]])&lt;/maple&gt;
     
B:=&amp;lt;&amp;lt;1 | 2 | 3&amp;gt; , &amp;lt;4 | 5 | 6&amp;gt; , &amp;lt;7 | 8 | 9&amp;gt;&amp;gt;;

                         &lt;maple&gt;Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])&lt;/maple&gt;

A*B;

                 &lt;maple&gt;Matrix([[1, 2, 3, 2, 4, 6], [4, 5, 6, 8, 10, 12], [7, 8, 9, 14, 16, 18], [3, 6, 9, 4, 8, 12], [12, 15, 18, 16, 20, 24], [21, 24, 27, 28, 32, 36]])&lt;/maple&gt;&lt;/strong&gt;&lt;/pre&gt;

I didn't test it with all possible options, and it might give wrong results for some of them, but it seems to work OK with dense matrices with rectangular storage. If there is a need of using other options, the procedure should be correspondingly adjusted. In particular, it is not optimized for sparse matrices (but neither do many other procedures in LinearAlgebra package).  

__________
Alec Mihailovs 
&lt;a href="http://mihailovs.com/Alec/"&gt;http://mihailovs.com/Alec/&lt;/a&gt;</description>
      <guid>78843</guid>
      <pubDate>Mon, 04 Dec 2006 11:10:26 Z</pubDate>
      <itunes:author>alec</itunes:author>
      <author>alec</author>
    </item>
    <item>
      <title>Kronecker Product</title>
      <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products?ref=Feed:MaplePrimes:Kronecker/Tensor Products:Comments#answer78711</link>
      <itunes:summary>Inspired on one Alain Le Stang wrote, I wrote a little procedure that makes the Kronecker/Direct/Tensor product between any two matrices. As long as it is declared as a Matrix, it can also make the Kronecker product between Vectors and Matrices. The vector, however would have to be declared for example as V := Matrix([[1],[2], [0], [a]]); 

it uses the package LinearAlgebra,
&lt;code&gt;
Kron:=proc(A::Matrix,B::Matrix)
local M,P,i,j;
M:=Matrix(RowDimension(A)*RowDimension(B),ColumnDimension(A)*ColumnDimension(B)):
P:=Matrix(RowDimension(B),ColumnDimension(B)):
for i to RowDimension(A) do
for j to ColumnDimension(A) do
P:=ScalarMultiply(B,A[i,j]):
M[1+(i-1)*RowDimension(B)..(i-1)*RowDimension(B)+RowDimension(B),1+(j-1)*ColumnDimension(B)..(j-1)*ColumnDimension(B)+ColumnDimension(B)]:=P:
od
od:
M;
end proc:
&lt;code&gt;

for example
&lt;maple&gt;
A := Matrix([[1, 0], [2, 1]]);
&lt;/maple&gt;
and
&lt;maple&gt;
B := Matrix([[a, b], [c, d]]);
&lt;/maple&gt;
returns for 
&lt;code&gt;
Kron(A, B);
&lt;/code&gt;
&lt;maple&gt;
 Matrix(4, 4, {(1, 1) = a, (1, 2) = b, (1, 3) = 0, (1, 4) = 0, (2, 1) = c, (2, 2) = d, (2, 3) = 0, (2, 4) = 0, (3, 1) = 2*a, (3, 2) = 2*b, (3, 3) = a, (3, 4) = b, (4, 1) = 2*c, (4, 2) = 2*d, (4, 3) = c, (4, 4) = d});
&lt;/maple&gt;</itunes:summary>
      <description>Inspired on one Alain Le Stang wrote, I wrote a little procedure that makes the Kronecker/Direct/Tensor product between any two matrices. As long as it is declared as a Matrix, it can also make the Kronecker product between Vectors and Matrices. The vector, however would have to be declared for example as V := Matrix([[1],[2], [0], [a]]); 

it uses the package LinearAlgebra,
&lt;code&gt;
Kron:=proc(A::Matrix,B::Matrix)
local M,P,i,j;
M:=Matrix(RowDimension(A)*RowDimension(B),ColumnDimension(A)*ColumnDimension(B)):
P:=Matrix(RowDimension(B),ColumnDimension(B)):
for i to RowDimension(A) do
for j to ColumnDimension(A) do
P:=ScalarMultiply(B,A[i,j]):
M[1+(i-1)*RowDimension(B)..(i-1)*RowDimension(B)+RowDimension(B),1+(j-1)*ColumnDimension(B)..(j-1)*ColumnDimension(B)+ColumnDimension(B)]:=P:
od
od:
M;
end proc:
&lt;code&gt;

for example
&lt;maple&gt;
A := Matrix([[1, 0], [2, 1]]);
&lt;/maple&gt;
and
&lt;maple&gt;
B := Matrix([[a, b], [c, d]]);
&lt;/maple&gt;
returns for 
&lt;code&gt;
Kron(A, B);
&lt;/code&gt;
&lt;maple&gt;
 Matrix(4, 4, {(1, 1) = a, (1, 2) = b, (1, 3) = 0, (1, 4) = 0, (2, 1) = c, (2, 2) = d, (2, 3) = 0, (2, 4) = 0, (3, 1) = 2*a, (3, 2) = 2*b, (3, 3) = a, (3, 4) = b, (4, 1) = 2*c, (4, 2) = 2*d, (4, 3) = c, (4, 4) = d});
&lt;/maple&gt;</description>
      <guid>78711</guid>
      <pubDate>Wed, 20 Dec 2006 21:57:57 Z</pubDate>
      <itunes:author>boirac</itunes:author>
      <author>boirac</author>
    </item>
    <item>
      <title>Faster version of Kronecker product</title>
      <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products?ref=Feed:MaplePrimes:Kronecker/Tensor Products:Comments#comment86071</link>
      <itunes:summary>This code which I believe is more idiomatic is asymptotically faster:
&lt;code&gt;
Kron := proc(A::Matrix, B::Matrix)
    local rA, cA, rB, cB;
    (rA, cA) := LinearAlgebra:-Dimensions(A);
    (rB, cB) := LinearAlgebra:-Dimensions(B);
    Matrix(rA*rB, cA*cB, proc(i,j) local iA,jA,iB,jB;
        iB := irem(i-1,rA,'iA');
        jB := irem(j-1,cA,'jA');
        A[iA+1,jA+1]*B[iB+1,jB+1] end);
end;
&lt;/code&gt;

It is too bad that one has to play indexing games (irem is 0-based, Matrix is 1-based) as it obscures the result.  Also I &lt;strong&gt;really&lt;/strong&gt; wish there was a side-effect free version of commands like irem!  </itunes:summary>
      <description>This code which I believe is more idiomatic is asymptotically faster:
&lt;code&gt;
Kron := proc(A::Matrix, B::Matrix)
    local rA, cA, rB, cB;
    (rA, cA) := LinearAlgebra:-Dimensions(A);
    (rB, cB) := LinearAlgebra:-Dimensions(B);
    Matrix(rA*rB, cA*cB, proc(i,j) local iA,jA,iB,jB;
        iB := irem(i-1,rA,'iA');
        jB := irem(j-1,cA,'jA');
        A[iA+1,jA+1]*B[iB+1,jB+1] end);
end;
&lt;/code&gt;

It is too bad that one has to play indexing games (irem is 0-based, Matrix is 1-based) as it obscures the result.  Also I &lt;strong&gt;really&lt;/strong&gt; wish there was a side-effect free version of commands like irem!  </description>
      <guid>86071</guid>
      <pubDate>Wed, 20 Dec 2006 23:27:47 Z</pubDate>
      <itunes:author>JacquesC</itunes:author>
      <author>JacquesC</author>
    </item>
    <item>
      <title>More versatile</title>
      <link>http://www.mapleprimes.com/questions/42797-KroneckerTensor-Products?ref=Feed:MaplePrimes:Kronecker/Tensor Products:Comments#comment91072</link>
      <itunes:summary>Jacques,

May I suggest that kronprod in Robert Israel's Maple &lt;a href="http://www.math.ubc.ca/~israel/advisor/"&gt;Advisor&lt;/a&gt; Database is more versatile - it handles matrices, Matrices, vectors and Vectors. Moreover matrices need not be square and it seems to be very nearly as fast as your code.

J. Tarr</itunes:summary>
      <description>Jacques,

May I suggest that kronprod in Robert Israel's Maple &lt;a href="http://www.math.ubc.ca/~israel/advisor/"&gt;Advisor&lt;/a&gt; Database is more versatile - it handles matrices, Matrices, vectors and Vectors. Moreover matrices need not be square and it seems to be very nearly as fast as your code.

J. Tarr</description>
      <guid>91072</guid>
      <pubDate>Thu, 21 Dec 2006 00:38:07 Z</pubDate>
      <itunes:author>Mariner</itunes:author>
      <author>Mariner</author>
    </item>
  </channel>
</rss>