Skip to content
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

Bug: adjoint(opEye()) * randn(10) #308

Closed
JakobAsslaender opened this issue Jan 2, 2024 · 2 comments
Closed

Bug: adjoint(opEye()) * randn(10) #308

JakobAsslaender opened this issue Jan 2, 2024 · 2 comments

Comments

@JakobAsslaender
Copy link
Contributor

Hi everyone,

I observed the following bug:

julia> adjoint(opEye()) * randn(10)
ERROR: type opEye has no field nrow
Stacktrace:
 [1] getproperty(x::opEye, f::Symbol)
   @ Base ./Base.jl:37
 [2] size(op::opEye)
   @ LinearOperators ~/.julia/packages/LinearOperators/WS4fM/src/abstract.jl:194
 [3] size(A::AdjointLinearOperator{Any, opEye})
   @ LinearOperators ~/.julia/packages/LinearOperators/WS4fM/src/adjtrans.jl:62
 [4] *(op::AdjointLinearOperator{Any, opEye}, v::Vector{Float64})
   @ LinearOperators ~/.julia/packages/LinearOperators/WS4fM/src/operations.jl:41
 [5] top-level scope
   @ REPL[3]:1

I think the problem is that *(A::opEye, x) has a special implementation, but for the adjoint, it falls back to the generic implementation of *(A::AdjointLinearOperator, x) which assumes a fully-described LinearOperator.

The bug should be fixed (or rather avoided) when adding the following code

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

which will ensure that the *(A::opEye, x) implementations are used. But I am sure there are other solutions.

Happy to create a PR -- LMK. Thanks.
-ja

@geoffroyleconte
Copy link
Member

Hi, thank you for spotting this, I opened a PR with your suggestions:
#309

@dpo
Copy link
Member

dpo commented Feb 25, 2024

Fixed in #309.

@dpo dpo closed this as completed Feb 25, 2024
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

No branches or pull requests

3 participants