inst/tinytest/test_unimodular.R

# Totally unimodular matrix, reduces to nothing

## total unimodularity detection
  
  A <- matrix(c(
   1,1,0,0,0,
   -1,0,0,1,0,
   0,0,01,1,0,
   0,0,0,-1,1),nrow=5)
  expect_true(is_totally_unimodular(A))
  
  # Totally unimodular matrix, by Heller-Tompson criterium
  A <- matrix(c(
   1,1,0,0,
   0,0,1,1,
   1,0,1,0,
   0,1,0,1),nrow=4)
  expect_true(is_totally_unimodular(A))
  
  # Totally unimodular matrix, by Raghavachari recursive criterium
  A <- matrix(c(
      1,1,1,
      1,1,0,
      1,0,1))
  expect_true(is_totally_unimodular(A))

Try the lintools package in your browser

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

lintools documentation built on Jan. 17, 2023, 1:06 a.m.