You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result of solve(A, b) is the solution x to the linear equation Ax = b. If b is an identity matrix (Eye), x is simply inv(A).
548
+
Here, we are just recognising whether the solve operation returns an inverse or not; not replacing it because solve is mathematically more stable than inv.
549
+
"""
546
550
valid_solves= (Solve, SolveTriangular)
547
-
# First, we look for the solve op
551
+
# First, we verify whether we have a valid solve op
This rewrite takes advantage of the fact that if there are two consecutive inverse operations (inv(inv(input))), we get back our original input without having to compute inverse once.
575
+
576
+
Here, we check for direct inverse operations (inv/pinv) and also solve operations (solve/solve_triangular) in the case when b = Eye. This allows any combination of these "inverse" nodes to be simply rewritten.
577
+
578
+
Parameters
579
+
----------
580
+
fgraph: FunctionGraph
581
+
Function graph being optimized
582
+
node: Apply
583
+
Node of the function graph to be optimized
584
+
585
+
Returns
586
+
-------
587
+
list of Variable, optional
588
+
List of optimized variables, or None if no optimization was performed
0 commit comments