JuliaApproximation / JuliaApproximation/ContinuumArrays.jl

How to handle Linear operators / functionals?

Open
#112 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
31
Forks
6
Avg merge
9d 22h
Merged PRs (30d)
2

Description

At the moment we have the following setup for linear operators / functionals that are not built out of elementary operations, where f isa AbstractQuasiVector and T isa AbstractQuasiMatrix:

  1. Derivative(x) * f and Derivative(x) * T
  2. sum(f) and sum(T; dims=1)
    As we consider other linear operators such as cumsum it might be a good idea to see how to make this consistent

Version (2) is in some sense "canonical" as it exists in Base. So the question is what to do with Version (1). We could have something like

struct Linear{T,Axes,F} <: AbstractQuasiMatrix{T}
    f::F
    axes::Axes
end

*(L::Linear, v::AbstractQuasiVector) = L.f(v)
*(L::Linear, v::AbstractQuasiMatrix) = L.f(v; dims=1)
axes(L::Linear) = L.axes

const Diff{T,Axis} = Linear{T, Axis,typeof(diff)} # Replaces Derivative
const Cumsum{T,Axis} = Linear{T, Axis,typeof(cumsum)}
const Sum{T,Axis} = Linear{T,Axis,typeof(sum)}

Diff(x) = Linear{Float64}(diff, (x,x))
Cumsum(x) = Linear{Float64}(cumsum, (x,x))
Sum(x) = Linear{Float64}(diff, (Base.OneTo(1),x))

How this relates to axes-free alternatives is another question: https://github.com/JuliaApproximation/ContinuumArrays.jl/issues/22

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Review the current handling of Derivative, sum, and AbstractQuasiVector/AbstractQuasiMatrix, then compare the proposed Linear design with the axes-free alternatives in issue #22. This needs a maintainer decision on a consistent API for cumsum and related operators; it is done when that design is agreed and its implementation scope is specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.