Beispiel #1
0
        // Eliminate the pivot position from row t using row s.
        private void Eliminate(int s, int t, Expression p, IEnumerable <Expression> Columns)
        {
            Equation T = equations[t];

            if (T[p].EqualsZero())
            {
                return;
            }

            Equation S = equations[s];

            // This is a pretty hot path, so avoid unnecessary evaluations.
            Expression scale = Product.New(-1, T[p], Binary.Power(S[p], -1));

            foreach (Expression j in Columns)
            {
                if (!S[j].EqualsZero())
                {
                    T[j] += Product.New(S[j], scale);
                }
            }
            T[p] = 0;
        }
Beispiel #2
0
 public static LazyExpression operator ^(Expression L, Expression R)
 {
     return(new LazyExpression(Binary.Power(L, R)));
 }
Beispiel #3
0
 /// <summary>
 /// Create a new inverse unary expression. Inverse(x) -> 1/x.
 /// </summary>
 /// <param name="Operand"></param>
 /// <returns></returns>
 public static Expression Inverse(Expression Operand)
 {
     return(Binary.Power(Operand, -1));
 }
 public static LazyExpression operator ^(LazyExpression L, LazyExpression R)
 {
     return(new LazyExpression(Binary.Power(L.value, R.value)));
 }