MODULE PCArrays;
IMPORT PCT, StringPool, PCS, PCC , PCM, Strings := UTF8Strings;
CONST
abs = PCC.absfn; minus = PCS.minus; plus = PCS.plus; times = PCS.times;
mod = PCS.mod; div = PCS.div; elementproduct = PCS.elementproduct;
elementquotient = PCS.elementquotient; scalarproduct = PCS.scalarproduct;
eql = PCS.eql; neq = PCS.neq; assign = PCS.becomes;
transpose = PCS.transpose; dtimes = PCS.dtimes; copy* = 1024; copy2*=1025;
zerocopy* = 1026; zerocopy2*=1027; selfcopy*=1028; selfcopy2*=1029; incmul* = 1030; allocateTensor*=1031; incmule*=1032; decmul*=1033;
eeql = PCS.eeql; eneq = PCS.eneq; elss = PCS.elss;
eleq = PCS.eleq; egtr = PCS.egtr; egeq = PCS.egeq; lss = PCS.lss;
leq = PCS.leq; gtr = PCS.gtr; geq = PCS.geq; or = PCS.or; and = PCS.and; not = PCS.not;
lenfn* = 154;
maxfn* = 148; minfn* = 149;
incrfn* = 176; swapfn* = 177; convert* = 178;
applyaop* = 179; sumfn* = 180; dimfn* = 181;
reshapefn* = 182; incrfnA*=183; lenfnA*=184; shallowcopyfn*= 185;
ArrayModuleName = "ArrayBase";
anydim=MAX(LONGINT);
scalar = 0;
none = -1;
any = -2;
match = -3;
add = -4;
VAR
ArrayModuleIdx-: StringPool.Index; ArrayModule-: PCT.Module;
NoProc-: StringPool.Index; modscope: PCT.ModScope; Any: PCT.Struct;
TYPE
Operator = LONGINT;
BaseTypes = POINTER TO RECORD
left, right, res: PCT.Struct;
idx: StringPool.Index;
next: BaseTypes;
END;
OperatorEntry = OBJECT
VAR op: Operator;
pname: ARRAY 256 OF CHAR;
lshape, rshape, resshape: LONGINT;
next: OperatorEntry;
first, last: BaseTypes;
PROCEDURE & Init*( op: Operator; CONST name: ARRAY OF CHAR;
lshape, rshape, resshape: LONGINT );
BEGIN
SELF.op := op; COPY( name, SELF.pname ); SELF.lshape := lshape;
SELF.rshape := rshape; SELF.resshape := resshape;
IF firstop = NIL THEN firstop := SELF; lastop := SELF
ELSE lastop.next := SELF; lastop := SELF
END;
END Init;
PROCEDURE Enter( left, right, res: PCT.Struct; CONST suffix: ARRAY OF CHAR );
VAR type: BaseTypes;
procname: ARRAY 256 OF CHAR;
BEGIN
NEW( type ); type.left := left; type.right := right; type.res := res;
COPY( pname, procname ); Strings.Append( suffix, procname );
StringPool.GetIndex( procname, type.idx );
IF first = NIL THEN first := type; last := first
ELSE last.next := type; last := type;
END;
END Enter;
PROCEDURE Enter3( left, right, res: PCT.Struct );
VAR suffix: ARRAY 32 OF CHAR;
i: LONGINT;
PROCEDURE Append( c: CHAR );
BEGIN
suffix[i] := c; INC( i );
END Append;
PROCEDURE TypeChar( t: PCT.Struct ): CHAR;
VAR c: CHAR;
BEGIN
IF t = PCT.Int8 THEN c := "S"
ELSIF t = PCT.Int16 THEN c := "I"
ELSIF t = PCT.Int32 THEN c := "L"
ELSIF t = PCT.Float32 THEN c := "R"
ELSIF t = PCT.Float64 THEN c := "X"
ELSIF t = PCT.Bool THEN c := "B"
ELSIF t = Any THEN c := "A"
ELSE HALT( 100 );
END;
RETURN c;
END TypeChar;
BEGIN
IF lshape = scalar THEN Append( "S" );
ELSIF (lshape > 0) OR (lshape = any) THEN Append( "A" );
ELSE
ASSERT ( lshape = none );
left := NIL;
END;
IF (left # NIL ) & (lshape # none) THEN Append( TypeChar( left ) ) END;
IF rshape = 0 THEN Append( "S" );
ELSIF (rshape > 0) OR (rshape = any) OR (rshape = match) THEN
Append( "A" );
ELSE
ASSERT ( rshape = none );
right := NIL;
END;
IF (right # NIL ) & (rshape # none) THEN Append( TypeChar( right ) ) END;
suffix[i] := 0X; Enter( left, right, res, suffix );
END Enter3;
PROCEDURE EnterDefault( t: PCT.Struct );
BEGIN
Enter3( t, t, t );
END EnterDefault;
PROCEDURE EnterDefaultB( t: PCT.Struct );
BEGIN
Enter3( t, t, PCT.Bool );
END EnterDefaultB;
PROCEDURE EnterDefaults;
BEGIN
EnterDefault( PCT.Int8 ); EnterDefault( PCT.Int16 );
EnterDefault( PCT.Int32 ); EnterDefault( PCT.Float32 );
EnterDefault( PCT.Float64 );
END EnterDefaults;
PROCEDURE EnterDefaultsB;
BEGIN
EnterDefaultB( PCT.Int8 ); EnterDefaultB( PCT.Int16 );
EnterDefaultB( PCT.Int32 ); EnterDefaultB( PCT.Float32 );
EnterDefaultB( PCT.Float64 );
END EnterDefaultsB;
PROCEDURE Match( l, r: PCT.Struct; VAR type: PCT.Struct ): StringPool.Index;
VAR ldim, rdim, dim: LONGINT; lbase, rbase, res: PCT.Struct; e: BaseTypes;
PROCEDURE Max( l, r: LONGINT ): LONGINT;
BEGIN
IF l > r THEN RETURN l ELSE RETURN r END;
END Max;
BEGIN
IF l = NIL THEN ldim := none; lbase := NIL;
ELSIF l IS PCT.EnhArray THEN
ldim := l( PCT.EnhArray ).dim; lbase := PCT.ElementType( l );
ELSIF l IS PCT.Tensor THEN
ldim := anydim; lbase := PCT.ElementType( l );
ELSE ldim := scalar; lbase := l;
END;
IF r = NIL THEN rdim := none; rbase := NIL;
ELSIF r IS PCT.EnhArray THEN
rdim := r( PCT.EnhArray ).dim; rbase := PCT.ElementType( r )
ELSIF r IS PCT.Tensor THEN
rdim := anydim; rbase := PCT.ElementType( r )
ELSE rdim := scalar; rbase := r;
END;
IF (ldim # lshape) & ((ldim = 0) OR (lshape # any)) THEN RETURN NoProc END;
IF (rdim # rshape) & ((rdim = 0) OR (rshape # any) & ((rshape # match) OR (ldim # rdim) & (ldim#anydim) & (rdim#anydim))) THEN
RETURN NoProc
END;
e := first;
WHILE (e # NIL ) &
((e.left # lbase) & (e.left # Any) OR
(e.right # rbase) & (e.right # Any)) DO
e := e.next;
END;
IF e = NIL THEN RETURN NoProc END;
IF e.res = Any THEN
IF e.left = Any THEN res := e.left
ELSIF e.right = Any THEN res := e.right
ELSE res := NIL;
END;
ELSE res := e.res;
END;
IF resshape >= scalar THEN dim := resshape;
ELSIF resshape = match THEN dim := Max( ldim, rdim );
ELSIF resshape = add THEN dim := ldim + rdim;
ELSIF resshape = any THEN ASSERT(res=NIL);
ELSE
HALT( 100 );
END;
IF res= NIL THEN type := NIL;
ELSIF dim=0 THEN type := res;
ELSIF (l#NIL) & (l IS PCT.Tensor) OR (r#NIL) & (r IS PCT.Tensor) THEN
IF dim=0 THEN
type := res
ELSE
type := PCT.BuildTensor(res);
END;
ELSE
type := PCT.BuildOpenArray( res, dim );
END;
RETURN e.idx;
END Match;
PROCEDURE Report;
VAR e: BaseTypes;
str: ARRAY 256 OF CHAR;
PROCEDURE ReportType( t: PCT.Struct );
BEGIN
IF t = PCT.Int8 THEN PCM.LogWStr( "int8" );
ELSIF t = PCT.Int16 THEN PCM.LogWStr( "int16" );
ELSIF t = PCT.Int32 THEN PCM.LogWStr( "int32" );
ELSIF t = PCT.Float32 THEN PCM.LogWStr( "float32" );
ELSIF t = PCT.Float64 THEN PCM.LogWStr( "float64" );
ELSIF t = PCT.Bool THEN PCM.LogWStr( "bool" );
ELSE PCM.LogWStr( "???" );
END;
END ReportType;
PROCEDURE ReportShape( shape: LONGINT );
BEGIN
IF shape = scalar THEN PCM.LogWStr( "[scalar]" );
ELSIF shape = any THEN PCM.LogWStr( "[any dim array]" );
ELSIF shape = match THEN PCM.LogWStr( "[matching dim array]" );
ELSIF shape = add THEN PCM.LogWStr( "[adding dim array]" );
ELSIF shape > 0 THEN
PCM.LogWStr( "[" ); PCM.LogWNum( shape ); PCM.LogWStr( " dim array]" );
ELSE PCM.LogWStr( "???" );
END;
END ReportShape;
BEGIN
PCM.LogWStr( "Operator:" ); PCM.LogWNum( op ); PCM.LogWStr( " (" );
PCM.LogWStr( pname ); PCM.LogWStr( ") : " ); ReportShape( lshape );
IF rshape # none THEN PCM.LogWStr( " x " ); ReportShape( rshape ); END;
PCM.LogWStr( "-> " ); ReportShape( resshape ); PCM.LogWLn; e := first;
WHILE (e # NIL ) DO
PCM.LogWStr( " " ); ReportType( e.left );
IF e.right # NIL THEN PCM.LogWStr( " x " ); ReportType( e.right ); END;
PCM.LogWStr( " -> " ); ReportType( e.res );
StringPool.GetString( e.idx, str ); PCM.LogWStr( " (" );
PCM.LogWStr( str ); PCM.LogWStr( ")" ); PCM.LogWLn; e := e.next;
END;
PCM.LogFlush;
END Report;
END OperatorEntry;
VAR
firstop, lastop: OperatorEntry;
PROCEDURE FindArrayOp*( op: Operator; l, r: PCT.Struct;
VAR type: PCT.Struct ): StringPool.Index;
VAR e: OperatorEntry; idx: StringPool.Index; name: ARRAY 256 OF CHAR;
BEGIN
idx := NoProc; type := NIL;
e := firstop;
WHILE (e # NIL ) DO
IF e.op = op THEN
idx := e.Match( l, r, type );
IF idx # NoProc THEN
StringPool.GetString(idx,name);
RETURN idx END;
END;
e := e.next;
END;
RETURN NoProc;
END FindArrayOp;
PROCEDURE FindProcedure*( pos: LONGINT; idx: StringPool.Index ): PCT.Proc;
VAR sym: PCT.Symbol;
BEGIN
BEGIN {EXCLUSIVE}
IF ArrayModule = NIL THEN
PCT.Import( modscope.owner, ArrayModule, ArrayModuleIdx );
END;
END;
IF ArrayModule = NIL THEN PCM.Error( 999, pos, "ArrayModule missing." ); RETURN NIL; END;
IF idx = NoProc THEN PCM.Error( 137, pos, "" ); RETURN NIL; END;
sym :=
PCT.Find( ArrayModule.scope, ArrayModule.scope, idx, PCT.procdeclared,
TRUE );
IF sym = NIL THEN PCM.Error( 999, pos, "Operator not found, check PCArrays, ArrayBase missing?" ); RETURN NIL;
ELSE RETURN sym( PCT.Proc );
END;
END FindProcedure;
PROCEDURE IsNumType( t: PCT.Struct ): BOOLEAN;
BEGIN
RETURN (t = PCT.Int8) OR (t = PCT.Int16) OR (t = PCT.Int32) OR
(t = PCT.Float32) OR (t = PCT.Float64);
END IsNumType;
PROCEDURE Largest*( a, b: PCT.Struct ): PCT.Struct;
BEGIN
IF a = b THEN RETURN a
ELSIF ~IsNumType( a ) OR ~IsNumType( b ) THEN RETURN NIL
END;
IF a = PCT.Float64 THEN RETURN a;
ELSIF a = PCT.Float32 THEN
IF b = PCT.Float64 THEN RETURN b ELSE RETURN a; END;
ELSIF a = PCT.Int32 THEN
IF (b = PCT.Float64) OR (b = PCT.Float32) THEN RETURN b ELSE RETURN a END;
ELSIF a = PCT.Int16 THEN
IF (b = PCT.Float64) OR (b = PCT.Float32) OR (b = PCT.Int32) THEN
RETURN b
ELSE RETURN a
END;
ELSIF a = PCT.Int8 THEN
IF (b = PCT.Float64) OR (b = PCT.Float32) OR (b = PCT.Int32) OR
(b = PCT.Int16) THEN
RETURN b
ELSE RETURN a
END;
ELSE HALT( 100 );
END;
END Largest;
PROCEDURE Init;
VAR op: OperatorEntry;
BEGIN
NEW( Any );
NEW( op, minfn, "Min", scalar, scalar, scalar );
op.Enter3( PCT.Float32, PCT.Float32, PCT.Float32 );
op.Enter3( PCT.Float64, PCT.Float64, PCT.Float64 );
NEW( op, maxfn, "Max", scalar, scalar, scalar );
op.Enter3( PCT.Float32, PCT.Float32, PCT.Float32 );
op.Enter3( PCT.Float64, PCT.Float64, PCT.Float64 );
NEW( op, convert, "Convert", any, scalar, match );
op.Enter( PCT.Int8, PCT.Int16, PCT.Int16, "ASAI" );
op.Enter( PCT.Int8, PCT.Int32, PCT.Int32, "ASAL" );
op.Enter( PCT.Int8, PCT.Float32, PCT.Float32, "ASAR" );
op.Enter( PCT.Int8, PCT.Float64, PCT.Float64, "ASAX" );
op.Enter( PCT.Int16, PCT.Int8, PCT.Int8, "AIAS" );
op.Enter( PCT.Int16, PCT.Int32, PCT.Int32, "AIAL" );
op.Enter( PCT.Int16, PCT.Float32, PCT.Float32, "AIAR" );
op.Enter( PCT.Int16, PCT.Float64, PCT.Float64, "AIAX" );
op.Enter( PCT.Int32, PCT.Int16, PCT.Int16, "ALAI" );
op.Enter( PCT.Int32, PCT.Float32, PCT.Float32, "ALAR" );
op.Enter( PCT.Int32, PCT.Float64, PCT.Float64, "ALAX" );
op.Enter( PCT.Float32, PCT.Int32, PCT.Int32, "ARAL" );
op.Enter( PCT.Float32, PCT.Float64, PCT.Float64, "ARAX" );
op.Enter( PCT.Float64, PCT.Float32, PCT.Float32, "AXAR" );
op.Enter( PCT.Float64, PCT.Int32, PCT.Int32, "AXAL" );
NEW(op, not, "Not",any,none,match);
op.Enter3(PCT.Bool,PCT.Bool,PCT.Bool);
NEW( op, minus, "Minus", any, none, match );
op.EnterDefaults();
NEW( op, abs, "Abs", any, none, match );
op.EnterDefaults();
NEW( op, plus, "Add", any, match, match );
op.EnterDefaults();
NEW( op, plus, "Add", any, scalar, match );
op.EnterDefaults();
NEW( op, plus, "Add", scalar, any, match );
op.EnterDefaults();
NEW( op, minus, "Sub", any, match, match );
op.EnterDefaults();
NEW( op, minus, "Sub", any, scalar, match );
op.EnterDefaults();
NEW( op, minus, "Sub", scalar, any, match );
op.EnterDefaults();
NEW( op, scalarproduct, "SP", any, match, scalar );
op.Enter3( PCT.Int8, PCT.Int8, PCT.Int32 );
op.Enter3( PCT.Int16, PCT.Int16, PCT.Int32 );
op.Enter3( PCT.Int32, PCT.Int32, PCT.Int32 );
op.Enter3( PCT.Float32, PCT.Float32, PCT.Float32 );
op.Enter3( PCT.Float64, PCT.Float64, PCT.Float64 );
NEW( op, elementproduct, "EMul", any, match, match );
op.EnterDefaults();
NEW( op, times, "Mul", any, scalar, match );
op.EnterDefaults();
NEW( op, times, "Mul", scalar, any, match );
op.EnterDefaults();
NEW( op, elementquotient, "EDivide", any, match, match );
op.Enter3( PCT.Int8, PCT.Int8, PCT.Float32 );
op.Enter3( PCT.Int16, PCT.Int16, PCT.Float32 );
op.Enter3( PCT.Int32, PCT.Int32, PCT.Float32 );
op.Enter3( PCT.Float32, PCT.Float32, PCT.Float32 );
op.Enter3( PCT.Float64, PCT.Float64, PCT.Float64 );
NEW( op, PCS.slash, "Divide", any, scalar, match );
op.Enter3( PCT.Int8, PCT.Int8, PCT.Float32 );
op.Enter3( PCT.Int16, PCT.Int16, PCT.Float32 );
op.Enter3( PCT.Int32, PCT.Int32, PCT.Float32 );
op.Enter3( PCT.Float32, PCT.Float32, PCT.Float32 );
op.Enter3( PCT.Float64, PCT.Float64, PCT.Float64 );
NEW( op, PCS.slash, "Divide", scalar, any, match );
op.Enter3( PCT.Int8, PCT.Int8, PCT.Float32 );
op.Enter3( PCT.Int16, PCT.Int16, PCT.Float32 );
op.Enter3( PCT.Int32, PCT.Int32, PCT.Float32 );
op.Enter3( PCT.Float32, PCT.Float32, PCT.Float32 );
op.Enter3( PCT.Float64, PCT.Float64, PCT.Float64 );
NEW( op, div, "EDiv", any, match, match );
op.EnterDefault( PCT.Int8 ); op.EnterDefault( PCT.Int16 );
op.EnterDefault( PCT.Int32 );
NEW( op, div, "Div", any, scalar, match );
op.EnterDefault( PCT.Int8 ); op.EnterDefault( PCT.Int16 );
op.EnterDefault( PCT.Int32 );
NEW( op, div, "Div", scalar, any, match );
op.EnterDefault( PCT.Int8 ); op.EnterDefault( PCT.Int16 );
op.EnterDefault( PCT.Int32 );
NEW( op, mod, "Mod", any, match, match );
op.EnterDefault( PCT.Int8 ); op.EnterDefault( PCT.Int16 );
op.EnterDefault( PCT.Int32 );
NEW( op, mod, "Mod", any, scalar, match );
op.EnterDefault( PCT.Int8 ); op.EnterDefault( PCT.Int16 );
op.EnterDefault( PCT.Int32 );
NEW( op, mod, "Mod", scalar, any, match );
op.EnterDefault( PCT.Int8 ); op.EnterDefault( PCT.Int16 );
op.EnterDefault( PCT.Int32 );
NEW( op, eql, "Eql", any, match, scalar );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, eql, "Eql", any, scalar, scalar );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, eql, "Eql", scalar, any, scalar );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, neq, "Neq", any, match, scalar );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, neq, "Neq", any, scalar, scalar );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, neq, "Neq", scalar, any, scalar );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, lss, "Lss", any, match, scalar );
op.EnterDefaultsB();
NEW( op, lss, "Lss", any, scalar, scalar );
op.EnterDefaultsB();
NEW( op, lss, "Lss", scalar, any, scalar );
op.EnterDefaultsB();
NEW( op, leq, "Leq", any, match, scalar );
op.EnterDefaultsB();
NEW( op, leq, "Leq", any, scalar, scalar );
op.EnterDefaultsB();
NEW( op, leq, "Leq", scalar, any, scalar );
op.EnterDefaultsB();
NEW( op, gtr, "Gtr", any, match, scalar );
op.EnterDefaultsB();
NEW( op, gtr, "Gtr", any, scalar, scalar );
op.EnterDefaultsB();
NEW( op, gtr, "Gtr", scalar, any, scalar );
op.EnterDefaultsB();
NEW( op, geq, "Geq", any, match, scalar );
op.EnterDefaultsB();
NEW( op, geq, "Geq", any, scalar, scalar );
op.EnterDefaultsB();
NEW( op, geq, "Geq", scalar, any, scalar );
op.EnterDefaultsB();
NEW( op, eeql, "EEql", any, match, match );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, eeql, "EEql", any, scalar, match );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, eeql, "EEql", scalar, any, match );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, eneq, "ENeq", any, match, match );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, eneq, "ENeq", any, scalar, match );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, eneq, "ENeq", scalar, any, match );
op.EnterDefaultB( PCT.Bool ); op.EnterDefaultsB();
NEW( op, or, "ElOr", any, match, match );
op.EnterDefaultB( PCT.Bool );
NEW( op, or, "ElOr", any, scalar, match );
op.EnterDefaultB( PCT.Bool );
NEW( op, or, "ElOr", scalar, any, match );
op.EnterDefaultB( PCT.Bool );
NEW( op, and, "ElAnd", any, match, match );
op.EnterDefaultB( PCT.Bool );
NEW( op, and, "ElAnd", scalar, any, match );
op.EnterDefaultB( PCT.Bool );
NEW( op, and, "ElAnd", any, scalar, match );
op.EnterDefaultB( PCT.Bool );
NEW( op, elss, "ELss", any, match, match );
op.EnterDefaultsB();
NEW( op, elss, "ELss", any, scalar, match );
op.EnterDefaultsB();
NEW( op, elss, "ELss", scalar, any, match );
op.EnterDefaultsB();
NEW( op, eleq, "ELeq", any, match, match );
op.EnterDefaultsB();
NEW( op, eleq, "ELeq", any, scalar, match );
op.EnterDefaultsB();
NEW( op, eleq, "ELeq", scalar, any, match );
op.EnterDefaultsB();
NEW( op, egtr, "EGtr", any, match, match );
op.EnterDefaultsB();
NEW( op, egtr, "EGtr", any, scalar, match );
op.EnterDefaultsB();
NEW( op, egtr, "EGtr", scalar, any, match );
op.EnterDefaultsB();
NEW( op, egeq, "EGeq", any, match, match );
op.EnterDefaultsB();
NEW( op, egeq, "EGeq", any, scalar, match );
op.EnterDefaultsB();
NEW( op, egeq, "EGeq", scalar, any, match );
op.EnterDefaultsB();
NEW( op, minfn, "Min", any, none, scalar );
op.EnterDefaults();
NEW( op, maxfn, "Max", any, none, scalar );
op.EnterDefaults();
NEW( op, assign, "Assign", any, scalar, match );
op.EnterDefaults();
op.EnterDefault(PCT.Bool);
NEW( op, times, "MatMul", 2, 2, 2 );
op.EnterDefaults();
NEW( op, times, "MatVecMul", 2, 1, 1 );
op.EnterDefaults();
NEW( op, times, "VecMatMul", 1, 2, 1 );
op.EnterDefaults();
NEW( op, incmule, "EMulInc", any, match, match );
op.EnterDefaults();
NEW( op, incmul, "MatMulInc", 2, 2, 2 );
op.EnterDefaults();
NEW( op, incmul, "MatVecMulInc", 2, 1, 1 );
op.EnterDefaults();
NEW( op, incmul, "VecMatMulInc", 1, 2, 1 );
op.EnterDefaults();
NEW( op, incmul, "IncMul", any, scalar, match );
op.EnterDefaults();
NEW( op, incmul, "IncMul", scalar, any, match );
op.EnterDefaults();
NEW( op, decmul, "MatMulDec", 2, 2, 2 );
op.EnterDefaults();
NEW( op, decmul, "MatVecMulDec", 2, 1, 1 );
op.EnterDefaults();
NEW( op, decmul, "VecMatMulDec", 1, 2, 1 );
op.EnterDefaults();
NEW( op, decmul, "DecMul", any, scalar, match );
op.EnterDefaults();
NEW( op, decmul, "DecMul", scalar, any, match );
op.EnterDefaults();
NEW( op, times, "CrossProduct", 1, 1, 1 );
op.EnterDefaults();
NEW( op, sumfn, "Sum", any, none, scalar );
op.EnterDefaults();
NEW( op, transpose, "Transpose", 2, none, 2 );
op.EnterDefaults();
NEW( op, dtimes, "TensorProd", any, any, add );
op.EnterDefaults();
NEW( op, copy, "CopyArray", any, scalar, match );
op.Enter( Any, PCT.Int32, Any, "" );
NEW(op,copy2,"CopyTensor",any,scalar,match);
op.Enter( Any, PCT.Int32, Any, "" );
NEW( op, zerocopy, "ZeroCopyArray", any, scalar, match );
op.Enter( Any, PCT.Int32, Any, "" );
NEW( op,zerocopy2,"ZeroCopyTensor",any,scalar,match);
op.Enter( Any, PCT.Int32, Any, "" );
NEW(op,selfcopy,"CopyArraySelf",any,scalar,match);
op.Enter( Any, PCT.Int32, Any, "" );
NEW(op,selfcopy,"CopyTensorSelf",any,scalar,match);
op.Enter( Any, PCT.Int32, Any, "" );
NEW(op,allocateTensor,"AllocateTensorX",1 ,scalar ,any);
op.Enter( PCT.Int32, PCT.Int32, Any, "" );
op.Enter( PCT.Int16, PCT.Int32, Any, "" );
op.Enter( PCT.Int8, PCT.Int32, Any, "" );
NEW(op,lenfnA,"LenA",any,none,0);
op.Enter(Any,Any,PCT.BuildOpenArray( PCT.Int32,1) ,"");
NEW(op,incrfnA,"IncrA",any,none,0);
op.Enter(Any,Any,PCT.BuildOpenArray( PCT.Int32,1),"");
NEW(op,lenfn,"Len",any,scalar,scalar);
op.Enter(Any,PCT.Int32,PCT.Int32,"");
NEW(op,incrfn,"Incr",any,scalar,scalar);
op.Enter(Any,PCT.Int32,PCT.Int32,"");
NEW(op,reshapefn,"Reshape",any,any,0);
op.Enter(Any,Any,PCT.BuildOpenArray( PCT.Int32,1),"");
NEW(op,shallowcopyfn,"ShallowCopy",any,none,match);
op.Enter(Any,Any,Any,"");
END Init;
PROCEDURE InitScope*( scope: PCT.ModScope );
BEGIN
ArrayModule := NIL; modscope := scope;
END InitScope;
PROCEDURE Report*;
VAR e: OperatorEntry;
BEGIN
e := firstop;
WHILE (e # NIL ) DO e.Report; e := e.next; END;
END Report;
BEGIN
Init; ArrayModule := NIL; NoProc := StringPool.GetIndex1( "#NoProc#" );
ArrayModuleIdx := StringPool.GetIndex1( ArrayModuleName );
END PCArrays.
PCArrays.Report ~