Skip to content

Conversation

@tam724
Copy link
Contributor

@tam724 tam724 commented Oct 28, 2025

Shortcuts the kernels in triu!, tril! and identity_kernel if the arguments are empty matrices.

All three would fail with DivideError: integer division error (from KernelAbstractions.jl).

@github-actions
Copy link
Contributor

github-actions bot commented Oct 28, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic master) to apply these changes.

Click here to view the suggested changes.
diff --git a/test/testsuite/construction.jl b/test/testsuite/construction.jl
index 0ed3393..482e47c 100644
--- a/test/testsuite/construction.jl
+++ b/test/testsuite/construction.jl
@@ -193,7 +193,7 @@
             x1 = AT{Float32, 2}(I, (0, 3))
 
             @test Array(x1) ≈ x
-            
+
             copyto!(x1, I)
             @test Array(x1) ≈ x
         end

@tam724
Copy link
Contributor Author

tam724 commented Oct 29, 2025

Thanks for the review! @maleadt
I added your suggestions and fixed the test.

d in -2:2
A = randn(Float32, 10, 10)
@test f(A, d) == Array(f!(AT(A), d))
@test compare(f, AT, A)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test compare(f, AT, A)
@test compare(f, AT, A, d)

@test compare(f, AT, A)

A_empty = randn(Float32, 0, 0)
@test compare(f, AT, A_empty)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test compare(f, AT, A_empty)
@test compare(f, AT, A_empty, d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants