Here’s a complicated bit of matrix math that I wrote as part of OOOT to calculate the Broyden-Fletcher-Goldfarb-Shanno approach to approximating the Newton approach. This is shown to illustrate some of the basic add and multiply functions of StarMath.

 

clip_image002[8]

var diffX = x.subtract(xLast);

clip_image004[4]

var diffGradF = gradf.subtract(gradFLast);

clip_image006[4]

T = StarMath.multiplyVectorsIntoAMatrix(diffX, diffGradF);

T = T.divide(diffX.multiplyDot(diffGradF));

clip_image008[4]

u = StarMath.multiplyVectorsIntoAMatrix(diffX, diffX);

u = u.multiply(diffX.multiplyDot(diffGradF));

 

clip_image010[4]

IMinusT = StarMath.makeIdentity(T.GetLength(0)).subtract(T);

invH = IMinusT.multiply(invHLast.multiply(IMinusT)).add(u);

clip_image012[4]

dir = invH.multiply(gradf);

 

Last edited Nov 15, 2014 at 2:22 AM by mattica, version 4

Comments

No comments yet.