Skip to content

Commit

Permalink
Adjoint opEye
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffroyleconte authored and dpo committed Jan 8, 2024
1 parent 22cf605 commit 48d0616
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/special-operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ struct opEye <: AbstractLinearOperator{Any} end
*(T::AbstractLinearOperator, ::opEye) = T
*(::opEye, T::opEye) = T

adjoint(A::opEye) = A
transpose(A::opEye) = A
conj(A::opEye) = A

function show(io::IO, op::opEye)
println(io, "Identity operator")
end
Expand Down
4 changes: 4 additions & 0 deletions test/test_linop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ function test_linop()
op2 = opEye()
@test op === op2
@test op === op * op2 === op2 * op

@test norm(transpose(op) * v - v) <= ϵ * norm(v)
@test norm(adjoint(op) * v - v) <= ϵ * norm(v)
@test norm(conj(op) * v - v) <= ϵ * norm(v)
end

@testset "Ones" begin
Expand Down

0 comments on commit 48d0616

Please sign in to comment.