`opRestriction` and `opExtension` ignore `α` and `β` in 5-argument `mul!`

Open Beginner friendly
#430 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
backend

Research direction

The bug is in the kernels mulRestrict! and multRestrict! in src/special-operators.jl, which accept α and β but never use them. Start there, then check how opRestriction and opExtension route the forward and adjoint products to these kernels. Run the reproduction from the issue; it is done when the 5-argument mul! returns α * op * v + β * res for both the forward and transposed cases.

Written by the indexing model from the issue text.

Description

mul!(res, op, v, α, β) should compute α * op * v + β * res, but for operators built by opRestriction (and opExtension, its transpose) the result is op * v: α and β are ignored in both the forward and the transposed/adjoint product.

using LinearOperators, LinearAlgebra
op = opRestriction([2, 4], 5)

res = ones(2)
mul!(res, op, [1.0, 2.0, 3.0, 4.0, 5.0], 2.0, 3.0)
res  # [2.0, 4.0], expected [7.0, 11.0]

res = ones(5)
mul!(res, op', [1.0, 2.0], 2.0, 3.0)
res  # [0.0, 1.0, 0.0, 2.0, 0.0], expected [3.0, 5.0, 3.0, 7.0, 3.0]

res = ones(5)
mul!(res, opExtension([2, 4], 5), [1.0, 2.0], 2.0, 3.0)
res  # [0.0, 1.0, 0.0, 2.0, 0.0], expected [3.0, 5.0, 3.0, 7.0, 3.0]

Julia 1.10.12, LinearOperators 2.14.3.

The kernels in src/special-operators.jl take α and β but do not use them:

function mulRestrict!(res, I, v, α, β)
  res .= view(v, I)
end

function multRestrict!(res, I, u, α, β)
  res .= 0
  res[I] = u
end
Dominant language
Julia
Stars
214
Forks
46
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaSmoothOptimizers/LinearOperators.jl

All issues in JuliaSmoothOptimizers/LinearOperators.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.