0
$\begingroup$

Given two matrices, $A$ ($m$ rows and $n$ columns) and $B$ ($n$ rows and $k$ columns), we want to compute matrix $A$ acting on each row of matrix $B$, and expect $mk$-dimensional matrix $C$, namely

$C = \begin{bmatrix} A B_{0} & A B_{1} & A B_{2} & \cdots & A B_{k}\end{bmatrix}$

For example, let

 A=matrix{{a_00, a_01, a_02},            {a_10, a_11, a_12}},  B=matrix{{b_00, b_01, b_02, b_03},            {b_10, b_11, b_12, b_13},            {b_20, b_21, b_22, b_23}} 

namely, $m=2, n=3, k=4$

 C=matrix{{a_00*b_00+a_01*b_10+a_02*b_20,  a_00*b_01+a_01*b_11+a_02*b_21,  a_00*b_02+a_01*b_12+a_02*b_22,  a_00*b_03+a_01*b_13+a_02*b_23},           {a_10*b_00+a_11*b_10+a_12*b_20,  a_10*b_01+a_11*b_11+a_12*b_21,  a_10*b_02+a_11*b_12+a_12*b_22,  a_10*b_03+a_11*b_13+a_12*b_23} } 

I could do a loop over $k$, and then concatenate column by column. But this is not efficient enough, when $k$ is very large, say $10,000$.

Any tips?

  • 0
    Well, this computation is just a subroutine. I need other functions of Macaulay2.2012-10-28

0 Answers 0