expand_entries()#
- static CubicOperator.expand_entries(Gc)[source]#
Given \(\tilde{\G}\in\RR^{a \times r(r+1)(r+2)/6}\), construct the matrix \(\Ghat\in\RR^{a\times r^3}\) such that \(\Ghat[\qhat\otimes\qhat\otimes\qhat] = \tilde{\G}[\qhat\,\hat{\otimes}\,\qhat\,\hat{\otimes}\,\qhat]\) for all \(\qhat\in\RR^{r}\) where \(\cdot\hat{\otimes}\cdot\hat{\otimes}\cdot\) is the compressed cubic Kronecker product (see
ckron()
).- Parameters:
- Gc(a, r(r+1)(r+2)/2) ndarray
Matrix that acts on the compressed cubic Kronecker product.
- Returns:
- G(a, r^3) ndarray
Matrix that acts on the full cubic Kronecker product.
Examples
>>> from opinf.operators import CubicOperator >>> r = 20 >>> Gtilde = np.random.random((r, r * (r + 1) * (r + 2)/ 6)) >>> Gtilde.shape (20, 1540) >>> G = CubicOperator.expand_entries(Gtilde) >>> G.shape (20, 8000) >>> q = np.random.random(r) >>> Gq3 = G @ np.kron(q, np.kron(q, q)) >>> np.allclose(Gq2, Gtilde @ CubicOperator.ckron(q)) True >>> np.all(CubicOperator.compress_entries(G) == Gtilde) True