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

Function _matrix_exp_pade7

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

7th-order Pade approximant for matrix exponential.

(matrix)

Source from the content-addressed store, hash-verified

161
162
163def _matrix_exp_pade7(matrix):
164 """7th-order Pade approximant for matrix exponential."""
165 b = [17297280.0, 8648640.0, 1995840.0, 277200.0, 25200.0, 1512.0, 56.0]
166 b = [constant_op.constant(x, matrix.dtype) for x in b]
167 ident = linalg_ops.eye(
168 array_ops.shape(matrix)[-2],
169 batch_shape=array_ops.shape(matrix)[:-2],
170 dtype=matrix.dtype)
171 matrix_2 = math_ops.matmul(matrix, matrix)
172 matrix_4 = math_ops.matmul(matrix_2, matrix_2)
173 matrix_6 = math_ops.matmul(matrix_4, matrix_2)
174 tmp = matrix_6 + b[5] * matrix_4 + b[3] * matrix_2 + b[1] * ident
175 matrix_u = math_ops.matmul(matrix, tmp)
176 matrix_v = b[6] * matrix_6 + b[4] * matrix_4 + b[2] * matrix_2 + b[0] * ident
177 return matrix_u, matrix_v
178
179
180def _matrix_exp_pade9(matrix):

Callers 1

matrix_exponentialFunction · 0.85

Calls 3

constantMethod · 0.45
shapeMethod · 0.45
matmulMethod · 0.45

Tested by

no test coverage detected