Conjugate() public method

Conjugates the current scalar value, i.e. switches the sign of the imaginary value.
public Conjugate ( ) : ScalarValue
return ScalarValue
        /// <summary>
        /// Cholesky algorithm for symmetric and positive definite matrix.
        /// </summary>
        /// <param name="Arg">Square, symmetric matrix.</param>
        /// <returns>Structure to access L and isspd flag.</returns>
        public CholeskyDecomposition(MatrixValue Arg)
        {
            // Initialize.
            var A = Arg.GetComplexMatrix();
            n = Arg.DimensionY;
            L = new ScalarValue[n][];

            for (int i = 0; i < n; i++)
                L[i] = new ScalarValue[n];

            isspd = Arg.DimensionX == n;

            // Main loop.
            for (int i = 0; i < n; i++)
            {
                var Lrowi = L[i];
                var d = ScalarValue.Zero;

                for (int j = 0; j < i; j++)
                {
                    var Lrowj = L[j];
                    var s = new ScalarValue();

                    for (int k = 0; k < j; k++)
                        s += Lrowi[k] * Lrowj[k].Conjugate();

                    s = (A[i][j] - s) / L[j][j];
                    Lrowi[j] = s;
                    d += s * s.Conjugate();
                    isspd = isspd && (A[j][i] == A[i][j]);
                }

                d = A[i][i] - d;
                isspd = isspd & (d.Abs() > 0.0);
                L[i][i] = d.Sqrt();

                for (int k = i + 1; k < n; k++)
                    L[i][k] = ScalarValue.Zero;
            }
        }
Beispiel #2
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(value.Conjugate());
 }