Example usage for org.apache.commons.math.linear AnyMatrix isSquare

List of usage examples for org.apache.commons.math.linear AnyMatrix isSquare

Introduction

In this page you can find the example usage for org.apache.commons.math.linear AnyMatrix isSquare.

Prototype

boolean isSquare();

Source Link

Document

Is this a square matrix?

Usage

From source file:com.macasaet.lambda.fluent.Examples.java

/**
 * This is the standard way of defining {@link Predicate Predicates} in Guava. Notice that even in this simple case
 * of a single method invocation, the Predicate definition uses five lines.
 *///from  w  ww  .  jav a  2 s.c o  m
@Test
public final void definePredicateWithAnonymousInnerClass() {
    final Predicate<? super AnyMatrix> matrixIsSquare = new Predicate<AnyMatrix>() {
        public boolean apply(final AnyMatrix input) {
            return input.isSquare();
        }
    };

    final Collection<? extends AnyMatrix> result = filter(matrices, matrixIsSquare);

    assertTrue(result.contains(squareMatrix));
    assertFalse(result.contains(nonSquareMatrix));
}