INTERFACE PZOptMatrix; IMPORT LR4x4; TYPE LONG = LONGREAL; MatrixFunction = PROCEDURE (READONLY m: LR4x4.T): LONG; PROCEDURE Optimize( func: MatrixFunction; (* Function to optimize. *) scale: LONG; (* Scale length for translation. *) maxEvals: CARDINAL; (* Maximum number of "func" calls. *) VAR nEvals: CARDINAL; (* Total number of "func" calls performed. *) VAR m: LR4x4.T; (* IN: initial guess, OUT: optimized matrix. *) VAR f: LONG; (* OUT: "func(m)". *) plotName: TEXT; (* Plot file for "func" (minus extension), or empty. *) ); (* Returns a rotation/translation matrix "m" that minimizes "func". The "scale" parameter is the unit of translation. It should be chosen so that translation by "eps*scale" away from the optimum has roughly the same effect on "func" as a rotation by "eps" radians away from the optimum. If "plotName" is not empty, the procedure writes to "plotName & \".plt\"" a graph of "func(m)", where "m" varies along a path from the initial matrix "m" to the returned optimum, and then beyond it. *) END PZOptMatrix.