Skip to contents

make_cross_kernel() builds the block relatedness matrix for the C0 coevolution prototype. It builds a correlation-scale positive-semidefinite matrix K_star = rbind(cbind(A_H, C_HP), cbind(t(C_HP), A_P)), where A_H and A_P are within-lineage relatedness matrices and C_HP is the cross-lineage bridge induced by the association matrix W. The intended route is a prototype: pass K_star through the existing phylo_latent(..., vcv = K_star, unique = TRUE) engine. The generic kernel_*() surface and the validated extract_Gamma() coevolution gate are documented separately; this helper only builds the input kernel.

Usage

make_cross_kernel(A_H, A_P, W, rho = 0.5, eps = 1e-08)

Arguments

A_H, A_P

Numeric square correlation matrices for the host and partner lineages. Both must be symmetric, positive semidefinite, and have unit diagonal.

W

Numeric association matrix with nrow(W) == nrow(A_H) and ncol(W) == nrow(A_P). If W has row or column names, they are aligned to A_H / A_P names before the kernel is built.

rho

Scalar bridge strength in [-1, 1]. Larger absolute values put more covariance in the off-diagonal host-partner block.

eps

Positive numerical floor used when taking symmetric square roots and scaling an all-zero or near-zero W.

Value

A numeric correlation matrix with the host block first and the partner block second. The matrix carries lightweight metadata for downstream extractors, including the fixed rho used to build the host-partner bridge.

Examples

A_H <- matrix(c(
  1.0, 0.3, 0.1,
  0.3, 1.0, 0.2,
  0.1, 0.2, 1.0
), 3, 3, byrow = TRUE)
A_P <- matrix(c(1.0, 0.25, 0.25, 1.0), 2, 2)
W <- matrix(c(1, 0, 0.5, 0, 1, 0.25), 3, 2, byrow = TRUE)
K_star <- make_cross_kernel(A_H, A_P, W, rho = 0.4)
min(eigen(K_star, symmetric = TRUE, only.values = TRUE)$values)
#> [1] 0.5732877