Skip to content

Commit 396e7b0

Browse files
committed
Add type alias for BlasMat
1 parent dbce8f4 commit 396e7b0

8 files changed

Lines changed: 20 additions & 17 deletions

File tree

src/interface/eig.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,18 @@ See also [`eig_full(!)`](@ref eig_full) and [`eig_trunc(!)`](@ref eig_trunc).
8787

8888
# Algorithm selection
8989
# -------------------
90-
# Default to LAPACK for `StridedMatrix{<:BlasFloat}`
90+
# Default to LAPACK for `YALAPACK.BlasMat`
9191
function default_algorithm(::typeof(eig_full!), ::Type{A};
92-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
92+
kwargs...) where {A<:YALAPACK.BlasMat}
9393
return LAPACK_Expert(; kwargs...)
9494
end
9595
function default_algorithm(::typeof(eig_vals!), ::Type{A};
96-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
96+
kwargs...) where {A<:YALAPACK.BlasMat}
9797
return LAPACK_Expert(; kwargs...)
9898
end
9999

100100
function select_algorithm(::typeof(eig_trunc!), ::Type{A}, alg; trunc=nothing,
101-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
101+
kwargs...) where {A<:YALAPACK.BlasMat}
102102
alg_eig = select_algorithm(eig_full!, A, alg; kwargs...)
103103
return TruncatedAlgorithm(alg_eig, select_truncation(trunc))
104104
end

src/interface/eigh.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ See also [`eigh_full(!)`](@ref eigh_full) and [`eigh_trunc(!)`](@ref eigh_trunc)
8686

8787
# Algorithm selection
8888
# -------------------
89-
# Default to LAPACK for `StridedMatrix{<:BlasFloat}`
89+
# Default to LAPACK for `YALAPACK.BlasMat`
9090
function default_algorithm(::typeof(eigh_full!), ::Type{A};
91-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
91+
kwargs...) where {A<:YALAPACK.BlasMat}
9292
return LAPACK_MultipleRelativelyRobustRepresentations(; kwargs...)
9393
end
9494
function default_algorithm(::typeof(eigh_vals!), ::Type{A};
95-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
95+
kwargs...) where {A<:YALAPACK.BlasMat}
9696
return LAPACK_MultipleRelativelyRobustRepresentations(; kwargs...)
9797
end
9898

9999
function select_algorithm(::typeof(eigh_trunc!), ::Type{A}, alg; trunc=nothing,
100-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
100+
kwargs...) where {A<:YALAPACK.BlasMat}
101101
alg_eigh = select_algorithm(eigh_full!, A, alg; kwargs...)
102102
return TruncatedAlgorithm(alg_eigh, select_truncation(trunc))
103103
end

src/interface/lq.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ See also [`qr_full(!)`](@ref lq_full) and [`qr_compact(!)`](@ref lq_compact).
7171
for f in (:lq_full!, :lq_compact!, :lq_null!)
7272
@eval begin
7373
function default_algorithm(::typeof($f), ::Type{A};
74-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
74+
kwargs...) where {A<:YALAPACK.BlasMat}
7575
return LAPACK_HouseholderLQ(; kwargs...)
7676
end
7777
end

src/interface/polar.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ end
6161
# Algorithm selection
6262
# -------------------
6363
function default_algorithm(::typeof(left_polar!), ::Type{A};
64-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
64+
kwargs...) where {A<:YALAPACK.BlasMat}
6565
return PolarViaSVD(default_algorithm(svd_compact!, A; kwargs...))
6666
end
6767
function default_algorithm(::typeof(right_polar!), ::Type{A};
68-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
68+
kwargs...) where {A<:YALAPACK.BlasMat}
6969
return PolarViaSVD(default_algorithm(svd_compact!, A; kwargs...))
7070
end

src/interface/qr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ See also [`lq_full(!)`](@ref lq_full) and [`lq_compact(!)`](@ref lq_compact).
7171
for f in (:qr_full!, :qr_compact!, :qr_null!)
7272
@eval begin
7373
function default_algorithm(::typeof($f), ::Type{A};
74-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
74+
kwargs...) where {A<:YALAPACK.BlasMat}
7575
return LAPACK_HouseholderQR(; kwargs...)
7676
end
7777
end

src/interface/schur.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ See also [`eig_full(!)`](@ref eig_full) and [`eig_trunc(!)`](@ref eig_trunc).
5252
# Algorithm selection
5353
# -------------------
5454
function default_algorithm(::typeof(schur_full!), ::Type{A};
55-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
55+
kwargs...) where {A<:YALAPACK.BlasMat}
5656
return default_algorithm(eig_full!, A; kwargs...)
5757
end
5858
function default_algorithm(::typeof(schur_vals!), ::Type{A};
59-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
59+
kwargs...) where {A<:YALAPACK.BlasMat}
6060
return default_algorithm(eig_vals!, A; kwargs...)
6161
end

src/interface/svd.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ See also [`svd_full(!)`](@ref svd_full), [`svd_compact(!)`](@ref svd_compact) an
9191
# Algorithm selection
9292
# -------------------
9393
for f in (:svd_full!, :svd_compact!, :svd_vals!)
94-
# Default to LAPACK SDD for `StridedMatrix{<:BlasFloat}`
94+
# Default to LAPACK SDD for `YALAPACK.BlasMat`
9595
@eval function default_algorithm(::typeof($f), ::Type{A};
96-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
96+
kwargs...) where {A<:YALAPACK.BlasMat}
9797
return LAPACK_DivideAndConquer(; kwargs...)
9898
end
9999
end
100100

101101
function select_algorithm(::typeof(svd_trunc!), ::Type{A}, alg; trunc=nothing,
102-
kwargs...) where {A<:StridedMatrix{<:BlasFloat}}
102+
kwargs...) where {A<:YALAPACK.BlasMat}
103103
alg_svd = select_algorithm(svd_compact!, A, alg; kwargs...)
104104
return TruncatedAlgorithm(alg_svd, select_truncation(trunc))
105105
end

src/yalapack.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ using LinearAlgebra: BlasFloat, BlasReal, BlasComplex, BlasInt, Char, LAPACK,
1616
using LinearAlgebra.BLAS: @blasfunc, libblastrampoline
1717
using LinearAlgebra.LAPACK: chkfinite, chktrans, chkside, chkuplofinite, chklapackerror
1818

19+
# type alias for matrices that are definitely supported by YALAPACK
20+
const BlasMat{T<:BlasFloat} = StridedMatrix{T}
21+
1922
# LU factorisation
2023
for (getrf, getrs, elty) in ((:dgetrf_, :dgetrs_, :Float64),
2124
(:sgetrf_, :sgetrs_, :Float32),

0 commit comments

Comments
 (0)