Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
lostella committed Aug 26, 2017
1 parent fb482d6 commit 8541bf3
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions src/functions/indAffineDirect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,6 @@ function prox!(y::V, f::IndAffineDirect{R, T, M, V, F}, x::V, gamma::R=one(R)) w
return zero(R)
end

# ### SPARSE CONCRETE TYPE
#
# struct IndAffineSparse{R <: Real, T <: RealOrComplex{R}, M <: AbstractSparseMatrix{T}, V <: AbstractVector{T}} <: IndAffine
# A::M
# b::V
# F_Ac::SparseArrays.SPQR.Factorization{T}
# res::V
# function IndAffineSparse{R, T, M, V}(A::M, b::V) where {R <: Real, T <: RealOrComplex{R}, M <: AbstractSparseMatrix{T}, V <: AbstractVector{T}}
# if size(A,1) > size(A,2)
# error("A must be full row rank")
# end
# normrowsinv = 1./vec(sqrt.(sum(abs2.(A), 2)))
# A = normrowsinv.*A # normalize rows of A
# b = normrowsinv.*b # and b accordingly
# F_Ac = qrfact(A') # factor AE = QR
# new(A, b, F_Ac, similar(b))
# end
# end
#
# is_cone(f::IndAffineSparse) = norm(f.b) == 0.0
#
# function (f::IndAffineSparse{R, T, M, V})(x::V) where {R, T, M, V}
# A_mul_B!(f.res, f.A, x)
# f.res .= f.b .- f.res
# # the tolerance in the following line should be customizable
# if norm(f.res, Inf) <= 1e-14
# return zero(R)
# end
# return typemax(R)
# end

function prox!(y::V, f::IndAffineDirect{R, T, M, V, F}, x::V, gamma::R=one(R)) where {R, T, M, V, F <: SparseArrays.SPQR.Factorization}
RTX_EQUALS_ETB = Int32(3)
RETX_EQUALS_B = Int32(1)
Expand All @@ -92,13 +61,6 @@ function prox!(y::V, f::IndAffineDirect{R, T, M, V, F}, x::V, gamma::R=one(R)) w
return zero(R)
end

# # Not really naive, comparison is done to non-sparse in tests
# function prox_naive(f::IndAffineDirect{R, T, M, V, F}, x::V, gamma::R=one(R)) where {R, T, M, V, F <: SparseArrays.SPQR.Factorization{T}}
# res = SparseArrays.CHOLMOD.Dense(f.A*x - f.b)
# y = x - f.A'*convert(typeof(x), SparseArrays.SPQR.solve(Int32(1), f.F_Ac, SparseArrays.SPQR.solve(Int32(3), f.F_Ac, res)))
# return y, zero(R)
# end

function prox_naive{R <: Real, T <: RealOrComplex{R}}(f::IndAffineDirect, x::AbstractArray{T,1}, gamma::R=one(R))
y = x + f.A'*((f.A*f.A')\(f.b - f.A*x))
return y, zero(R)
Expand Down

0 comments on commit 8541bf3

Please sign in to comment.