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
@michel2323@frapac@sshin23
I discussed with Mike about symmetric scaling and I quickly implemented a Julia version of his MATLAB code:
functionscaleSID(A::SparseMatrixCSC, iprint::Bool=false)
n, m =size(A)
if iprint
println("\n scaleSID: Symmetric scaling of SID matrix. n = $n nnz = $(nnz(A))")
endif n != m
println("A must be square")
returnnothing, nothingend
scale =maximum(abs.(A), dims=1)[:]
Iz =findall(scale .==0)
lenz =length(Iz)
if lenz >0println("A contains $lenz empty columns")
scale[Iz] .=1end
d =diag(A) # dense column vector
scale .=1.0./ scale # dense column vector
d .= scale .* d # dense diagonal of DAD
scale .=sqrt.(scale) # dense elements of D
D =Diagonal(scale) # sparse diagonal D
AL =tril(A, -1)
AL2 =copy(AL)
mul!(AL2, AL, D)
mul!(AL, D, AL2)
DAD = AL + AL'+spdiagm(0=> d)
if iprint
jmin =argmin(scale)
jmax =argmax(scale)
smin = scale[jmin]
smax = scale[jmax]
println("\n\n Min scale Max scale")
println(" Col $jmin$smin Col $jmax$smax")
endreturn DAD, D
end
I tested with Krylov methods and it's quite efficient!
It should not be hard to do a GPU version and add it in MadNLP.jl.
No description provided.
The text was updated successfully, but these errors were encountered: