Macaulay2 » Documentation
Packages » SLPexpressions :: makeInterpretedSLProgram
next | previous | forward | backward | up | index | toc

# makeInterpretedSLProgram -- create a straight-line program

- Usage:
    `makeInterpretedSLProgram(inL, outL)`
- Inputs:
  - inL, a list, of inputs
  - outL, a list, of outputs
- Outputs:
  - an instance of the type InterpretedSLProgram,

## Description

This method returns an object of type InterpretedSLProgram, which encodes a method for evaluating an algebraic circuit.

    i1 : declareVariable X; declareVariable C;

    i3 : XpC = X+C

    o3 = (X + C)

    o3 : SumGate

    i4 : XXC = productGate{X,X,C}

    o4 = (X * X * C)

    o4 : ProductGate

    i5 : detXCCX = detGate{{X,C},{C,X}}

    o5 = det| X C |
            | C X |

    o5 : DetGate

    i6 : XoC = X/C

         X
    o6 = -
         C

    o6 : DivideGate

    i7 : slp = makeInterpretedSLProgram(matrix{{C,X}},matrix{{XXC,detXCCX,XoC,XpC+2}})

    o7 = InterpretedSLProgram{cache => CacheTable{}              }
                              "constant positions" => {-3}
                              "constants" => | 2 |
                              "number of inputs" => 2
                              "number of outputs" => 4
                              RawSLProgram => SLProgram (
                                                consts+vars: 3
                                                noninput nodes: 5
                                                output nodes: 4
                                                )

                              "variable positions" => {-1, -2}

    o7 : InterpretedSLProgram

## See also

- evaluate(SLProgram,MutableMatrix,MutableMatrix) -- evaluate a straight-line program

## Ways to use makeInterpretedSLProgram:

- `makeInterpretedSLProgram(GateMatrix,GateMatrix)`
- `makeInterpretedSLProgram(List,List)`

## For the programmer

The object makeInterpretedSLProgram is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/SLPexpressions/doc.m2:323:0.