-
Notifications
You must be signed in to change notification settings - Fork 92
Add diag argument to copytri!
#679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/host/linalg.jl b/src/host/linalg.jl
index 5f3b67a..fc8d200 100644
--- a/src/host/linalg.jl
+++ b/src/host/linalg.jl
@@ -116,8 +116,8 @@ if VERSION >= v"1.13-a"
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
- @inbounds _A[j,i] = conj(_A[i,j])
- end
+ @inbounds _A[j, i] = conj(_A[i, j])
+ end
end
U_conj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'U' && !conjugate
@@ -125,8 +125,8 @@ if VERSION >= v"1.13-a"
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
- @inbounds _A[j,i] = _A[i,j]
- end
+ @inbounds _A[j, i] = _A[i, j]
+ end
end
U_noconj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'L' && conjugate
@@ -134,7 +134,7 @@ if VERSION >= v"1.13-a"
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
- @inbounds _A[i,j] = conj(_A[j,i])
+ @inbounds _A[i, j] = conj(_A[j, i])
end
end
L_conj!(get_backend(A))(A; ndrange = size(A))
@@ -143,14 +143,14 @@ if VERSION >= v"1.13-a"
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j + diag > i
- @inbounds _A[i,j] = _A[j,i]
+ @inbounds _A[i, j] = _A[j, i]
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
+ return A
end
else
@@ -163,8 +163,8 @@ else
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
- @inbounds _A[j,i] = conj(_A[i,j])
- end
+ @inbounds _A[j, i] = conj(_A[i, j])
+ end
end
U_conj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'U' && !conjugate
@@ -172,8 +172,8 @@ else
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
- @inbounds _A[j,i] = _A[i,j]
- end
+ @inbounds _A[j, i] = _A[i, j]
+ end
end
U_noconj!(get_backend(A))(A; ndrange = size(A))
elseif uplo == 'L' && conjugate
@@ -181,7 +181,7 @@ else
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
- @inbounds _A[i,j] = conj(_A[j,i])
+ @inbounds _A[i, j] = conj(_A[j, i])
end
end
L_conj!(get_backend(A))(A; ndrange = size(A))
@@ -190,14 +190,14 @@ else
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j > i
- @inbounds _A[i,j] = _A[j,i]
+ @inbounds _A[i, j] = _A[j, i]
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
+ return A
end
end
diff --git a/test/testsuite/linalg.jl b/test/testsuite/linalg.jl
index 8bd98c7..a1459a4 100644
--- a/test/testsuite/linalg.jl
+++ b/test/testsuite/linalg.jl
@@ -81,8 +81,8 @@
continue
end
n = 128
- areal = randn(n,n)/2
- aimg = randn(n,n)/2
+ 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, diag), AT, a)
end
@@ -93,8 +93,8 @@
continue
end
n = 128
- areal = randn(n,n)/2
- aimg = randn(n,n)/2
+ 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)
end |
|
I think runic's indentation is wrong. Look at these lines: The |
|
Yeah feel free to ignore Runic... |
|
Can you add Also, this seems to break CUDA.jl etc tests on <1.13: |
|
We're going to need to ignore the Buildkite error at the moment. It fails because CUDA.jl isn't working with Julia 1.13. That's a known problem, and a prerequisite for making it work is making GPUArrays.jl work with Julia 1.13... |
Julia 1.13 added a
diag::Boolargument tocopytri!. We need to mimic that so that we can match the signature when overloading for GPUArrays.