RVineTrees class
A list-of-trees decomposition of an R-vine structure.
The vine is stored as one edge list per tree. Each edge holds its conditioned pair (a, b), its conditioning set C, and (optionally) the fitted pair-copula. The class converts to and from the (order, struct_array) representation used by RVineStructure, validating the proximity condition on the way back. It is the shared primitive behind Vinecop:: and the structure finalization during selection.
The orientation convention is that an edge's pair-copula has its first argument aligned with the conditioned variable a; a copula is therefore flipped iff the variable placed on the matrix diagonal differs from a.
Public types
- struct AugmentedEdge
- One edge of the augmented (line-graph) view: its two incident node ids plus a non-owning pointer to the underlying
Edge(intrees_). - struct AugmentedTree
- The augmented (line-graph) view of a tree used during conversion.
degreesis indexed by node id (contiguous), avoiding astd::map. - struct Decomposition
- The result of
to_.struct_ array() - struct Edge
- A single edge: conditioned pair
(a, b), conditioning setC, and the associated pair-copula (independence by default). - struct PairCopulaLocation
- The source of a pair copula in a matrix representation.
- using Tree = std::vector<Edge>
-
using DiagonalPolicy = std::function<size_
t(size_ t col, const std::vector<std::vector<size_ t>>&leaf_ edges)> - Chooses which variable sits on the diagonal of a given column.
Public static functions
- static auto default_diagonal_policy() -> DiagonalPolicy
- The default diagonal policy: the
conditioned[0](first) leaf endpoint of the first leaf edge. It is flip-free — each edge stores its pair copula aligned toconditioned[0], so placing that endpoint on the diagonal needs no flip — and it is the convention shared byselect()finalization and theRVineStructureround-trip.
Constructors, destructors, conversion operators
- RVineTrees()
-
RVineTrees(const std::vector<size_
t>& order, const TriangularArray<size_ t>& struct_array) explicit - Builds the tree list from an
(order, struct_array)representation. -
RVineTrees(const std::vector<size_
t>& order, const TriangularArray<size_ t>& struct_array, const std::vector<std::vector<Bicop>>& pair_copulas) - Builds the tree list, attaching pair-copulas to each edge.
-
RVineTrees(size_
t d, std::vector<Tree> trees) - Builds directly from a list of trees (edges carry their pair-copula).
Public functions
- auto get_trees() const -> const std::vector<Tree>&
-
auto to_struct_array(const DiagonalPolicy& diagonal_policy = default_
diagonal_ policy()) const -> Decomposition - Converts back to matrix form, choosing diagonals with
diagonal_policy(default:default_) and carrying/flipping the pair-copulas.diagonal_ policy() -
auto to_struct_array_map(const DiagonalPolicy& diagonal_policy = default_
diagonal_ policy()) const -> Decomposition - Converts back to matrix form without copying pair copulas.
-
auto get_dim() const -> size_
t -
auto get_trunc_lvl() const -> size_
t
Typedef documentation
using vinecopulib:: RVineTrees:: DiagonalPolicy = std::function<size_ t(size_ t col, const std::vector<std::vector<size_ t>>&leaf_ edges)>
Chooses which variable sits on the diagonal of a given column.
Called with the column index and, for each leaf edge of the current top tree (in iteration order), the variables that may go on the diagonal (its leaf endpoints, 1 or 2 of them). Must return one of them.
Function documentation
static DiagonalPolicy vinecopulib:: RVineTrees:: default_diagonal_policy()
The default diagonal policy: the conditioned[0] (first) leaf endpoint of the first leaf edge. It is flip-free — each edge stores its pair copula aligned to conditioned[0], so placing that endpoint on the diagonal needs no flip — and it is the convention shared by select() finalization and the RVineStructure round-trip.
The default diagonal policy: the conditioned[0] (first) leaf endpoint of the first leaf edge — flip-free, and shared by select() finalization and the RVineStructure round-trip.
vinecopulib:: RVineTrees:: RVineTrees(const std::vector<size_ t>& order,
const TriangularArray<size_ t>& struct_array) explicit
Builds the tree list from an (order, struct_array) representation.
| Parameters | |
|---|---|
| order | The variable order (diagonal of the R-vine matrix). |
| struct_array | The structure array, labeled consistently with order. |
vinecopulib:: RVineTrees:: RVineTrees(const std::vector<size_ t>& order,
const TriangularArray<size_ t>& struct_array,
const std::vector<std::vector<Bicop>>& pair_copulas)
Builds the tree list, attaching pair-copulas to each edge.
| Parameters | |
|---|---|
| order | The variable order (diagonal of the R-vine matrix). |
| struct_array | The structure array, labeled consistently with order. |
| pair_copulas | The pair-copulas, indexed [tree][edge]; each is stored with its first argument aligned to the diagonal variable order[edge]. If empty, every edge is independence; otherwise it must cover every tree of struct_array. |
vinecopulib:: RVineTrees:: RVineTrees(size_ t d,
std::vector<Tree> trees)
Builds directly from a list of trees (edges carry their pair-copula).
| Parameters | |
|---|---|
| d | The dimension of the vine. |
| trees | One edge list per tree; trees[t] must have d - 1 - t edges for a valid vine (validated on conversion, not here). |
Decomposition vinecopulib:: RVineTrees:: to_struct_array(const DiagonalPolicy& diagonal_policy = default_ diagonal_ policy()) const
Converts back to matrix form, choosing diagonals with diagonal_policy (default: default_) and carrying/flipping the pair-copulas.
| Parameters | |
|---|---|
| diagonal_policy | Chooses which leaf variable sits on each column's diagonal (see DiagonalPolicy). |
Converts back to matrix form, choosing diagonals with a policy and carrying (flipping) the pair-copulas.