From f4d82b2bb16704106d1d4ec4e9bc6cc08a50ebb9 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Fri, 23 Feb 2018 10:01:00 +0100 Subject: [PATCH] rm ZeroOffsetVector (#26169) --- stdlib/LinearAlgebra/src/tridiag.jl | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/stdlib/LinearAlgebra/src/tridiag.jl b/stdlib/LinearAlgebra/src/tridiag.jl index 1b9c4eaf0df5b..74f2016b0c1c5 100644 --- a/stdlib/LinearAlgebra/src/tridiag.jl +++ b/stdlib/LinearAlgebra/src/tridiag.jl @@ -305,14 +305,6 @@ end # Generic methods # ################### -#Needed for inv_usmani() -struct ZeroOffsetVector - data::Vector -end -getindex(a::ZeroOffsetVector, i) = a.data[i+1] -setindex!(a::ZeroOffsetVector, x, i) = a.data[i+1]=x - - ## structured matrix methods ## function Base.replace_in_print_matrix(A::SymTridiagonal, i::Integer, j::Integer, s::AbstractString) i==j-1||i==j||i==j+1 ? s : Base.replace_with_centered_mark(s) @@ -327,11 +319,11 @@ end # doi:10.1016/0024-3795(94)90414-6 function inv_usmani(a::V, b::V, c::V) where {T,V<:AbstractVector{T}} n = length(b) - θ = ZeroOffsetVector(zeros(T, n+1)) #principal minors of A - θ[0] = 1 - n>=1 && (θ[1] = b[1]) + θ = zeros(T, n+1) #principal minors of A + θ[1] = 1 + n>=1 && (θ[2] = b[1]) for i=2:n - θ[i] = b[i]*θ[i-1]-a[i-1]*c[i-1]*θ[i-2] + θ[i+1] = b[i]*θ[i]-a[i-1]*c[i-1]*θ[i-1] end φ = zeros(T, n+1) φ[n+1] = 1 @@ -343,11 +335,11 @@ function inv_usmani(a::V, b::V, c::V) where {T,V<:AbstractVector{T}} for i=1:n, j=1:n sign = (i+j)%2==0 ? (+) : (-) if ij - α[i,j]=(sign)(prod(a[j:i-1]))*θ[j-1]*φ[i+1]/θ[n] + α[i,j]=(sign)(prod(a[j:i-1]))*θ[j]*φ[i+1]/θ[n+1] end end α