TriangularArray class
Triangular arrays.
A triangular array behaves like a matrix with the structure
x x x x x x x x x x x x x x x
and all other elements omitted. This structure appears naturally in the representation of a vine copula model and related algorithms. Each row corresponds to one tree in the vine, starting from the top. In each tree (=row), each column represents an edge.
For truncated vine models the last few trees are omitted. For example, a 3-truncated version of the above array contains the elements
x x x x x x x x x x x x
Only the elements indicated by xs are stored and can be accessed.
The data structure is templated and any type or class can be used to fill the entries (xs) of the triangular array.
Constructors, destructors, conversion operators
-
TriangularArray(size_
t d) explicit - Construct a triangular array of dimension
d. -
TriangularArray(size_
t d, size_ t trunc_lvl) - Construct a truncated triangular array.
- TriangularArray(const std::vector<std::vector<T>>& rows) explicit
- Construct a truncated triangular array from nested vector.
Public functions
-
auto operator()(size_
t row, size_ t column) -> T& - Access one element of the trapezoid (writable).
-
auto operator()(size_
t row, size_ t column) const -> T - Access one element of the trapezoid (non-writable).
- auto operator==(const TriangularArray<T>& rhs) const -> bool
- Equality operator to compare two TriangularArray objects.
- auto operator<(const TriangularArray<T>& rhs) const -> bool
- Lexicographic comparison operator for sorting.
-
auto truncate(size_
t trunc_lvl) -> void - Truncates the trapezoid. If the trapezoid is already truncated at a level less than
trunc_lvl, the function does nothing. -
auto get_trunc_lvl() const -> size_
t - Gets the truncation level of the underlying vine..
-
auto get_dim() const -> size_
t - Gets the dimension of the underlying vine (the matrix has
d-1columns and.min(trunv_lvl, d-1)rows). - auto str() const -> std::string
- represent triangular array as a string.
Function documentation
vinecopulib:: TriangularArray<_1>:: TriangularArray(size_ t d) explicit
Construct a triangular array of dimension d.
| Parameters | |
|---|---|
| d | The dimension of the underlying vine. |
The array has d-1 columns and d-1 rows.
vinecopulib:: TriangularArray<_1>:: TriangularArray(size_ t d,
size_ t trunc_lvl)
Construct a truncated triangular array.
| Parameters | |
|---|---|
| d | The dimension of the vine. |
| trunc_lvl | The truncation level. |
The array has d-1 columns and min(trunc_lvl, d-1) rows.
vinecopulib:: TriangularArray<_1>:: TriangularArray(const std::vector<std::vector<T>>& rows) explicit
Construct a truncated triangular array from nested vector.
| Parameters | |
|---|---|
| rows | A vector of rows; the length of the first row defines the dimension of the triangular array. The number of rows defines the truncation level. |
An arrax of dimension d has d-1 columns and min(trunc_lvl, d-1) rows.
bool vinecopulib:: TriangularArray<_1>:: operator==(const TriangularArray<T>& rhs) const
Equality operator to compare two TriangularArray objects.
| Parameters | |
|---|---|
| rhs | Right-hand-side of the equality operator. |