Skip to content

Inverse problems #12

@jagot

Description

@jagot

I managed to get some of the basis inversions to work, but not all:

using FiniteDifferencesQuasi
using LinearAlgebra
using Test

R = FiniteDifferences(20,0.2)
R⁻¹ = pinv(R)
# # Actually, we want
# R⁻¹ = inv(R)
# # but then we get
# # ERROR: LoadError: MethodError: no method matching ContinuumArrays.AlephInfinity{1}(::Int64)

u = R*rand(size(R,2))
v = R*rand(size(R,2))

uvc = [u.args[2] v.args[2]]
uv = R*uvc

ut = u'

@test R⁻¹*R == I
@test R*R⁻¹ == I
@test R⁻¹*u === u.args[2]
@test R⁻¹*uv === uvc

# # We also want this to work
# @test ut*R⁻¹' === ut.args[1]
# # ERROR: MethodError: no method matching axes(::UniformScaling{Float64}, ::Int64)

M = Diagonal(2ones(size(R,2)))
# # Finally, we'd like to write operators as
# O = R*M*R⁻¹
# # but alas
# # ERROR: LoadError: MethodError: no method matching ContinuumArrays.AlephInfinity{1}(::Int64)
# @test R⁻¹*O*u == M*R⁻¹*u

I've not yet figured out why inv does not work, to me it seems most things are mirrored compared to pinv in e.g. inv.jl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions