inst/tinytest/test-normalizeConstraints.R

library(quadprogXT)

Amat <- cbind(diag(3), rep(11, 3))
diag(Amat) <- 1:3

Anorm <- quadprogXT:::normalizeConstraints(Amat, bvec = rep(3, 4))
expect_true(
    all.equal(colSums(Anorm$Amat ^ 2), rep(1, ncol(Amat))),
    info = "column sums of A ^ 2 are equal to 1"
)

Amat[ , 1] <- 0
expect_error(
    quadprogXT:::normalizeConstraints(Amat, bvec = rep(3, 4)),
    info = "column sums of A ^ 2 are equal to 1"
)

Try the quadprogXT package in your browser

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

quadprogXT documentation built on Jan. 28, 2020, 5:10 p.m.