Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sumabs2j #67

Merged
merged 2 commits into from Sep 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion REQUIRE
Expand Up @@ -3,4 +3,4 @@ Optim
Calculus
Distances
ForwardDiff 0.2.0
Compat 0.8.0
Compat 0.8.4
2 changes: 1 addition & 1 deletion src/NLsolve.jl
Expand Up @@ -6,7 +6,7 @@ using Distances
using Optim
using ForwardDiff
using Compat

import Compat.view
import Compat.String

import Base.show,
Expand Down
4 changes: 2 additions & 2 deletions src/trust_region.jl
Expand Up @@ -102,7 +102,7 @@ function trust_region_{T}(df::AbstractDifferentiableMultivariateFunction,

if autoscale
for j = 1:nn
d2[j] = sumabs2j(J, j)
d2[j] = sumabs2(view(J, :, j))
if d2[j] == zero(T)
d2[j] = one(T)
end
Expand Down Expand Up @@ -142,7 +142,7 @@ function trust_region_{T}(df::AbstractDifferentiableMultivariateFunction,
# Update scaling vector
if autoscale
for j = 1:nn
d2[j] = max(convert(T, 0.01) * d2[j], sumabs2j(J, j))
d2[j] = max(convert(T, 0.01) * d2[j], sumabs2(view(J, :, j)))
end
end

Expand Down
6 changes: 0 additions & 6 deletions src/utils.jl
@@ -1,9 +1,3 @@
sumabs2j(S::AbstractMatrix, j::Integer) = sumabs2(slice(S, :, j))

function sumabs2j(S::SparseMatrixCSC, j::Integer)
sumabs2(sub(nonzeros(S), nzrange(S, j)))
end

function wdot{T}(w::Vector{T}, x::Vector{T}, y::Vector{T})
out = zero(T)
@inbounds @simd for i in 1:length(x)
Expand Down