Example #1
0
    public override int lambda(Stack st)
    {
        int narg = getNarg(st);

        Algebraic x = getAlgebraic(st);

        Algebraic index_in = CreateVector.crv(st);

        if (index_in.constantq())
        {
            Matrix mx = new Matrix(( Algebraic )x);

            Index idx = Index.createIndex(index_in, mx);

            mx = mx.extract(idx);
            x  = mx.reduce();
        }
        else
        {
            MatRef mr = new MatRef(( Algebraic )x);

            x = new Polynomial(new FunctionVariable("MR(" + x + ")", index_in, mr));
        }

        st.Push(x);

        return(0);
    }