Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bfd53e0
Float 16 factors
ArunS-tack Jun 24, 2021
6ce8561
Update stdlib/LinearAlgebra/src/eigen.jl
ArunS-tack Jun 25, 2021
2a5acfa
Update stdlib/LinearAlgebra/src/cholesky.jl
ArunS-tack Jun 25, 2021
226e098
Update eigen.jl
ArunS-tack Jun 25, 2021
c771253
Merge branch 'float16' of https://github.com/ArunSanganal/julia into …
ArunS-tack Jun 25, 2021
0bb1904
Update eigen.jl
ArunS-tack Jun 25, 2021
7f41e64
Update svd.jl
ArunS-tack Jun 25, 2021
aca3361
Merge branch 'float16' of https://github.com/ArunSanganal/julia into …
ArunS-tack Jun 25, 2021
5f3bf76
Update stdlib/LinearAlgebra/src/eigen.jl
ArunS-tack Jun 25, 2021
1ffd9c7
Update stdlib/LinearAlgebra/src/svd.jl
ArunS-tack Jun 25, 2021
e362dd1
Merge branch 'JuliaLang:master' into float16
ArunS-tack Jun 25, 2021
641c408
Update eigen.jl
ArunS-tack Jun 25, 2021
d721eac
Update stdlib/LinearAlgebra/src/svd.jl
ArunS-tack Jun 25, 2021
fd459bb
Update eigen.jl
ArunS-tack Jun 25, 2021
973b22a
Update eigen.jl
ArunS-tack Jun 25, 2021
85169ed
Update eigen.jl
ArunS-tack Jun 26, 2021
27ea310
Update eigen.jl
ArunS-tack Jun 26, 2021
a9951a7
Added type converter for Eigen.
ArunS-tack Jun 26, 2021
ff71500
Update eigen.jl
ArunS-tack Jun 26, 2021
9924e71
Update stdlib/LinearAlgebra/src/eigen.jl
ArunS-tack Jun 26, 2021
3ca6c90
Update stdlib/LinearAlgebra/src/eigen.jl
ArunS-tack Jun 26, 2021
63fcccf
updates
ArunS-tack Jun 26, 2021
7be6114
Update eigen.jl
ArunS-tack Jun 26, 2021
5a58bfa
Update eigen.jl
ArunS-tack Jun 26, 2021
e303b10
Update eigen.jl
ArunS-tack Jun 27, 2021
31d4019
Update stdlib/LinearAlgebra/src/eigen.jl
ArunS-tack Jun 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions stdlib/LinearAlgebra/src/cholesky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ true
cholesky(A::Union{StridedMatrix,RealHermSymComplexHerm{<:Real,<:StridedMatrix}},
::Val{false}=Val(false); check::Bool = true) = cholesky!(cholcopy(A); check = check)

function cholesky(A::Union{StridedMatrix{Float16},RealHermSymComplexHerm{Float16,<:StridedMatrix}}, ::Val{false}=Val(false); check::Bool = true)
X = cholesky!(cholcopy(A); check = check)
return Cholesky{Float16}(X)
end


## With pivoting
"""
Expand Down
12 changes: 12 additions & 0 deletions stdlib/LinearAlgebra/src/eigen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,18 @@ function eigen(A::AbstractMatrix{T}; permute::Bool=true, scale::Bool=true, sortb
isdiag(AA) && return eigen(Diagonal(AA); permute=permute, scale=scale, sortby=sortby)
return eigen!(AA; permute=permute, scale=scale, sortby=sortby, jvl=jvl, jvr=jvr, jce=jce, jcv=jcv)
end
function eigen(A::AbstractMatrix{Float16}; permute::Bool=true, scale::Bool=true, sortby::Union{Function,Nothing}=eigsortby)
AA = copy_oftype(A, eigtype(Float16))
isdiag(AA) && return eigen(Diagonal(AA); permute=permute, scale=scale, sortby=sortby)
A = eigen!(AA; permute=permute, scale=scale, sortby=sortby)
if isreal(A.values)
Eigen(convert(Vector{Float16}, A.values),
convert(AbstractArray{Float16}, A.vectors))
else
Eigen(convert(Vector{Complex{Float16}}, A.values),
convert(AbstractArray{Complex{Float16}}, A.vectors))
end
end
eigen(x::Number) = Eigen([x], fill(one(x), 1, 1))

"""
Expand Down
4 changes: 4 additions & 0 deletions stdlib/LinearAlgebra/src/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ true
function svd(A::StridedVecOrMat{T}; full::Bool = false, alg::Algorithm = default_svd_alg(A)) where {T}
svd!(copy_oftype(A, eigtype(T)), full = full, alg = alg)
end
function svd(A::StridedVecOrMat{T}; full::Bool = false, alg::Algorithm = default_svd_alg(A)) where {T <: Union{Float16,Complex{Float16}}
A = svd!(copy_oftype(A, eigtype(T)), full = full, alg = alg)
return SVD{T}(A)
end
function svd(x::Number; full::Bool = false, alg::Algorithm = default_svd_alg(x))
SVD(x == 0 ? fill(one(x), 1, 1) : fill(x/abs(x), 1, 1), [abs(x)], fill(one(x), 1, 1))
end
Expand Down
9 changes: 9 additions & 0 deletions stdlib/LinearAlgebra/test/cholesky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,13 @@ end
@test F\b == F'\b
end

@testset "Float16" begin
A = Float16[4. 12. -16.; 12. 37. -43.; -16. -43. 98.]
B = cholesky(A)
@test B isa Cholesky{Float16, Matrix{Float16}}
@test B.U isa UpperTriangular{Float16, Matrix{Float16}}
@test B.L isa LowerTriangular{Float16, Matrix{Float16}}
@test B.UL isa UpperTriangular{Float16, Matrix{Float16}}
end

end # module TestCholesky
8 changes: 8 additions & 0 deletions stdlib/LinearAlgebra/test/eigen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,12 @@ end
@test isequal(eigen(A), eigen(A))
end

@testset "Float16" begin
A = Float16[4. 12. -16.; 12. 37. -43.; -16. -43. 98.]
B = eigen(A)
@test B isa Eigen{Float16, Float16, Matrix{Float16}, Vector{Float16}, Vector{Float16}}
@test B.values isa Vector{Float16}
@test B.vectors isa Matrix{Float16}
end

end # module TestEigen
9 changes: 9 additions & 0 deletions stdlib/LinearAlgebra/test/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,13 @@ end
end
end

@testset "Float16" begin
A = Float16[4. 12. -16.; 12. 37. -43.; -16. -43. 98.]
B = svd(A)
@test B isa SVD{Float16, Float16, Matrix{Float16}}
@test B.U isa Matrix{Float16}
@test B.Vt isa Matrix{Float16}
@test B.S isa Vector{Float16}
end

end # module TestSVD