Skip to content

Updates in LinearOperators #2

Open
@dpo

Description

@dpo

I updated LinearOperators in JuliaSmoothOptimizers/LinearOperators.jl@6356eb3 for Julia 0.4 compatibility. The main change involved removing the use of Nothing to indicate missing operations. In order to play well with both 0.3 and 0.4, all that needs to be changed is:

  1. require and import Compat
  2. change constructs like
Alinop = LinearOperator(size(A,1), size(A,2), T, false, false,
                        v -> At_mul_B!(1.0,A,v,0.0,x),
                        nothing,
                        v -> At_mul_B!(1.0,A,v,0.0,x))

to

Alinop = LinearOperator(size(A,1), size(A,2), T, false, false,
                        v -> At_mul_B!(1.0,A,v,0.0,x),
                        Nullable{Function}(),
                        v -> At_mul_B!(1.0,A,v,0.0,x))

(e.g., in https://github.com/lruthotto/KrylovMethods.jl/blob/master/src/cg.jl#L7).

Note that there is a simplified constructor for real symmetric operators:

Alinop = LinearOperator(size(A,1), T, v -> At_mul_B!(1.0,A,v,0.0,x))

One of the symmetric and hermitian flags should probably be set to true in your CG. Something like

Alinop = LinearOperator(size(A,1), size(A,2), T, T <: Real, (T <: Complex) && !(T <: Real),
                        v -> At_mul_B!(1.0,A,v,0.0,x),
                        Nullable{Function}(),
                        v -> At_mul_B!(1.0,A,v,0.0,x))

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