msmbuilder.msm._ratematrix.dK_dtheta_A

msmbuilder.msm._ratematrix.dK_dtheta_A(theta, n, u, A, out=None)

Compute the sum of the Hadamard (element-wise) product of the derivative of (the rate matrix, K, with respect to the free parameters,`theta`, dK_ij / dtheta_u) and another matrix, A.

Since dK/dtheta_u is a sparse matrix with a known sparsity structure, it’s more efficient to just do sum as we construct it, and never save the matrix elements directly.

Parameters:

theta : array

The free parameters, theta. These values are the linearized elements of the upper triangular portion of the symmetric rate matrix, S, followed by the log equilibrium weights.

n : int

Dimension of the rate matrix, K, (number of states)

u : int

The index, 0 <= u < len(theta) of the element in theta to construct the derivative of the rate matrix, K with respect to.

A : array of shape=(n, n), optional

If not None, an arbitrary (n, n) matrix to be multiplied element-wise with the derivative of the rate matrix, dKu.

out : [output], optional array of shape=(n, n)

If not None, out will contain the matrix dKu on exit.

Returns:

s : double

The sum of the element-wise product of dK/du and A, if A is not None.

Versions