public float [] SolveVerbose(float [,] LL, float [,] UU, float [] rhs) { float [] yy = FwdsSubst(LL, rhs); Console.Write("After fwds subst="); MatrixLib.printa(yy); float [] xx = BackSubst(UU, yy); Console.Write("After back subst="); MatrixLib.printa(xx); return(xx); // Return the final solution. }
// Decompose to Lower and Upper. Upper is done in-place in G. public void DecomposeVerbose(float [,] LL, float [,] G) { Console.WriteLine("L/U Decomposition - single-threaded version.\n"); Console.WriteLine("Initial Coefficient Matrix Pre L/U Decomposition:\n"); MatrixLib.printa(G); LUdecompose(LL, G, true); Console.WriteLine("UU="); MatrixLib.printa(G); Console.WriteLine("LL="); MatrixLib.printa(LL); Console.WriteLine("Recombine LL and RR: Should result in the original:"); MatrixLib.mpx(tmp, LL, G); MatrixLib.printa(tmp); }
public void Roll(float radians) { // Look, Right and Up Matrix4 m = Matrix4.CreateFromAxisAngle(Look, radians); // Transform vector by matrix, project result back into w = 1.0f Right = MatrixLib.Transform(m, Right); // TransformVectorCoord Up = MatrixLib.Transform(m, Up); }
//private float pitchAngle = 0f, yawAngle = 0f; public void Pitch(float radians) { //angle = MathHelpers.ClampCircular(angle, 0f, MathHelpers.PI2); // Right Matrix4 m = Matrix4.CreateFromAxisAngle(Right, radians); // Transform vector by matrix, project result back into w = 1.0f Right = MatrixLib.Transform(m, Up); // TransformVectorCoord Up = MatrixLib.Transform(m, Look); }
public static void Main() { runstate = 2; // use codepoints Console.WriteLine("Kiwi Demo - L/U decomposition"); SimuSolve ssolve = new SimuSolve(problemSize); Kiwi.KppMark("Start"); generate_example_coefficients(); runstate = 3; // use codepoints MatrixLib.copy2d(UUtop, coefficients); runstate = 4; // use codepoints ssolve.DecomposeVerbose(LLtop, UUtop); runstate = 5; // use codepoints Console.WriteLine("Kiwi L/U demo - coefficient matrix decomposed."); Kiwi.KppMark("Coefficients Created"); for (int test = 0; test < 3; test++) { runstate = 10 + test; // use codepoints Console.WriteLine("\nKiwi L/U demo - L/U decomposition test with rhs no {0}.", test); generate_example_rhs(test, true); float [] sol = ssolve.SolveVerbose(LLtop, UUtop, target_rhs); // Now see if it works as a solution Console.Write("Substitute back - rhs given by solution is: y="); MatrixLib.printa(MatrixLib.mpx(res, coefficients, sol)); runstate = 9; for (int i = 0; i < res.Length; i++) { out_idx = i; out_data = res[i]; } } runstate = 20; Kiwi.KppMark("ThreeTestsFinished"); Console.WriteLine("Kiwi L/U demo - L/U decomposition demo complete at {0}.", Kiwi.tnow); }
private void CalculateDistanceMatrix() { this.distanceMatrix = MatrixLib.CalculateDistanceMatrix(this._points, layer, MaxDistance); PrintMatrix(this.distanceMatrix, "dist.txt"); }