Skip to content

Commit

Permalink
if schur works we take it as true
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Oct 20, 2024
1 parent 22e3709 commit c84671a
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/algorithms/quadratic_matrix_equation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,16 @@ function solve_quadratic_matrix_equation(A::AbstractMatrix{R},

if verbose println("Quadratic matrix equation solver: $quadratic_matrix_equation_solver - converged: $solved in $iterations iterations to tolerance: $reached_tol") end

if !solved # try schur if previous one didn't solve it
if quadratic_matrix_equation_solver == :schur
initial_guess = reached_tol < sqrt(tol) ? sol : zeros(0,0)

other_algo = :doubling
else
other_algo = :schur
end

if !solved && quadratic_matrix_equation_solver :schur # try schur if previous one didn't solve it
sol, solved, iterations, reached_tol = solve_quadratic_matrix_equation(A, B, C,
Val(other_algo),
Val(:schur),
T;
initial_guess = initial_guess,
tol = tol,
timer = timer,
verbose = verbose)

if verbose println("Quadratic matrix equation solver: $other_algo - converged: $solved in $iterations iterations to tolerance: $reached_tol") end
if verbose println("Quadratic matrix equation solver: schur - converged: $solved in $iterations iterations to tolerance: $reached_tol") end
end

return sol, solved
Expand Down Expand Up @@ -189,9 +181,7 @@ function solve_quadratic_matrix_equation(A::AbstractMatrix{R},

reached_tol =.norm(AXX) / AXXnorm

converged = reached_tol < tol

return X, converged, iter, reached_tol
return X, true, iter, reached_tol # schur is always successful
end


Expand Down

0 comments on commit c84671a

Please sign in to comment.