11 template <
class scalartype,
int n1,
int n2,
int n3,
int n4>
12 Matrix<scalartype,n1*n3,n2*n4>
kronecker(Matrix<scalartype,n1,n2> x, Matrix<scalartype,n3,n4> y){
13 Matrix<scalartype,n1*n3,n2*n4> ans;
18 ans(i*n3+k,j*n4+l)=x(i,j)*y(k,l);
23 template <
class scalartype>
25 int n1 = x.rows(), n2 = x.cols(), n3 = y.rows(), n4 = y.cols();
31 ans(i*n3+k,j*n4+l)=x(i,j)*y(k,l);
Matrix class used by TMB.
Matrix< scalartype, n1 *n3, n2 *n4 > kronecker(Matrix< scalartype, n1, n2 > x, Matrix< scalartype, n3, n4 > y)
Kronecker product of two matrices.
Utility functions for TMB (automatically included)