tests/testthat/test-determinant.R

test_that("Singular Matrix",{
  P<-matrix(c(0,4,2,0,3,7,0,2,1,0,4,4),4,3,TRUE)
  expect_warning(tdets(P), "Not a Square Matrix!")
})

test_that("Max-Tropical Determinant",{
  P<-matrix(c(0,4,2,0,3,7,0,2,1),3,3,TRUE)
  D<-lp.assign(P,direction = 'max')
  expect_equal(tdets(P)[[1]], D$objval)
})

test_that("Min-Tropical Determinant",{
  P<-matrix(c(0,4,2,0,3,7,0,6,1),3,3,TRUE)
  D<-lp.assign(P)
  expect_equal(tdets(P,tadd=min)[[1]], D$objval)
})

Try the TML package in your browser

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

TML documentation built on Sept. 11, 2024, 6:19 p.m.