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).
578
+
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.
579
+
"""
576
580
valid_solves= (Solve, SolveTriangular)
577
-
# First, we look for the solve op
581
+
# 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.
605
+
606
+
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.
607
+
608
+
Parameters
609
+
----------
610
+
fgraph: FunctionGraph
611
+
Function graph being optimized
612
+
node: Apply
613
+
Node of the function graph to be optimized
614
+
615
+
Returns
616
+
-------
617
+
list of Variable, optional
618
+
List of optimized variables, or None if no optimization was performed
0 commit comments