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

Updates in LinearOperators #2

Open
dpo opened this issue Apr 20, 2015 · 0 comments
Open

Updates in LinearOperators #2

dpo opened this issue Apr 20, 2015 · 0 comments

Comments

@dpo
Copy link

dpo commented Apr 20, 2015

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))
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

No branches or pull requests

1 participant