Skip to content

Commit

Permalink
allow for empty blocks in left/right-orth
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvd committed Jan 16, 2021
1 parent 846a68e commit be3dd61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/src/man/tensors.md
Original file line number Diff line number Diff line change
Expand Up @@ -906,13 +906,14 @@ in its image or coimage.
The underlying algorithm used to compute this decomposition can be chosen among `QR()`,
`QRpos()`, `QL()`, `QLpos()`, `SVD()`, `SDD()`, `Polar()`. `QR()` uses the underlying
`qr` decomposition from `LinearAlgebra`, while `QRpos()` (the default) adds a correction
to that to make sure that the diagonal elements of `R` are positive. Both result in
block matrices in `R` which are upper triangular. `QL()` and `QLpos()` similarly result
in a lower triangular block matrices in `R`, but only work if all block matrices are
to that to make sure that the diagonal elements of `R` are positive.
Both result in upper triangular `R`, which are square when `t` is full rank and
surjective otherwise. `QL()` and `QLpos()` similarly result
in a lower triangular matrices in `R`, but only work if all block matrices are
tall, i.e. `blockdim(codomain(t), c) >= blockdim(domain(t), c)` for all `c ∈
blocksectors(t)`. All of these methods assume `t` has full rank.
blocksectors(t)`.

If this is not the case, one can also use `alg = SVD()` or `alg = SDD()`, with extra
One can also use `alg = SVD()` or `alg = SDD()`, with extra
keywords to control the absolute (`atol`) or relative (`rtol`) tolerance. We then set
`Q=U` and `R=Σ*Vʰ` from the corresponding singular value decomposition, where only
these singular values `σ >= max(atol, norm(t)*rtol)` (and corresponding singular vectors
Expand All @@ -932,13 +933,12 @@ in its image or coimage.
The underlying algorithm used to compute this decomposition can be chosen among `LQ()`,
`LQpos()`, `RQ()`, `RQpos()`, `SVD()`, `SDD()`, `Polar()`. `LQ()` uses the underlying
`qr` decomposition from `LinearAlgebra` on the transposed data, and leads to lower
triangular block matrices in `L`; `LQpos()` makes sure the diagonal elements are
positive. `RQ()` and `RQpos()` similarly result in upper triangular block matrices in
triangular matrices in `L`; `LQpos()` makes sure the diagonal elements are
positive. `RQ()` and `RQpos()` similarly result in upper triangular matrices in
`L`, but only works for wide matrices, i.e. `blockdim(codomain(t), c) <=
blockdim(domain(t), c)` for all `c ∈ blocksectors(t)`. All of these methods assume `t`
has full rank.
blockdim(domain(t), c)` for all `c ∈ blocksectors(t)`.

If this is not the case, one can also use `alg = SVD()` or `alg = SDD()`, with extra
One can also use `alg = SVD()` or `alg = SDD()`, with extra
keywords to control the absolute (`atol`) or relative (`rtol`) tolerance. We then set
`L=U*Σ` and `Q=Vʰ` from the corresponding singular value decomposition, where only these
singular values `σ >= max(atol, norm(t)*rtol)` (and corresponding singular vectors in
Expand Down
2 changes: 2 additions & 0 deletions src/tensors/factorizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ function leftorth!(t::TensorMap{<:EuclideanSpace};
Rdata = SectorDict{I, A}()
dims = SectorDict{I, Int}()
for c in blocksectors(domain(t))
isempty(block(t,c)) && continue
Q, R = _leftorth!(block(t, c), alg, atol)
Qdata[c] = Q
Rdata[c] = R
Expand Down Expand Up @@ -350,6 +351,7 @@ function rightorth!(t::TensorMap{<:EuclideanSpace};
Qdata = SectorDict{I, A}()
dims = SectorDict{I, Int}()
for c in blocksectors(codomain(t))
isempty(block(t,c)) && continue
L, Q = _rightorth!(block(t, c), alg, atol)
Ldata[c] = L
Qdata[c] = Q
Expand Down

0 comments on commit be3dd61

Please sign in to comment.