Skip to content

Commit

Permalink
merge fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jarlebring committed Jun 28, 2023
2 parents 7bd3f79 + ee4e0a2 commit eacb5e9
Show file tree
Hide file tree
Showing 91 changed files with 1,413 additions and 407 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.7' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
continue-on-error: ${{ matrix.version == 'nightly' }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
# docs:
# name: Documentation
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: julia-actions/setup-julia@v1
# with:
# version: '1'
# - run: |
# julia --project=docs -e '
# using Pkg
# Pkg.develop(PackageSpec(path=pwd()))
# Pkg.instantiate()'
# - run: |
# julia --project=docs -e '
# using Documenter: doctest
# using NonlinearEigenproblems
# doctest(NonlinearEigenproblems)' # change MYPACKAGE to the name of your package
# - run: julia --project=docs docs/make.jl
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
26 changes: 26 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CompatHelper

on:
schedule:
- cron: '00 * * * *'
issues:
types: [opened, reopened]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
27 changes: 27 additions & 0 deletions .github/workflows/documenter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Documentation

on:
push:
branches:
- master # update to match your development branch (master, main, dev, trunk, ...)
tags: '*'
pull_request:

jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1.7'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
PYTHON: ""
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
run: julia --project=docs/ docs/make.jl
14 changes: 7 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "NonlinearEigenproblems"
uuid = "067cfa3b-fa88-53b2-a873-5b23b3a16e31"
version = "1.0.2"
version = "1.1.0"

[deps]
ArnoldiMethod = "ec485272-7323-5ecc-a04f-4719b315124d"
Expand All @@ -20,11 +20,11 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"

[compat]
ArnoldiMethod = "^0"
ArnoldiMethod = "^0.2"
FFTW = "^1"
IterativeSolvers = "^0"
LinearMaps = "^2"
Polynomials = "^0"
Reexport = "^0"
SpecialFunctions = "^0"
IterativeSolvers = "^0.9"
LinearMaps = "^2, ^3"
Polynomials = "^1, ^3"
Reexport = "^1"
SpecialFunctions = "^1, ^2"
julia = "^1"
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# NEP-PACK

[![Build Status](https://img.shields.io/travis/nep-pack/NonlinearEigenproblems.jl.svg)](https://travis-ci.org/nep-pack/NonlinearEigenproblems.jl)
[![codecov](https://img.shields.io/codecov/c/github/nep-pack/NonlinearEigenproblems.jl.svg?label=codecov)](https://codecov.io/gh/nep-pack/NonlinearEigenproblems.jl)
[![CI](https://github.com/nep-pack/NonlinearEigenproblems.jl/workflows/CI/badge.svg)](https://github.com/nep-pack/NonlinearEigenproblems.jl/actions?query=workflow%3ACI)
[![Codecov](https://codecov.io/gh/nep-pack/NonlinearEigenproblems.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/nep-pack/NonlinearEigenproblems.jl)


A nonlinear eigenvalue problem is the problem to determine a scalar *λ* and a vector *v* such that
*<p align="center">M(λ)v=0</p>*
where *M* is an *nxn*-matrix depending on a parameter. This package aims to provide state-of-the-art algorithms to solve this problem, as well as a framework to formulate applications and easy access to benchmark problems. This currently includes (but is not restricted to) Newton-type methods, Subspace methods, Krylov methods, contour integral methods, block methods, companion matrix approaches. Problem transformation techniques such as scaling, shifting, deflating are also natively supported by the package.
where *M* is an *nxn*-matrix depending on a parameter. This package aims to provide state-of-the-art algorithms to solve this problem, as well as a framework to formulate applications and easy access to benchmark problems. This currently includes (but is not restricted to) Newton-type methods, Subspace methods, Krylov methods, contour integral methods, block methods, companion matrix approaches. Problem transformation techniques such as scaling, shifting, deflating are also natively supported by the package.


# How to use it?

On Julia 1.X and Julia 0.7, install it as a registered package by typing `] add ...` at the REPL-prompt:
On Julia 1.X, install it as a registered package by typing `] add ...` at the REPL-prompt:
```
julia> ]
(v1.0) pkg> add NonlinearEigenproblems
Expand All @@ -31,19 +32,20 @@ julia> ]
```
## NEP solvers

Features and solvers (see documentation https://nep-pack.github.io/NonlinearEigenproblems.jl/methods/ for further information and references):
Features and solvers (see documentation https://nep-pack.github.io/NonlinearEigenproblems.jl/methods/ for further information and references):

* Arnoldi/Krylov type
* NLEIGS
* Infinite Arnoldi method: (iar)
* Tensor infinite Arnoldi method (tiar)
* Infinite bi-Lanczos (infbilanczos)
* Infinite Lanczos (ilan)
* AAA CORK (AAAeigs)
* Projection methods
* Jacobi-Davidson (jd_effenberger)
* Jacobi-Davidson (jd_betcke)
* Nonlinear Arnoldi method (nlar)
* Common Rayleigh-Ritz projection interface
* Common Rayleigh-Ritz projection interface
* Contour integral methods
* Beyn's contour integral method
* Block SS (Higher moments) contour integral method of Asakura & Sakurai
Expand All @@ -63,11 +65,11 @@ Features and solvers (see documentation https://nep-pack.github.io/NonlinearEige
* Companion form for Chebyshev polynomials
* Other
* Chebyshev interpolation
* Transformations
* Transformations
* Rayleigh-Ritz (`ProjNEP` and `inner_solve`)
* Problem gallery (including access to the NLEVP-gallery)
* Deflation (Effenberger style)


# Development

Expand Down
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004"
NonlinearEigenproblems = "067cfa3b-fa88-53b2-a873-5b23b3a16e31"
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ makedocs(
)


#deploydocs(
# repo = "github.com/nep-pack/NonlinearEigenproblems.jl.git",
deploydocs(
repo = "github.com/nep-pack/NonlinearEigenproblems.jl.git",
# target = "build",
#)
)
31 changes: 17 additions & 14 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ julia> resnorm=norm(compute_Mlincomb(nep,λ,v))
5.178780131881974e-13
```
Information about the gallery can be found by typing `?nep_gallery`.
The second arument in the call to `nep_gallery` is a problem parameter,
The second argument in the call to `nep_gallery` is a problem parameter,
in this case specifying that the size of the problem should be `100`.
The example solves the problem with the NEP-algorithm [`MSLP`](methods.md#NonlinearEigenproblems.NEPSolver.mslp).
The parameter `tol` specifies the
Expand Down Expand Up @@ -133,20 +133,23 @@ with the [infinite Arnoldi method](methods.md#NonlinearEigenproblems.NEPSolver.i
julia> λ,V=iar_chebyshev(dep,maxit=100); # This takes some time the first time is run due to JIT-compiler
```
The figure in a demo of DDE-BIFTOOL <http://ddebiftool.sourceforge.net/demos/neuron/html/demo1_stst.html#3> can be directly generated by
```@example
using PyPlot
# Hardcoded/cached values in the documentation compilation # hide


```@setup neuron
using Gadfly
set_default_plot_size(12cm, 12cm)
```

```@example neuron
using Gadfly
λ=[ -0.09712795241565722 + 2.612885243197631e-19im # hide
0.30886599775839135 + 4.146563548756125e-18im # hide
-0.45584765486526174 + 1.6884551234089458im # hide
-0.4558476548652613 - 1.6884551234089418im # hide
-0.8832708076887316 + 5.325050575287575im # hide
-0.8832708076887288 - 5.3250505752875625im] # hide
plot(real(λ),imag(λ),"*");
xlabel("real(λ)"); ylabel("imag(λ)");
savefig("neuron_eigvals.svg"); nothing # hide
plot(x=real.(λ),y=imag.(λ), Guide.xlabel("real(λ)"), Guide.ylabel("imag(λ)"))
```
![](neuron_eigvals.svg)

!!! tip
This problem is also available in the `Gallery` by calling `dep=nep_gallery("neuron0")`. Most of the NEPs constructed in the tutorials are also available in corresponding gallery problems. See all gallery problems under [NEP Gallery](gallery.md). In particular, note that the problems in the Berlin-Manchester collection of problems NLEVP are also [directly available](gallery.md#Berlin-Manchester-collection-1).
Expand Down Expand Up @@ -224,18 +227,18 @@ julia> (A+B*λ+C*exp(sin(λ/2)))*v
-5.912084880273861e-13 + 0.0im
```
!!! note
The functions `f1`,`f2` and `f3` in the example above have to be defined for scalar values and for matrices (in the [matrix function](https://en.wikipedia.org/wiki/Matrix_function) sense, not elementwise sense). This is the reason `f1` needs to be defined as `one(λ)`, instead of just `1`. Fortunately, many elementary functions in Julia already have matrix function implementations, e.g., `exp([1 2 ; 3 4])` will return the matrix exponential of the given matrix.
The functions `f1`,`f2` and `f3` in the example above have to be defined for scalar values and for matrices (in the [matrix function](https://en.wikipedia.org/wiki/Matrix_function) sense, not elementwise sense). This is the reason `f1` needs to be defined as `one(λ)`, instead of just `1`. Fortunately, many elementary functions in Julia already have matrix function implementations, e.g., `exp([1 2 ; 3 4])` will return the matrix exponential of the given matrix.




## Chebyshev interpolation

In applications, NEP-nonlinearities may be complicated to implement.
Directly using the SPMF-functionality where every function needs to be defined in a
matrix function sense may require too much work.
In this case you may want to use an approximation method to
create a new different NEP object for which the matrix functions are
easy to implement (or directly available in the package).
create a new different NEP object for which the matrix functions are
easy to implement (or directly available in the package).
We illustrate this property with NEP-PACKs Chebyshev interpolation feature.


Expand All @@ -254,7 +257,7 @@ julia> fv[3]=s->besselj(0, s);
julia> Av[3]=[-7.0 -0.0 -9.0; 8.0 3.0 -3.0; 0.0 13.0 2.0]
```
We use `SPMF_NEP` again, but in order to suppress a warning message
indicating that evaluation with a matrix function
indicating that evaluation with a matrix function
is not available we use the keyword `check_consistency=false`.
```julia-repl
julia> nep=SPMF_NEP(Av,fv,check_consistency=false);
Expand Down Expand Up @@ -291,7 +294,7 @@ of the original problem:
julia> norm(compute_Mlincomb(nep,λ,v))
1.148749763351579e-9
```
The function `compute_Mlincomb` returns the evaluation of `M(λ)*v`; see
The function `compute_Mlincomb` returns the evaluation of `M(λ)*v`; see
[the manual section for compute functions](compute_functions.md).

## What now?
Expand Down
6 changes: 6 additions & 0 deletions docs/src/linsolvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ GMRESLinSolverCreator
```@docs
DefaultLinSolverCreator
```
```@docs
DeflatedNEPLinSolver
```
```@docs
DeflatedNEPLinSolverCreator
```

### Advanced usage

Expand Down
5 changes: 5 additions & 0 deletions docs/src/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,16 @@ The Infinite Lanczos method, for symmetric NEPs
ilan
```


### NLEIGS
```@docs
nleigs
```

### AAA-EIGS
```@docs
AAAeigs
```

## Class specific methods

Expand Down
21 changes: 8 additions & 13 deletions docs/src/tutorial_newmethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ on the matrix ``M(λ)``:
```julia
julia> x=normalize(compute_Mder(nep,λ)\ones(size(nep,1)))
5-element Array{Float64,1}:
0.14358324743994907
0.9731847884093298
-0.12527093093249475
0.14358324743994907
0.9731847884093298
-0.12527093093249475
0.031821422867456914
0.12485915894832478
0.12485915894832478
```
The residual norm ``||M(λ)x||`` does indeed become almost zero
so it seems we have a solution:
Expand All @@ -112,7 +112,7 @@ usage of the NEP-PACK method development:
NEP-PACKs logging facility and error estimation.
See [`Logger`](logger.md) and [`Errmeasure`](errmeasure.md). This
gives access
to other ways to measure error as well as a logging and
to other ways to measure error as well as a logging and
inspection of error history in a way that is
the same for all solvers and simplifies
comparisons.
Expand Down Expand Up @@ -149,7 +149,7 @@ function halley(nep::NEP;λ=0.0,δ=sqrt(eps()),maxit=100,
end
```

We can now run our new method using
We can now run our new method using
with a `logger=1` keyword argument
so we get the standardized output of iteration info:
```julia-repl
Expand All @@ -171,8 +171,7 @@ julia> plot(mylogger.errs[1:10,1],yaxis=:log)
```
We clearly observe the superlinear convergence:
```@example
using PyPlot # hide
clf(); # hide
using Gadfly # hide
z=[ 0.08492602120772309 # hide
0.07450867012944977 # hide
0.032639292900081246 # hide
Expand All @@ -181,11 +180,7 @@ z=[ 0.08492602120772309 # hide
1.0638098128402615e-10 # hide
4.942402279980973e-17 # hide
]; # hide
semilogy(z) # hide
grid() # hide
savefig("newmethod_convergence.svg"); nothing # hide
plot(y=z, Scale.y_log10(), Geom.line) # hide
```
![](newmethod_convergence.svg)

![To the top](http://jarlebring.se/onepixel.png?NEPPACKDOC_NEWMETHOD)

Loading

0 comments on commit eacb5e9

Please sign in to comment.