## Name

op_fitz_direct — [For comparison only] Evaluate the Fitzpatrick function of a given operator on a grid.

## Calling Sequence

    F = op_fitz_direct(A, n, x, xstar)

## Parameters

A

  matrix. An operator [a;a*] where a and a* are row vectors.

n

  integer. The order of the Fitzpatrick function to compute.

x

  column vector. The x values of the grid on which the Fitzpatrick function is evaluated.

xstar

  column vector. The x* values of the grid on which the Fitzpatrick function is evaluated.

## Description

<listitem>

Warning: This function is provided only for comparison and unit testing. Faster results are achieved by using op_fitz.

Evaluates the Fitzpatrick function with order n of an operator A on a grid (x,x*).

This function uses the recursive algorithm given by following formula. It first precomputes F with n-1 for all (a,xstar) pairs, then computes the maximum across all (a,astar) in A for each (x,xstar) pair. The function F for n=1 is defined to be x*xstar'. T(n,N), the time required to compute F(A,n,x,xstar), is O(n*m^2*Nxstar + m*N). If m==Nx==Nxstar, then T(n,N) = O(m^4).

        F(A, n, x, xstar) =      sup        [ F(A, n-1, a, xstar) + x*astar - a*astar ]
                            (a,astar) in A

        m = size(A, 2);
        Nx = size(x, 1);
        Nxstar = size(xstar, 1);
        N = Nx * Nxstar;

</listitem>

## Examples

    a = 1:4;
    astar = 2*a^2 - 9;
    x = 0:5;
    xstar = -1:5;
    F1 = op_fitz_direct([a; astar], 1, x, xstar);
    F2 = op_fitz_direct([a; astar], 2, x, xstar);
    F3 = op_fitz_direct([a; astar], 3, x, xstar);

    clf(); alpha=60; theta=-60;
    subplot(131); plot3d(x, xstar, F1, alpha=alpha, theta=theta);
    subplot(132); plot3d(x, xstar, F2, alpha=alpha, theta=theta);
    subplot(133); plot3d(x, xstar, F3, alpha=alpha, theta=theta);

## See Also

op_fitz_brute , op_fitz , op_fitzinf , plq_fitzinf0 , plq_fitzinf0_direct , plq_rock

## Authors

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