public Solve ( System.Matrix B ) : System.Matrix | ||
B | System.Matrix | A Matrix with as many rows as A and any number of columns. |
return | System.Matrix |
public Matrix Solve(Matrix B)
{
if (B.Rows != m)
{
throw new MatrixError(
"Matrix row dimensions must agree.");
}
if (!IsNonsingular)
{
throw new MatrixError("Matrix is singular.");
}
// Copy right hand side with pivoting
int nx = B.Cols;
Matrix Xmat = B.GetMatrix(piv, 0, nx - 1);
double[][] X = Xmat.Data;
// Solve L*Y = B(piv,:)
for (int k = 0; k < n; k++)
{
for (int i = k + 1; i < n; i++)
{
for (int j = 0; j < nx; j++)
{
X[i][j] -= X[k][j]*LU[i][k];
}
}
}
// Solve U*X = Y;
for (int k = n - 1; k >= 0; k--)
{
for (int j = 0; j < nx; j++)
{
X[k][j] /= LU[k][k];
}
for (int i = 0; i < k; i++)
{
for (int j = 0; j < nx; j++)
{
X[i][j] -= X[k][j]*LU[i][k];
}
}
}
return Xmat;
}
LUDecomposition::Solve ( double value_ren ) : double[] |
public override void Iteration() { LUDecomposition decomposition = null; double num; double num2; double num3; double num4; int num5; int num6; IMLData data; double num7; double num8; if ((((uint) num4) | 15) != 0) { goto Label_0399; } goto Label_01C7; Label_0022: base.PostIteration(); if ((((uint) num5) & 0) == 0) { return; } goto Label_01C7; Label_0044: this._xd7d571ecee49d1e4 = Math.Abs((double) ((this._x8557b7ee760663f3 - this._xc7c4e9c099884228) / (2.0 * num))); Label_0073: this.Error = num; goto Label_0022; Label_00F1: if ((num4 >= num3) && (this._x3271cefb1a159639 < 1E+25)) { this._x3271cefb1a159639 *= 10.0; num5 = 0; Label_01EF: if (num5 < this._xe2982b936ae423cd) { this._xc410e3804222557a[num5][num5] = this._x3cb63876dda4b74a[num5] + (this._x3271cefb1a159639 + this._x6ad505c7ef981b0e); num5++; if ((((uint) num7) + ((uint) num3)) >= 0) { goto Label_01EF; } } else { if ((((uint) num7) + ((uint) num8)) > uint.MaxValue) { return; } decomposition = new LUDecomposition(this._x05fb16197e552de6); if (!decomposition.IsNonsingular) { goto Label_00F1; } this._xdadd8f92d75a3aba = decomposition.Solve(this._x878c4eb3cef19a5a); } if (((uint) num6) >= 0) { if (0 != 0) { goto Label_0340; } goto Label_01C7; } goto Label_029A; } this._x3271cefb1a159639 /= 10.0; if (this._x6c57e14b737e51f6 && (decomposition != null)) { num8 = Trace(decomposition.Inverse()); this._xc7c4e9c099884228 = this._xe2982b936ae423cd - (this._x6ad505c7ef981b0e * num8); if (((uint) num7) < 0) { goto Label_0044; } this._x6ad505c7ef981b0e = ((double) this._xe2982b936ae423cd) / ((2.0 * num2) + num8); if ((((uint) num4) | 0xfffffffe) != 0) { goto Label_0044; } goto Label_0022; } goto Label_0073; Label_0137: num7 = this._x61830ac74d65acc3.Ideal[0] - data[0]; num += num7 * num7; num6++; Label_0161: if (num6 < this._x8557b7ee760663f3) { this._xb12276308f0fa6d9.GetRecord((long) num6, this._x61830ac74d65acc3); data = this._x87a7fc6a72741c2e.Compute(this._x61830ac74d65acc3.Input); goto Label_0137; } num /= 2.0; num4 = (this._xd7d571ecee49d1e4 * num) + (this._x6ad505c7ef981b0e * num2); goto Label_00F1; Label_01C7: num2 = this.UpdateWeights(); num = 0.0; num6 = 0; goto Label_0161; Label_029A: if ((((uint) num7) | 0xff) == 0) { goto Label_0137; } this._x3271cefb1a159639 /= 10.0; goto Label_00F1; Label_0340: num4 = num3 + 1.0; if ((((uint) num4) - ((uint) num6)) >= 0) { goto Label_029A; } Label_0399: base.PreIteration(); this._x2f33d779e5a20b28 = NetworkCODEC.NetworkToArray(this._x87a7fc6a72741c2e); if ((((uint) num8) | 4) == 0) { goto Label_0022; } IComputeJacobian jacobian = new JacobianChainRule(this._x87a7fc6a72741c2e, this._xb12276308f0fa6d9); num = jacobian.Calculate(this._x2f33d779e5a20b28); num2 = this.x01818299df58497e(); this.CalculateHessian(jacobian.Jacobian, jacobian.RowErrors); num3 = (this._xd7d571ecee49d1e4 * num) + (this._x6ad505c7ef981b0e * num2); goto Label_0340; }