inst/tinytest/test-convertToCompact.R

library(quadprogXT)

Amat <- matrix(c(-4,-3,0,2,1,0,0,-2,1),3,3)
AindCompact <- rbind(c(2,2,2),c(1,1,2),c(2,2,3))
AmatCompact <- rbind(c(-4,2,-2),c(-3,1,1))

expect_equal(
    convertToCompact(Amat), list(Amat = AmatCompact, Aind = AindCompact),
    info = "Conversion to compact program yields same results as quadprog example"
)

expect_error(
    convertToCompact(Amat * 0),
    info = "Conversion to compact program fails when there is > 0 columns of all 0s"
)

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.