ckron_indices()#
- static CubicOperator.ckron_indices(r)[source]#
Construct a mask for efficiently computing the compressed Kronecker triple product.
This method provides a faster way to evaluate
ckron()
when the state dimensionr
is known a priori.- Parameters:
- rint
State dimension.
- Returns:
- maskndarray
Compressed Kronecker product mask.
Examples
>>> from opinf.operators import CubicOperator >>> r = 20 >>> mask = CubicOperator.kron_indices(r) >>> q = np.random.random(r) >>> np.allclose(CubicOperator.ckron(q), np.prod(q[mask], axis=1)) True