Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
4 changes: 4 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ steps:
julia:
- "1.10"
- "1.12"
- "1.13"
soft_fail:
- exit_status: 3

Expand Down Expand Up @@ -99,6 +100,7 @@ steps:
julia:
- "1.10"
- "1.12"
- "1.13"
soft_fail:
- exit_status: 3

Expand Down Expand Up @@ -151,6 +153,7 @@ steps:
julia:
- "1.10"
- "1.12"
- "1.13"
soft_fail:
- exit_status: 3

Expand Down Expand Up @@ -203,6 +206,7 @@ steps:
julia:
- "1.10"
- "1.12"
- "1.13"
soft_fail:
- exit_status: 3

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ['1.10', '1.11', '1.12', 'nightly']
version: ['1.10', '1.11', '1.12', '1.13', 'nightly']
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: '1.11'
version: '1.12'
- uses: julia-actions/cache@v2
- name: Run tests
run: |
Expand Down
80 changes: 42 additions & 38 deletions src/host/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,50 +107,54 @@ end

## copy upper triangle to lower and vice versa

function LinearAlgebra.copytri!(A::AbstractGPUMatrix, uplo::AbstractChar, conjugate::Bool=false)
n = LinearAlgebra.checksquare(A)
if uplo == 'U' && conjugate
@kernel function U_conj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
@inbounds _A[j,i] = conj(_A[i,j])
function LinearAlgebra.copytri!(A::AbstractGPUMatrix, uplo::AbstractChar, conjugate::Bool = false, diag::Bool = false)
n = LinearAlgebra.checksquare(A)
if uplo == 'U' && conjugate
@kernel function U_conj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
@inbounds _A[j,i] = conj(_A[i,j])
end
end
end
U_conj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'U' && !conjugate
@kernel function U_noconj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
@inbounds _A[j,i] = _A[i,j]
U_conj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'U' && !conjugate
@kernel function U_noconj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
@inbounds _A[j,i] = _A[i,j]
end
end
end
U_noconj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'L' && conjugate
@kernel function L_conj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
@inbounds _A[i,j] = conj(_A[j,i])
U_noconj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'L' && conjugate
@kernel function L_conj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
@inbounds _A[i,j] = conj(_A[j,i])
end
end
end
L_conj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'L' && !conjugate
@kernel function L_noconj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
@inbounds _A[i,j] = _A[j,i]
L_conj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'L' && !conjugate
@kernel function L_noconj!(_A)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
@inbounds _A[i,j] = _A[j,i]
end
end
end
L_noconj!(get_backend(A))(A; ndrange = size(A))
else
throw(ArgumentError("uplo argument must be 'U' (upper) or 'L' (lower), got $uplo"))
end
A
L_noconj!(get_backend(A))(A; ndrange = size(A))
else
throw(ArgumentError("uplo argument must be 'U' (upper) or 'L' (lower), got $uplo"))
end
A
end

# For backward compatibility with Julia <1.13
LinearAlgebra.copytri!(A::AbstractGPUMatrix, uplo::AbstractChar, conjugate::Bool = false) =
LinearAlgebra.copytri!(A, uplo, conjugate, false)

## copy a triangular part of a matrix to another matrix

if isdefined(LinearAlgebra, :copytrito!)
Expand Down
4 changes: 2 additions & 2 deletions test/testsuite/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@

@testset "triangular" begin
@testset "copytri!" begin
@testset for eltya in (Float32, Float64, ComplexF32, ComplexF64), uplo in ('U', 'L'), conjugate in (true, false)
@testset for eltya in (Float32, Float64, ComplexF32, ComplexF64), uplo in ('U', 'L'), conjugate in (true, false), diag in (true, false)
if !(eltya in eltypes)
continue
end
n = 128
areal = randn(n,n)/2
aimg = randn(n,n)/2
a = convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal)
@test compare(x -> LinearAlgebra.copytri!(x, uplo, conjugate), AT, a)
@test compare(x -> LinearAlgebra.copytri!(x, uplo, conjugate, diag), AT, a)
end
end

Expand Down
Loading