Title: Algebraic Operations and Visualisation for Hl-Rhotrices
Version: 0.1.0
Date: 2026-04-17
Maintainer: Fabio M. Correa <fmcron@protonmail.com>
Description: Provides constructors for hl-rhotrices of dimension 2, 4 and 6, together with computation of the determinant, adjoint, inverse and eigenvalues under the Robust Multiplication Method (RMM). A 'ggplot2'-based function visualises the rhomboidal layout and the decomposition into principal minors.
Author: Fabio M. Correa ORCID iD [aut, cre], Abednego O. Isere [aut], Joseph O. Braimah [aut]
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
RoxygenNote: 7.3.1
Depends: R (≥ 4.0.0)
Imports: ggplot2, ggforce, patchwork
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2026-04-17 13:35:00 UTC; fmcron
Repository: CRAN
Date/Publication: 2026-04-21 19:32:29 UTC

Adjoint of an hl-rhotrix

Description

Computes the adjoint following Definitions 3.5 and 3.6. Each minor's adjoint is scaled by the product of determinants of all other minors. The sign of the M2 block follows Remark 3.4.

Usage

adj_hl(rho)

Arguments

rho

An object of class hl_rhotrix.

Value

An object of class hl_rhotrix representing \mathrm{adj}(R).

Examples

A <- make_R4(a11=-2, a21=3, c11=4, a12=1,
             a31=1, c21=2, c12=-1, a13=0,
             a32=1, c22=1, a23=0, a33=3)
adj_hl(A)


Characteristic polynomial of a 2-dimensional hl-rhotrix

Description

Returns the characteristic polynomial \Delta(t) = t^2 + \mathrm{tr}(A)\,t + \det(A)

Usage

char_poly_hl(rho)

Arguments

rho

An object of class hl_rhotrix with dim = 2.

Value

A named list with elements:

coefficients

Named vector c(constant, linear, quadratic) for use with polyroot.

poly_string

Human-readable string of the polynomial.

trace

Trace of the rhotrix.

determinant

Determinant of the rhotrix.

Examples

R <- make_R2(a11 = 5, a21 = 3, a12 = 6, a22 = 2)
char_poly_hl(R)


Determinant of an hl-rhotrix

Description

Computes the determinant under the Robust Multiplication Method (RMM)

\det(R_n) = \det\!\Bigl(\prod_{k} A_{2k}\Bigr) \otimes \det\!\Bigl(\prod_{l} M_{2l}\Bigr)

where the sign of the M2 block is -1 when there is exactly one M2 minor, and +1 otherwise.

Usage

det_hl(rho)

Arguments

rho

An object of class hl_rhotrix.

Value

A numeric scalar.

Examples

A <- make_R4(a11=-2, a21=3, c11=4, a12=1,
             a31=1, c21=2, c12=-1, a13=0,
             a32=1, c22=1, a23=0, a33=3)
det_hl(A)   # -36

R <- make_R2(a11=5, a21=3, a12=6, a22=2)
det_hl(R)   # -8


Eigenvalues of a 2-dimensional hl-rhotrix

Description

Computes the eigenvalues as roots of the characteristic polynomial \Delta(t) = t^2 + \mathrm{tr}(A)\,t + \det(A) = 0

Usage

eigenvalues_hl(rho)

Arguments

rho

An object of class hl_rhotrix with dim = 2.

Value

A numeric or complex vector of length 2.

Examples


R <- make_R2(a11 = 5, a21 = 3, a12 = 6, a22 = 2)
eigenvalues_hl(R)   # -8 and 1


Eigenvalues of a high-dimensional hl-rhotrix (per R2 minor)

Description

Applies eigenvalues_hl to each principal R2 minor of a high hl-rhotrix. As noted in the manuscript's concluding remarks, the computation of eigenvalues for high hl-rhotrices using the basal R2 is an open research direction.

Usage

eigenvalues_hl_high(rho)

Arguments

rho

An object of class hl_rhotrix (any dimension).

Value

A list; each element is a list with minor (name) and eigenvalues (length-2 vector) for one R2 minor.

Examples

A <- make_R4(a11=-2, a21=3, c11=4, a12=1,
             a31=1, c21=2, c12=-1, a13=0,
             a32=1, c22=1, a23=0, a33=3)
eigenvalues_hl_high(A)


Inverse of an hl-rhotrix

Description

Computes R^{-1} = \frac{1}{\det(R)} \cdot \mathrm{adj}(R)

Usage

inv_hl(rho)

Arguments

rho

An object of class hl_rhotrix.

Value

An object of class hl_rhotrix representing R^{-1}.

Examples

A <- make_R4(a11=-2, a21=3, c11=4, a12=1,
             a31=1, c21=2, c12=-1, a13=0,
             a32=1, c22=1, a23=0, a33=3)
inv_hl(A)


Create a 2-dimensional hl-rhotrix

Description

Constructs the basal hl-rhotrix of dimension 2:

\begin{pmatrix} a_{11} \\ a_{21} \quad a_{12} \\ a_{22} \end{pmatrix}

Usage

make_R2(a11, a21, a12, a22)

Arguments

a11

Top entry (diagonal / vertical axis).

a21

Left entry (symmetric).

a12

Right entry (symmetric).

a22

Bottom entry (diagonal / vertical axis).

Value

An object of class hl_rhotrix with dim = 2.

References

Isere (2018). Even Dimensional Rhotrix. Notes on Number Theory and Discrete Mathematics, 24(2), 125-133.

Examples

R <- make_R2(a11 = 5, a21 = 3, a12 = 6, a22 = 2)
det_hl(R)       # -8
eigenvalues_hl(R)  # -8 and 1


Create a 4-dimensional hl-rhotrix

Description

Constructs a 4-dimensional hl-rhotrix in the rhomboidal layout:

       a11
    a21  c11  a12
 a31  c21  c12  a13
    a32  c22  a23
       a33

The rhotrix is decomposed into two principal R2 minors (A21, A22) and one M2 minor matrix (M21) following Theorem 3.1.

Usage

make_R4(a11, a21, c11, a12, a31, c21, c12, a13, a32, c22, a23, a33)

Arguments

a11, a33

Outer diagonal entries.

a21, a12

First-layer symmetric entries.

c11, c22

Inner diagonal entries (second R2 minor).

a31, a13

Second-layer symmetric entries (first R2 minor).

c21, c12

Inner symmetric entries (second R2 minor).

a32, a23

Third-layer symmetric entries (M2 minor).

Value

An object of class hl_rhotrix with dim = 4.

Examples

A <- make_R4(
  a11 = -2,
  a21 =  3, c11 = 4,  a12 = 1,
  a31 =  1, c21 = 2,  c12 = -1, a13 = 0,
  a32 =  1, c22 = 1,  a23 = 0,
  a33 =  3
)
det_hl(A)   # -36


Create a 6-dimensional hl-rhotrix

Description

Constructs a 6-dimensional hl-rhotrix in the rhomboidal layout (see Theorem 3.3 of the manuscript). Decomposed into three principal R2 minors (A21, A22, A23) and three M2 minor matrices (M21, M22, M23).

Usage

make_R6(
  a11,
  a21,
  c11,
  a12,
  a31,
  c21,
  a22,
  c12,
  a13,
  a41,
  c31,
  a32,
  a23,
  c13,
  a14,
  a42,
  c32,
  a33,
  c23,
  a24,
  a43,
  c33,
  a34,
  a44
)

Arguments

a11, a44

Outermost diagonal entries.

a21, a12, a41, a14

First and fourth layer symmetric entries.

c11, c33

Outer diagonal entries of the second R2 minor.

a31, a13, a42, a24

Second R2 minor symmetric entries.

c21, c12, c31, c13

Outer symmetric entries of the second R2 minor.

a22, a33

Inner diagonal entries of the third R2 minor.

a32, a23

Inner symmetric entries of the third R2 minor.

c32, c23

Inner symmetric entries of the third M2 minor.

a43, a34

Fifth-layer symmetric entries (second M2 minor).

Value

An object of class hl_rhotrix with dim = 6.

Examples

R6 <- make_R6(
  a11=1, a21=2, c11=3, a12=4,
  a31=5, c21=6, a22=7, c12=8, a13=9,
  a41=2, c31=3, a32=4, a23=5, c13=6, a14=7,
  a42=1, c32=2, a33=3, c23=4, a24=5,
  a43=6, c33=7, a34=8, a44=9
)
det_hl(R6)  # 15360


Rhomboidal layout diagram of an hl-rhotrix

Description

Produces a publication-quality ggplot diagram showing the rhomboidal structure of an hl-rhotrix of dimension 2, 4 or 6. Nodes and regions are colour-coded by minor membership:

Usage

plot_rhombus_gg(
  dim,
  gap = 1,
  node_r = 0.28,
  show_labels = TRUE,
  show_regions = TRUE,
  show_minor_labels = TRUE,
  show_legend = TRUE,
  show_edges = TRUE,
  title = NULL,
  subtitle = NULL,
  base_size = 11
)

Arguments

dim

Integer. Dimension of the hl-rhotrix: 2, 4 or 6.

gap

Numeric. Spacing between node centres (default 1).

node_r

Numeric. Radius of each node circle (default 0.28).

show_labels

Logical. Display entry labels inside nodes using plotmath subscript notation (default TRUE).

show_regions

Logical. Draw dashed bounding rectangles around each minor (default TRUE).

show_minor_labels

Logical. Label each minor region with its name (default TRUE).

show_legend

Logical. Display the colour legend below the diagram (default TRUE).

show_edges

Logical. Draw connector lines between nodes of the same minor (default TRUE).

title

Character. Plot title. NULL for no title.

subtitle

Character. Plot subtitle. NULL for no subtitle.

base_size

Numeric. Base font size (default 11).

Details

The function returns a standard ggplot object. Use ggplot2::ggsave() to export to PDF, PNG, SVG or EPS.

Value

A ggplot object.

Examples

library(ggplot2)

# Dimension 2
plot_rhombus_gg(2)

# Dimension 4 with title
p <- plot_rhombus_gg(4,
  title    = "4-dimensional hl-rhotrix",
  subtitle = "R2 minors (blue) and M2 matrices (amber)")
print(p)

# Dimension 6
plot_rhombus_gg(6, gap = 1.1, node_r = 0.26)


# Three-panel figure using patchwork
library(patchwork)
plot_rhombus_gg(2) + plot_rhombus_gg(4) + plot_rhombus_gg(6)



Print method for hl_rhotrix

Description

Print method for hl_rhotrix

Usage

## S3 method for class 'hl_rhotrix'
print(x, digits = 4, ...)

Arguments

x

An object of class hl_rhotrix.

digits

Number of significant digits (default 4).

...

Ignored.

Value

Invisibly returns x.


Summary of an hl-rhotrix with all computed invariants

Description

Prints the hl-rhotrix structure together with its determinant, adjoint, inverse and eigenvalues.

Usage

summary_hl(rho)

Arguments

rho

An object of class hl_rhotrix.

Value

Invisibly returns a list with det, adj, inv and eigenvalues.

Examples

A <- make_R4(a11=-2, a21=3, c11=4, a12=1,
             a31=1, c21=2, c12=-1, a13=0,
             a32=1, c22=1, a23=0, a33=3)
summary_hl(A)


Trace of a 2-dimensional hl-rhotrix

Description

The trace is the sum of entries along the vertical axis (i.e., a_{11} + a_{22}).

Usage

trace_hl(rho)

Arguments

rho

An object of class hl_rhotrix with dim = 2.

Value

A numeric scalar.

Examples

R <- make_R2(a11 = 5, a21 = 3, a12 = 6, a22 = 2)
trace_hl(R)  # 7