nonzero-rows ( matrix -- matrix' ) (original) (raw)

nonzero-rows ( matrix -- matrix' )

Vocabulary
math.matrices.elimination

Inputs

matrix a sequence

Outputs

matrix' a sequence

Word description
Removes all all-zero rows from the matrix

Examples

USING: math.matrices.elimination prettyprint ; { { 0 0 } { 5 6 } { 0 0 } { 4 0 } } nonzero-rows .
{ { 5 6 } { 4 0 } }

Definition

USING: math sequences ;

IN: math.matrices.elimination

: nonzero-rows ( matrix -- matrix' ) [ [ zero? ] all? ] reject ;