compact: Remove spurious variables and restrictions

View source: R/compact.R

compactR Documentation

Remove spurious variables and restrictions

Description

A system of linear (in)equations can be compactified by removing zero-rows and zero-columns (=variables). Such rows and columns may arise after substitution (see subst_value) or eliminaton of a variable (see eliminate).

Usage

compact(
  A,
  b,
  x = NULL,
  neq = nrow(A),
  nleq = 0,
  eps = 1e-08,
  remove_columns = TRUE,
  remove_rows = TRUE,
  deduplicate = TRUE,
  implied_equations = TRUE
)

Arguments

A

[numeric] matrix

b

[numeric] vector

x

[numeric] vector

neq

[numeric] The first neq rows in A and b are treated as linear equalities.

nleq

[numeric] The nleq rows after neq are treated as inequations of the form a.x<=b. All remaining rows are treated as strict inequations of the form a.x<b.

eps

[numeric] Anything with absolute value < eps is considered zero.

remove_columns

[logical] Toggle remove spurious columns from A and variables from x

remove_rows

[logical] Toggle remove spurious rows

deduplicate

[logical] Toggle remove duplicate rows

implied_equations

[logical] replace cases of a.x<=b and a.x>=b with a.x==b.

Value

A list with the following elements.

  • A: The compactified version of input A

  • b: The compactified version of input b

  • x: The compactified version of input x

  • neq: number of equations in new system

  • nleq: number of inequations of the form a.x<=b in the new system

  • cols_removed: [logical] indicates what elements of x (columns of A) have been removed

Details

It is assumend that the system of equations is in normalized form (see link{normalize}).


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