Skip to content

Commit

Permalink
remove misleading bidiag constructor, make Bidiagonal immutable (#22750)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored and KristofferC committed Jul 17, 2017
1 parent 72ecb44 commit e4bd638
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions base/linalg/bidiag.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# Bidiagonal matrices
mutable struct Bidiagonal{T} <: AbstractMatrix{T}
struct Bidiagonal{T} <: AbstractMatrix{T}
dv::Vector{T} # diagonal
ev::Vector{T} # sub/super diagonal
uplo::Char # upper bidiagonal ('U') or lower ('L')
Expand Down Expand Up @@ -58,7 +58,6 @@ julia> Bl = Bidiagonal(dv, ev, :L) # ev is on the first subdiagonal
function Bidiagonal(dv::AbstractVector{T}, ev::AbstractVector{T}, uplo::Symbol) where T
Bidiagonal{T}(collect(dv), collect(ev), char_uplo(uplo))
end
Bidiagonal(dv::AbstractVector, ev::AbstractVector) = throw(ArgumentError("did you want an upper or lower Bidiagonal? Try again with an additional true (upper) or false (lower) argument."))

function Bidiagonal(dv::AbstractVector{Td}, ev::AbstractVector{Te}, uplo::Symbol) where {Td,Te}
T = promote_type(Td,Te)
Expand Down
2 changes: 1 addition & 1 deletion test/linalg/bidiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ srand(1)
@test Bidiagonal(dv,ev,:U) != Bidiagonal(dv,ev,:L)
@test_throws ArgumentError Bidiagonal(dv,ev,:R)
@test_throws DimensionMismatch Bidiagonal(dv,ones(elty,n),:U)
@test_throws ArgumentError Bidiagonal(dv,ev)
@test_throws MethodError Bidiagonal(dv,ev)
end

@testset "getindex, setindex!, size, and similar" begin
Expand Down

0 comments on commit e4bd638

Please sign in to comment.