51 template <
class R,
class T>
55 assert (a.
ndims () == 2);
56 assert (b.
ndims () == 2);
76 template <
class R,
class T>
80 assert (b.
ndims () == 2);
115 const T v = A.
data (Ai);
119 C.data (idx) = v * B.
data (Bi);
120 C.ridx (idx++) = Ci + B.
ridx (Bi);
123 C.cidx (Aj * B.
columns () + Bj + 1) = idx;
142 pc[pa[i]*nb+pb[j]] = i*nb+j;
148 pc[pa[i]*nb+j] = i*nb+pb[j];
154 pc[i*nb+pb[j]] = pa[i]*nb+j;
160 pc[i*nb+j] = pa[i]*nb+pb[j];
166 template <
class MTA,
class MTB>
170 MTA am = octave_value_extract<MTA> (a);
171 MTB bm = octave_value_extract<MTB> (b);
180 retval = do_kron<PermMatrix, PermMatrix> (a, b);
184 retval = do_kron<SparseComplexMatrix, SparseComplexMatrix> (a, b);
186 retval = do_kron<SparseMatrix, SparseMatrix> (a, b);
204 retval = tmp.
diag ();
209 retval = do_kron<FloatComplexDiagMatrix, FloatComplexMatrix> (a, b);
211 retval = do_kron<FloatDiagMatrix, FloatComplexMatrix> (a, b);
213 retval = do_kron<FloatDiagMatrix, FloatMatrix> (a, b);
218 retval = do_kron<ComplexDiagMatrix, ComplexMatrix> (a, b);
220 retval = do_kron<DiagMatrix, ComplexMatrix> (a, b);
222 retval = do_kron<DiagMatrix, Matrix> (a, b);
228 retval = do_kron<FloatComplexMatrix, FloatComplexMatrix> (a, b);
230 retval = do_kron<FloatMatrix, FloatComplexMatrix> (a, b);
232 retval = do_kron<FloatMatrix, FloatMatrix> (a, b);
237 retval = do_kron<ComplexMatrix, ComplexMatrix> (a, b);
239 retval = do_kron<Matrix, ComplexMatrix> (a, b);
241 retval = do_kron<Matrix, Matrix> (a, b);
248 @deftypefn {Built-in Function} {} kron (@var{A}, @var{B})\n\
249 @deftypefnx {Built-in Function} {} kron (@var{A1}, @var{A2}, @dots{})\n\
250 Form the Kronecker product of two or more matrices, defined block by \n\
261 kron (1:4, ones (3, 1))\n\
268 If there are more than two input arguments @var{A1}, @var{A2}, @dots{}, \n\
269 @var{An} the Kronecker product is computed as\n\
272 kron (kron (@var{A1}, @var{A2}), @dots{}, @var{An})\n\
276 Since the Kronecker product is associative, this is well-defined.\n\
281 int nargin = args.
length ();