next | previous | forward | backward | up | top | index | toc | Macaulay2 website
SLPexpressions :: gateMatrix

gateMatrix -- create a GateMatrix

Synopsis

Description

This methods creates a GateMatrix from the given input data, which should be a matrix or a doubly-nested list.

The package SLPexpressions overrides matrix to allow a table (a nested list) of Gates as an argument.

i1 : declareVariable x; declareVariable y;
i3 : A = matrix { apply(5,i->i*x) }

o3 = {{0, x, (2 * x), (3 * x), (4 * x)}}

o3 : GateMatrix
i4 : A#0

o4 = {0, x, (2 * x), (3 * x), (4 * x)}

o4 : List
i5 : A#0#0

o5 = 0

o5 : InputGate
i6 : B = matrix { apply(4,i->y^i) }

o6 = {{1, (y), (y * y), (y * y * y)}}

o6 : GateMatrix
i7 : C = transpose A * B

o7 = {{(0), (0), (0), (0)}, {(x), ((x * (y))), ((x * (y * y))), ((x * (y * y
     ------------------------------------------------------------------------
     * y)))}, {((2 * x)), (((2 * x) * (y))), (((2 * x) * (y * y))), (((2 * x)
     ------------------------------------------------------------------------
     * (y * y * y)))}, {((3 * x)), (((3 * x) * (y))), (((3 * x) * (y * y))),
     ------------------------------------------------------------------------
     (((3 * x) * (y * y * y)))}, {((4 * x)), (((4 * x) * (y))), (((4 * x) *
     ------------------------------------------------------------------------
     (y * y))), (((4 * x) * (y * y * y)))}}

o7 : GateMatrix
i8 : numrows C, numcols C

o8 = (5, 4)

o8 : Sequence

See also

Ways to use gateMatrix :

For the programmer

The object gateMatrix is a method function.