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

domain/range difference of JOLI leads to error on lsqr #35

Open
ziyiyin97 opened this issue Jun 1, 2022 · 3 comments
Open

domain/range difference of JOLI leads to error on lsqr #35

ziyiyin97 opened this issue Jun 1, 2022 · 3 comments

Comments

@ziyiyin97
Copy link
Member

julia> using IterativeSolvers, JOLI

julia> F = joDFT(5; DDT=Float32, RDT=ComplexF32)
(joLinearFunction{Float32, ComplexF32}, (5, 5), "joDFT_p")

julia> b = randn(Float32, 5);

julia> lsqr(F', b)
┌ Info: JOLI method error for combination:
│   left_name = "non-JOLI"
│   left_type = Vector{ComplexF32} (alias for Array{Complex{Float32}, 1})
│   mid_name = "adjoint(joDFT_p)"
│   mid_type = joLinearFunction{ComplexF32, Float32}
│   right_name = "non-JOLI"
└   right_type = Vector{ComplexF32} (alias for Array{Complex{Float32}, 1})
ERROR: JOLI.joUtilsException("mul!(vec,jo,vec) not implemented or type mismatch")
Stacktrace:
 [1] jo_method_error(L::Vector{ComplexF32}, M::joLinearFunction{ComplexF32, Float32}, R::Vector{ComplexF32}, s::String)
   @ JOLI ~/.julia/packages/JOLI/bLPPv/src/joUtils.jl:63
 [2] mul!(y::Vector{ComplexF32}, A::joLinearFunction{ComplexF32, Float32}, x::Vector{ComplexF32})
   @ JOLI ~/.julia/packages/JOLI/bLPPv/src/joAbstractOperator/base_functions.jl:286
 [3] lsqr_method!(log::ConvergenceHistory{false, Nothing}, x::Vector{ComplexF32}, A::joLinearFunction{ComplexF32, Float32}, b::Vector{Float32}; damp::Int64, atol::Float32, btol::Float32, conlim::Float32, maxiter::Int64, verbose::Bool)
   @ IterativeSolvers ~/.julia/packages/IterativeSolvers/rhYBz/src/lsqr.jl:161
 [4] lsqr!(x::Vector{ComplexF32}, A::joLinearFunction{ComplexF32, Float32}, b::Vector{Float32}; maxiter::Int64, log::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ IterativeSolvers ~/.julia/packages/IterativeSolvers/rhYBz/src/lsqr.jl:74
 [5] lsqr!(x::Vector{ComplexF32}, A::joLinearFunction{ComplexF32, Float32}, b::Vector{Float32})
   @ IterativeSolvers ~/.julia/packages/IterativeSolvers/rhYBz/src/lsqr.jl:70
 [6] #lsqr#70
   @ ~/.julia/packages/IterativeSolvers/rhYBz/src/lsqr.jl:8 [inlined]
 [7] lsqr(A::joLinearFunction{ComplexF32, Float32}, b::Vector{Float32})
   @ IterativeSolvers ~/.julia/packages/IterativeSolvers/rhYBz/src/lsqr.jl:8
 [8] top-level scope
   @ REPL[4]:1

@ziyiyin97
Copy link
Member Author

julia> gmres(F', b)
┌ Info: JOLI method error for combination:
│   left_name = "non-JOLI"
│   left_type = SubArray{ComplexF32, 1, Matrix{ComplexF32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}
│   mid_name = "adjoint(joDFT_p)"
│   mid_type = joLinearFunction{ComplexF32, Float32}
│   right_name = "non-JOLI"
└   right_type = SubArray{ComplexF32, 1, Matrix{ComplexF32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}
ERROR: JOLI.joUtilsException("mul!(vec,jo,vec) not implemented or type mismatch")
Stacktrace:
  [1] jo_method_error(L::SubArray{ComplexF32, 1, Matrix{ComplexF32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, M::joLinearFunction{ComplexF32, Float32}, R::SubArray{ComplexF32, 1, Matrix{ComplexF32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, s::String)
    @ JOLI ~/.julia/dev/JOLI/src/joUtils.jl:63
  [2] mul!(y::SubArray{ComplexF32, 1, Matrix{ComplexF32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, A::joLinearFunction{ComplexF32, Float32}, x::SubArray{ComplexF32, 1, Matrix{ComplexF32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true})
    @ JOLI ~/.julia/dev/JOLI/src/joAbstractOperator/base_functions.jl:286
  [3] expand!(arnoldi::IterativeSolvers.ArnoldiDecomp{ComplexF32, joLinearFunction{ComplexF32, Float32}}, Pl::Identity, Pr::Identity, k::Int64, Ax::Vector{ComplexF32})
    @ IterativeSolvers ~/.julia/packages/IterativeSolvers/rhYBz/src/gmres.jl:287
  [4] iterate
    @ ~/.julia/packages/IterativeSolvers/rhYBz/src/gmres.jl:64 [inlined]
  [5] iterate
    @ ~/.julia/packages/IterativeSolvers/rhYBz/src/gmres.jl:59 [inlined]
  [6] iterate
    @ ./iterators.jl:159 [inlined]
  [7] iterate
    @ ./iterators.jl:158 [inlined]
  [8] gmres!(x::Vector{ComplexF32}, A::joLinearFunction{ComplexF32, Float32}, b::Vector{Float32}; Pl::Identity, Pr::Identity, abstol::Float32, reltol::Float32, restart::Int64, maxiter::Int64, log::Bool, initially_zero::Bool, verbose::Bool, orth_meth::ModifiedGramSchmidt)
    @ IterativeSolvers ~/.julia/packages/IterativeSolvers/rhYBz/src/gmres.jl:207
  [9] #gmres#31
    @ ~/.julia/packages/IterativeSolvers/rhYBz/src/gmres.jl:143 [inlined]
 [10] gmres(A::joLinearFunction{ComplexF32, Float32}, b::Vector{Float32})
    @ IterativeSolvers ~/.julia/packages/IterativeSolvers/rhYBz/src/gmres.jl:143
 [11] top-level scope
    @ REPL[5]:1

gmres doesn't work either

@henryk-modzelewski
Copy link
Member

You gave b the wrong type. For adjoint it has to be real.

@ziyiyin97
Copy link
Member Author

Yes b is real

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 a pull request may close this issue.

2 participants