<< plq_build | plq | plq_clean >>

CCA (Computational Convex Analysis) >> plq > plq_check

# plq_check

Piecewise linear quadratic (plq), Consistency check

### Calling Sequence

    [b, er] = plq_check(plqf, ind)

### Parameters

plqf

  matrix. A plq function.

ind

  optional integer. Which tests to perform on plqf.

b

  boolean. True if and only if plqf is a valid PLQ function.

er

  real number. The maximum error found in the last test run.

### Description

Performs a number of sanity checks on the PLQ function plqf. If all of the tests pass, %t is returned, otherwise %f is returned.

Test 1 tests that the plqf's x values (first column) are increasing. Test 2 checks that plqf is continuous. By default, both tests are performed. The optional index argument can specify an individual test, or vector of tests, to run.

If test 1 fails, then er is the largest decrease in x value between two consecutive pieces. If test 2 fails, then er is the maximum absolute difference between the values of two consecutive pieces at their meeting point.

### Examples

    plqf = [-1 0 0 %inf; 0 0 0 0; 1 0 0 1; %inf 0 0 %inf];
    plq_check(plqf),    // False - discontinuous.

    plqf = [-1 0 0 %inf; 0 0 0 0; -0.5 0 0 0; %inf 0 0 %inf];
    plq_check(plqf),    // False - X not increasing.

    plqf = [0 0 -1 0; %inf 0 1 0];
    plq_check(plqf),    // True.

### See Also

- plq_function

### Authors

`Bryan Gardiner`, University of British Columbia, BC, Canada

<< plq_build | plq | plq_clean >>