Skip to content

Commit

Permalink
more doc updates and small GKL bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Jan 20, 2022
1 parent f6f82b4 commit 057677f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion docs/src/man/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ whereas the inverse calculation is obtained as
KrylovKit.unproject!
```

Finally, an orthonormal basis can be transformed using a rank-1 update using
An orthonormal basis can be transformed using a rank-1 update using
```@docs
KrylovKit.rank1update!
```

Note that this changes the subspace. A mere rotation of the basis, which does not change
the subspace spanned by it, can be computed using

```@docs
KrylovKit.basistransform!
```

## Dense linear algebra

KrylovKit relies on Julia's `LinearAlgebra` module from the standard library for most of its
Expand Down
2 changes: 1 addition & 1 deletion src/factorizations/gkl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function initialize!(iter::GKLIterator, state::GKLFactorization; verbosity::Int
αs = empty!(state.αs)
βs = empty!(state.βs)

u = mul!(V[1], iter.u₀, 1 / norm(iter.u₀))
u = mul!(U[1], iter.u₀, 1 / norm(iter.u₀))
v = iter.operator(u, true)
α = norm(v)
rmul!(v, 1 / α)
Expand Down
14 changes: 14 additions & 0 deletions src/orthonormal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ end
return b
end

"""
basistransform!(b::OrthonormalBasis, U::AbstractMatrix)
Transform the orthonormal basis `b` by the matrix `U`. For `b` an orthonormal basis,
the matrix `U` should be real orthogonal or complex unitary; it is up to the user to ensure
this condition is satisfied. The new basis vectors are given by
```
b[j] ← b[i] * U[i,j]
```
and are stored in `b`, so the old basis vectors are thrown away. Note that, by definition,
the subspace spanned by these basis vectors is exactly the same.
"""
function basistransform!(b::OrthonormalBasis{T}, U::AbstractMatrix) where {T} # U should be unitary or isometric
if T <: AbstractArray && IndexStyle(T) isa IndexLinear && Threads.nthreads() > 1
return basistransform_linear_multithreaded!(b, U)
Expand Down

0 comments on commit 057677f

Please sign in to comment.