blocks: Decompose a matrix or edits into independent blocks

Description Usage Arguments Value Examples

View source: R/blocks.R

Description

blocks returns a list of independent blocks M_i such that M=M_1\oplus M_2\oplus\cdots\oplus M_n.

blockIndex returns a list of row indices in a logical matrix D designating independent blocks.

Usage

1
2
3

Arguments

M

matrix, editmatrix, editarray or editset to be decomposed into independent blocks

D

matrix of type logical

Value

list of independent subobjects of M.

list of row indices in D indicating independent blocks. Empty rows (i.e. every column FALSE) are ignored.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# three seperate blocks
E <- editmatrix( expression( 
  x1 + x2 == x3,
  x3 + x4 == x5,
  x5 + x6 == x7,
  y1 + y2 == y3,
  z1 + z2 == z3
))
blocks(E)

# four seperate blocks
E <- editmatrix(expression( 
  x1 + x2 == x3,
  x3 + x4 == x5,
  x8 + x6 == x7,
  y1 + y2 == y3,
  z1 + z2 == z3
))
blocks(E)

# two categorical blocks
E <- editarray(expression(
 x %in% c('a','b','c'),
 y %in% c('d','e'),
 z %in% c('f','g'),
 u %in% c('w','t'),
 if ( x == 'a') y != 'd',
 if ( z == 'f') u != 'w'
))
blocks(E)

editrules documentation built on July 2, 2018, 1 a.m.