R/construct_M.R

Defines functions construct_M

Documented in construct_M

#' Construct the initial matrix M (satisfying the form of Matrix (8))
#'
#' @param n Parameter, final order is 4n
#' @param a11 Parameters from the lemma, must satisfy d12 + d21 = d22
#' @param d1 Parameters from the lemma, must satisfy d12 + d21 = d22
#' @param d2 Parameters from the lemma, must satisfy d12 + d21 = d22
#' @param d12 Parameters from the lemma, must satisfy d12 + d21 = d22
#' @param d21 Parameters from the lemma, must satisfy d12 + d21 = d22
#' @param d22 Parameters from the lemma, must satisfy d12 + d21 = d22
#'
#' @return 4n x 4n matrix
#' @export

construct_M <- function(n, a11, d1, d2, d12, d21, d22) {
  A11 <- generate_A11(n, a11, d1, d2)
  E <- matrix(1, nrow = 2 * n, ncol = 2 * n)

  top    <- cbind(A11, A11 + d12 * E)
  bottom <- cbind(A11 + d21 * E, A11 + d22 * E)
  M <- rbind(top, bottom)
  M
}

Try the YangHuiMagic package in your browser

Any scripts or data that you put into this service are public.

YangHuiMagic documentation built on March 23, 2026, 5:07 p.m.