-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core code independent of linear algebra implementation (#4)
* Initial work on abstract interface * working code * Move model definition to own file, make compute_stepsize more efficient * Add tests * Remove unused code
- Loading branch information
Showing
7 changed files
with
487 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Cholesky | ||
|
||
# export AbstractCholeskyFactor, SimpleDenseCholeskyFactor, SimpleSparseCholeskyFactor | ||
|
||
""" | ||
cholesky!(A, d, M) | ||
Form the matrix S = A*Diag(d)*A' and computes its Cholesky factorization. | ||
The factorization overwrites F. | ||
""" | ||
function cholesky!(A::AbstractMatrix{Ta}, d::AbstractVector{Td}, F::Factorization{Ta}) where{Ta<:Real, Td<:Real} | ||
warn("cholesky! must be implemented for $(typeof(A))") | ||
return F | ||
end | ||
|
||
function cholesky!(A::Matrix{Ta}, d::AbstractVector{Td}, F::Base.LinAlg.Cholesky{Ta,Matrix{Ta}}) where{Ta<:Real, Td<:Real} | ||
F = cholfact!(F, A*Diagonal(d)*A') | ||
return F | ||
end | ||
|
||
function cholesky!(A::SparseMatrixCSC{Ta, Int64}, d::AbstractVector{Td}, F::Base.SparseArrays.CHOLMOD.Factor{Ta}) where{Ta<:Real, Td<:Real} | ||
# update CHolesky factor | ||
F = cholfact!(F, Symmetric(A*spdiagm(d)*A')) | ||
return F | ||
end | ||
|
||
""" | ||
solve!(y, F, b) | ||
Solves the system F*y = b and overwrites y. | ||
""" | ||
function solve!(y::AbstractVector{T1}, F::Factorization{T2}, b::AbstractVector{T3}) where {T1<:Real, T2<:Real, T3<:Real} | ||
warn("Implement solve! for concrete type implementations!") | ||
return y | ||
end | ||
|
||
# include("denseCholesky.jl") | ||
# include("sparseCholesky.jl") | ||
|
||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
module Tulip | ||
|
||
export Model, PrimalDualPoint, readmps | ||
|
||
# Cholesky module | ||
include("Cholesky/Cholesky.jl") | ||
|
||
# package code goes here | ||
include("./ipm.jl") | ||
include("./readmps.jl") | ||
include("model.jl") | ||
include("ipm.jl") | ||
include("readmps.jl") | ||
|
||
end # module |
Oops, something went wrong.