MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _matrix_exp_pade3

Function _matrix_exp_pade3

tensorflow/python/ops/linalg/linalg_impl.py:132–144  ·  view source on GitHub ↗

3rd-order Pade approximant for matrix exponential.

(matrix)

Source from the content-addressed store, hash-verified

130# This section is ported nearly verbatim from Eigen's implementation:
131# https://eigen.tuxfamily.org/dox/unsupported/MatrixExponential_8h_source.html
132def _matrix_exp_pade3(matrix):
133 """3rd-order Pade approximant for matrix exponential."""
134 b = [120.0, 60.0, 12.0]
135 b = [constant_op.constant(x, matrix.dtype) for x in b]
136 ident = linalg_ops.eye(
137 array_ops.shape(matrix)[-2],
138 batch_shape=array_ops.shape(matrix)[:-2],
139 dtype=matrix.dtype)
140 matrix_2 = math_ops.matmul(matrix, matrix)
141 tmp = matrix_2 + b[1] * ident
142 matrix_u = math_ops.matmul(matrix, tmp)
143 matrix_v = b[2] * matrix_2 + b[0] * ident
144 return matrix_u, matrix_v
145
146
147def _matrix_exp_pade5(matrix):

Callers 1

matrix_exponentialFunction · 0.85

Calls 3

constantMethod · 0.45
shapeMethod · 0.45
matmulMethod · 0.45

Tested by

no test coverage detected