int m = rows(A);
int p = rows(B);
int N = m * p;
matrix[N, N] C = rep_matrix(0., N, N);
for (i in 1 : m) {
for (j in 1 : i) {
if (fabs(A[i, j]) > 1e-12) {
int row_start = (i - 1) * p + 1;
int row_end = (i - 1) * p + p;
int col_start = (j - 1) * p + 1;
int col_end = (j - 1) * p + p;
C[row_start : row_end, col_start : col_end] = A[i, j] * B;
}
}
}
return C;
}
matrix chol_kronecker_prod(matrix A, matrix B)
Definition: chol_kronecker_prod.stanfunctions:16
◆ chol_kronecker_prod()
matrix chol_kronecker_prod |
( |
matrix |
A, |
|
|
matrix |
B |
|
) |
| |
Kronecker product of two Cholesky factors
Copyright 2022, Sean Pinkney
- Parameters
-
- Returns
- Kronecker product matrix of Cholesky factors A and B