File tree Expand file tree Collapse file tree 3 files changed +31
-41
lines changed Expand file tree Collapse file tree 3 files changed +31
-41
lines changed Original file line number Diff line number Diff line change 1- using Pkg
2- Pkg. activate (" ." )
31using SciMLOperators
42using LinearAlgebra
53using Test
@@ -204,6 +202,31 @@ using Test
204202 # Check that copy is not affected
205203 @test L_copy. L. A[1 , 1 ] != 999.0
206204 end
207- end
208-
209- println (" All copy tests passed!" )
205+
206+ # Test that operators still work correctly after copying
207+ @testset " Functionality after copy" begin
208+ # MatrixOperator
209+ A = rand (5 , 5 )
210+ L = MatrixOperator (A)
211+ L_copy = copy (L)
212+ v = rand (5 )
213+ @test L * v ≈ L_copy * v
214+
215+ # ScalarOperator
216+ α = ScalarOperator (2.0 )
217+ α_copy = copy (α)
218+ @test α * v ≈ α_copy * v
219+
220+ # ComposedOperator
221+ B = MatrixOperator (rand (5 , 5 ))
222+ comp = L ∘ B
223+ comp_copy = copy (comp)
224+ @test comp * v ≈ comp_copy * v
225+
226+ # AffineOperator
227+ b = rand (5 )
228+ aff = AffineOperator (L, B, b)
229+ aff_copy = copy (aff)
230+ @test aff * v ≈ aff_copy * v
231+ end
232+ end
Original file line number Diff line number Diff line change 2828 @time @safetestset " Zygote.jl" begin
2929 include (" zygote.jl" )
3030 end
31+ @time @safetestset " Copy methods" begin
32+ include (" copy.jl" )
33+ end
3134 elseif GROUP == " All" || GROUP == " Downstream"
3235 activate_downstream_env ()
3336 @time @safetestset " AllocCheck" begin
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments