Skip to content

Commit 5308cb1

Browse files
committed
document and test colleague_matrix
1 parent 8f83390 commit 5308cb1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ the latter case, `c(y)` returns a vector of interpolants, and one can use `chebj
3232
to compute the tuple `(c(y), J(y))` of the interpolant and its Jacobian matrix at `y`.
3333

3434
There is also a function `roots(c)` to return an array of the real roots of `c` on the interval `[lb, ub]`,
35-
computed efficiently by a ["colleague"-matrix method (combined with recursive domain decomposition)](https://epubs.siam.org/doi/10.1137/1.9781611975949.ch18).
35+
computed efficiently by a ["colleague"-matrix method (combined with recursive domain decomposition)](https://epubs.siam.org/doi/10.1137/1.9781611975949.ch18). One can also obtain the colleague matrix (whose eigenvalues are the roots)
36+
directly via `colleague_matrix(c)` (which can be useful to examine complex roots and roots slightly outside `[lb, ub]`).
3637

3738
### Regression from arbitrary points
3839

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Random.seed!(314159) # make chainrules tests deterministic
2929
@test roots(chebinterp(x -> x - 0.1, 10, 0,1)) [0.1]
3030
@test roots(chebinterp(x -> (x - 0.1)*(x-0.2), 10, 0,1)) [0.1, 0.2]
3131
@test roots(chebinterp(cos, 10000, 0, 1000))/pi (0:317) .+ T(0.5)
32+
@test colleague_matrix(chebinterp(x -> (x - 0.1)*(x-0.2), 10, 0,1)) T[0.5 -0.24; 0.5 -0.2]
3233
end
3334
end
3435

0 commit comments

Comments
 (0)