* Note: This isn’t a real source code; it has almost
* no documentation in it. Good luck.
DEFINE C   2GETLAM
DEFINE R   3GETLAM
DEFINE PR  5GETLAM
ASSEMBLE
='EvalNoCK:	EQU	#18F6A
RPL
xROMID #412
xTITLE Stat03 C.Meland 130497
xCONFIG Cfg
xMESSAGE Msg
LABEL Cfg
::
 #412 TOSRRP
;
LABEL Msg
ARRY BB C2A2010000400009200094E66716C696460235471636B6D244164716F200034F6C657D6E682379202E6F6470296E602441647169200094E637576666E20235471636B6D244164716B2000E4F602D4F62756022416C6C63702C456664712
*{ "Invalid Stack-Data"
*"Column(s) not in Data"
*"Insuff. Stack-Data" 
*"No More Balls Left!" }
NIBB 1 8
xNAME ¨VEC
tNAME x¨VEC VEC
 ::
  CK1&Dispatch
  FOUR
  ::
   DUP
   TYPERARRY?
   NcaseTYPEERR
   MatToVec
  ;
  FIVE
  ListToVec
  ONE
  MetaToVec
 ;


NIBB 1 8
xNAME ¨CVEC
tNAME x¨CVEC CV
 ::
  CK1&Dispatch
  FOUR
  ::
   DUP
   TYPERARRY?
   NcaseTYPEERR
   MatToCol
  ;
  FIVE
  :: ListToVec MatToCol ;
  ONE
  :: MetaToVec MatToCol ;
 ;

NIBB 1 8
xNAME MANIP
::
 CK3&Dispatch
 #418
Manip
#419
Manip
#416
::
 @ NcaseTYPEERR
 'EvalNoCK: xMANIP
;
#417
::
 @ NcaseTYPEERR
 'EvalNoCK: xMANIP
;
#411
::
 ONE{}N Manip
;
;
NIBB 3 000
xNAME CNR
::
 CK1&Dispatch
 1
 ::
' LAM 'Man
@LAM
NOT?SEMI
SWAP  COERCEDUP
DUP#0= caseSIZEERR
ROT
   #> caseSIZEERR
LAM 'A SWAP INDEX@ LAM 'S #-
 #+ 
  PULLREALEL
  SWAPDROP  
 ;
 0
 ::
' LAM 'Man
@LAM
NOT?SEMI
SETTYPEERR
 ;
;
NIBB 1 8
 xNAME MTOT
 ::
  CK1&Dispatch
4
  :: 0 VecDriver .CmTOT ;
1
:: VecPros
   .CmTOT
  ;
 ;

NIBB 1 8
xNAME MMEAN
  ::
  CK1&Dispatch
4
  :: 0 VecDriver .CmMEAN ;
1
:: VecPros
   .CmMEAN
  ;
 ;

NIBB 1 8
 xNAME MSDEV
  ::
  CK1&Dispatch
4
  :: 1 VecDriver .CmSDEV ;
1
:: VecPros
DUP MDIMSDROP
DROP 2 #<case
InsSErr   .CmSDEV
  ;
 ;
NIBB 1 8
xNAME MMAX
  ::
  CK1&Dispatch
4
  :: 0 VecDriver .CmMAX ;
1
:: VecPros
   .CmMAX
  ;
 ;

NIBB 1 8
xNAME MMIN
  ::
  CK1&Dispatch
4
  :: 0 VecDriver .CmMIN ;
1
:: VecPros
   .CmMIN
  ;
 ;

NIBB 1 8
xNAME MVAR
  ::
  CK1&Dispatch
4
  :: 1 VecDriver .CmVAR ;
1
:: VecPros
DUP MDIMSDROP
DROP 2 #<case
InsSErr   .CmVAR
  ;
 ;

NIBB 1 8
xNAME MSSQ
 ::
  CK1&Dispatch
  FOUR
  ::
   ZERO
   VecDriver
   SumSQ
  ;
1
:: VecPros
   SumSQ
  ;
 ;

NIBB 1 8
 xNAME MSXY
 ::
  CK3&Dispatch
  #411
  ::
   COERCE2
   ROT
XYInDOk?
   %%0
   DUP
   FalseFalse
   .CmXY
   %%>%
  ;
 ;
NIBB 1 8
xNAME MSLN
::
  CK1&Dispatch
4
  :: DUP 0 VecDriver ::
 
  TRUE
  .SumLNX
  %%>%
  ; SWAP .NROWS 'EvalNoCK:
  x* ;
1
:: CK2NOLASTWD
COERCE
DUP#0=IT
:: DROP MatToCol 1 ;
OVER
XInDOk?
 TRUE
  .SumLNX
  %%>%
 SWAP .NROWS %*
  ;
 ;
NIBB 1 8
xNAME MGMEAN
::
  CK1&Dispatch
4
  :: 0 VecDriver ::
 
  TRUE
  .SumLNX
  %%>%  %EXP
  ;  ;
1
:: VecPros
 TRUE
  .SumLNX
  %%>%
 %EXP
  ;
 ;
 NIBB 1 8
xNAME MHMEAN
  ::
  CK1&Dispatch
4
  :: 0 VecDriver HMean ;
1
:: VecPros
   HMean
  ;
 ;

NIBB 1 8
xNAME MMEDI
 ::
  CK1&Dispatch
  FOUR
  ::
   ZERO
   VecDriver
  Medi
  ;
1
:: VecPros
Medi
  ;
 ;

NIBB 1 8
xNAME MC
 ::
  CK1&Dispatch
  FOUR
  ::
   MDIMS
   IT
   SWAPDROP
   UNCOERCE
  ;
 ;

NIBB 1 8
xNAME MR
 ::
  CK1&Dispatch
  FOUR
  .NROWS
 ;

NIBB 1 8
xNAME SQARR
 ::
  CK1&Dispatch
  FOUR
  ::
   OkAsDat?
   SqArr
  ;
0 xSQ
 ;

NIBB 1 8
xNAME EADD
 ::
  CK2&Dispatch
  #44
:: Test2 MAddAA ; 
  ARRYREAL
  ::
   SWAP
   Madd
  ;
#14
  Madd
  ZERO

   x+

 ;

NIBB 1 8
xNAME ESUB
 ::
  CK2&Dispatch
#44
  :: Test2
  0 NegRow
  MAddAA
  ;
  ARRYREAL
:: %CHS SWAP Madd
  ;
#14
::
 DUP TYPERARRY?
 NcaseTYPEERR
 0 NegRow
 Madd
;  ZERO

   x-

 ;

NIBB 1 8
 xNAME EMUL
 ::
  CK2&Dispatch
  #44
  ::
   Test2
   TOTEMPSWAP
   DUP
   ARSIZE
   #1+_ONE_DO
   INDEX@
   DUPUNROT
   PULLREALEL
   4ROLL
   4PICK
   PULLREALEL
   ROTSWAP
   %*
   4ROLL
   PUTREALEL
   SWAP
   LOOP
   DROP
  ;
  ZERO

  x*

 ;

NIBB 1 8
xNAME EDIV
 ::
  CK2&Dispatch
  #44
  ::
   Test2
   ArrDiv
  ;
  #14
  ::
   DUP
   TYPERARRY?
   NcaseTYPEERR
  RADiv ;
0  x/ 
 ;

NIBB 1 8
xNAME MEDI
 ::
  CK0
  ZERO
  .TATPROC
  Medi
 ;

NIBB 1 8
xNAME WMEAN
 ::
  CK0
  .TATXY
  .TATGETYCOL
  COERCE
  .GDat
  .CmTOT
  %/
 ;

NIBB 1 8
xNAME WSDEV
 ::
  CK0
  WVar
  %1-
  %/
  %SQRT
 ;

NIBB 1 8
xNAME WVAR
 ::
  CK0
  WVar
  %1-
  %/
 ;

NIBB 1 8
xNAME WPSDEV
 ::
  CK0
  WVar
  %/
  %SQRT
 ;

NIBB 1 8
xNAME WPVAR
 ::
  CK0
  WVar
  %/
 ;


NIBB 1 8
xNAME COLM
 ::
  CK2&Dispatch
  ARRYREAL
  ::
   COERCE
   OVER
   TYPERARRY?
   NcaseTYPEERR
   ColM
  ;
 ;

NIBB 1 8
xNAME ROWM
 ::
  CK2&Dispatch
  ARRYREAL
  ::
   COERCE
   OVER
   TYPERARRY?
   NcaseTYPEERR
  RowM
  ;
 ;

NIBB 1 8
xNAME COLSW
 ::
  CK3&Dispatch
  #411
  ::
   COERCE2
   3PICK
   TYPERARRY?
   NcaseTYPEERR
  ColSw  ;
 ;

NIBB 1 8
xNAME BINS1
 ::
  CK3&Dispatch
  3REAL
  ::
   %CEIL
   COERCE
   DUP#0=case
   ::
    # 203
    ERROROUT
   ;
.GDatCK
.TATGETXCOL
COERCE DUPROT
.XYInArr?
SWAPDROPSWAP
OVER MDIMSDROP SWAPDROP
   #1=
   ITE
   DROP
   ColM
   4UNROLL
* [[Col]] %min %delta #n ->
   Bins
  ;
 ;

NIBB 1 8
xNAME PTILE
 ::
  CK2&Dispatch
  ARRYREAL
  ::
   OVER
   TYPERARRY?
   NcaseTYPEERR
   Ptile
  ;
 ;

NIBB 1 8
xNAME SRT
tNAME xSRT QSRT
 ::
  CK1&Dispatch
  FIVE
  ::
   ListToVec
   Qsrt
   DUP
   ARSIZE
   #1+_ONE_DO
   INDEX@
   PULLREALEL
   SWAP
   LOOP
   ARSIZE
   {}N
  ;
  FOUR
  ::
   TOTEMPOB
   Qsrt
  ;
  ONE
  ::
   CK2NOLASTWD
   CK&DISPATCH1
   ARRYREAL
  ColSort
   
   2REAL
   ::
    MetaToVec
    Qsrt
    DUP
    ARSIZE
    #1+_ONE_DO
    INDEX@
    PULLREALEL
    SWAP
    LOOP
    ARSIZE
    UNCOERCE
   ;
  ;
  8
  ::
   CK2NOLASTWD
   CK&DISPATCH1
   #58
    ::
  OVERDUP LENCOMP
  DUPTWO TWO{}N
  %0 MAKEARRY
CODE
	A=DAT1	A
	CD1EX
	D1=A
	D1=D1+	20
	A=0	A
	DAT1=A	A
	D1=C
	GOVLNG	=Loop
ENDCODE
   
  {{  P L N A }}
>R  N  #1+_ONE_DO
RSWAP ticR DROP RSWAP
P EVAL 
 A CODE
	GOSBVL	=PopASavptr
	B=A	A
	C=DAT1	A
	D0=C
	A=DAT0	A
	LC(5)	=DOREAL
	?A#C	A
	GOYES	error
	A=B	A
	D1=A
	D1=D1+	20
	C=DAT1	A
	B=C	A	B=old CNT
	D=C	A	D=old CNT
	C=C+1	A
	DAT1=C	A
	B=B+B	A
	BSL	A	B=32*old
	LC(5)	30
	C=C+B	A
	A=A+C	A
	D1=A
	D0=D0+	5
	A=DAT0	W
	DAT1=A	W
	D1=D1+	16
	C=D	A
	C=C+C	A
	C=C+C	A
	C=C+D	A
	DAT1=C	A
	GOVLNG	=GETPTRLOOP
error	LC(5)	#202
	GOVLNG	=GPErrjmpC	
ENDCODE
 DROPLOOP
L INNERCOMP RevSt
DROP A Sort2 
CODE
	GOSBVL	=PopASavptr
	D0=A
	R0=A		R0¨Arr
	D0=D0+	20
	A=DAT0	A
	A=-A	A
	R1=A		R1=-ant
	B=A	A	B=-ant
	CD1EX
	D=C	A	D=adrD1
	D0=D0+	26
lop	A=DAT0	A
	D0=D0+	5
	C=D	A
	C=C+A	A
	D1=C
	C=DAT1	A
	DAT0=C	A
	D0=D0+	27
	B=B+1	A
	GONC	lop
	C=D	A
	D1=C
	A=R0
	LC(5)	51
	A=A+C	A
	D0=A
	C=R1
lop2	A=DAT0	A
	DAT1=A	A
	D0=D0+	32
	D1=D1+	5
	C=C+1	A
	GONC	lop2
	GOVLNG	=GETPTRLOOP
ENDCODE
N RevSt
{}N  ABND 
; ;
  
 ;

NIBB 1 8
xNAME TRNS
 ::
  CK1&Dispatch
  FOUR
  Trn
6 :: PTR 1936C    
PTR 193C1
Trn
SWAP SAFESTO 
; 
7 :: PTR 1936C
PTR 193C1
Trn  PTR 1955B

 ;
;

NIBB 1 8
xNAME META
 ::
  CK1&Dispatch
  ONE
  ::
   COERCE
Meta  ;
 ;

NIBB 1 8
xNAME NDUPN
 ::
  CK2&Dispatch
  ONE
  ::
   DUP
   %.5
   %<
   case
   SWAPDROP
   COERCE
  NDupn
      UNCOERCE
  ;
 ;

NIBB 1 8
xNAME REV
 ::
  CK1&Dispatch
  ONE
  ::
   CKN
   RevSt
   UNCOERCE
  ;
  FIVE
  ::
   INNERCOMP
   RevSt
   {}N
  ;
  FOUR
  ::
   DUP
   TYPERARRY?
   NcaseTYPEERR
   TOTEMPOB
   RevArr
  ;
  THREE
Rev$
  
 ;

NIBB 3 000
xNAME ZALPHA
 ::
  CK1&Dispatch
  ONE
  ::
   FIFTYFOUR
   TestUserFlag
   NOTcase
   ::
    TRUE
    SWAP
    Zalpha
   ;
   FALSE
   OVER
   Zalpha
   ZNewton
   ZNewton
   SWAPDROP
  ;
 ;

NIBB 3 000
xNAME TALPHA
 ::
  CK2&Dispatch
  2REAL
  ::
   FIFTYFOUR
   TestUserFlag
   NOTcase
   Talpha
   SWAP2DUP
   SWAP
   Talpha
   TNewton
   TNewton
   BEGIN
   DUP4UNROLL
   TNewton
   4ROLLOVER
   %-
   %ABS
   % .0000000002
   %<
   UNTIL
   ROTROT2DROP
  ;
 ;

NIBB 3 000
xNAME UTPG
 ::
  CK2&Dispatch
  2REAL
  ::
   FALSE
   IGammFun
   %1-
   %CHS
  ;
 ;

*NIBB 3 000
*xNAME IGF
* ::
*  CK2&Dispatch
*  2REAL
*  ::
*   TRUE
*   IGammFun
*  ;
* ;

NIBB 3 000
xNAME DIGAMMA
 ::
  CK1&Dispatch
  ONE
  ::
   DUP
   %9
   %>=
   case
   ::
    %>%%
    DUP
    %%10
    %%+
    DUP
    %%LN
    OVER
    %%2
    %%*
    %%1/
    %%-
    OVERDUP
    %%*
    %%12
    %%*
    %%1/
    %%-
    OVER
    %%4
    %%^
    %% 120
    %%*
    %%1/
    %%+
    OVER
    %% 6
    %%^
    %% 252
    %%*
    %%1/
    %%-
    SWAP
    %% 8
    %%^
    %% 240
    %%*
    %%1/
    %%+
    OVER
    %%1/
    %%-
    SWAP
    NINE
    ZERO_DO
    %%1
    %%+
    DUPUNROT
    %%1/
    %%-
    SWAP
    LOOP
    DROP
    %%>%
   ;
   DUPDUP
   %>%%
   SWAP
   %FP
   %>%%
   %%10
   %%+
   DUP
   %%LN
   OVER
   %%2
   %%*
   %%1/
   %%-
   OVERDUP
   %%*
   %%12
   %%*
   %%1/
   %%-
   OVER
   %%4
   %%^
   %% 120
   %%*
   %%1/
   %%+
   OVER
   %% 6
   %%^
   %% 252
   %%*
   %%1/
   %%-
   SWAP
   %% 8
   %%^
   %% 240
   %%*
   %%1/
   %%+
   OVER
   %%1/
   %%-
   SWAP
   %10
   4ROLL
   %IP
   %-
   COERCE
   ONE_DO
   %%1
   %%+
   DUPUNROT
   %%1/
   %%-
   SWAP
   LOOP
   DROP
   %%>%
  ;
 ;

NIBB 1 8
xNAME UNI
 ::
  CK1&Dispatch
  ONE
  ::
   COERCE
   DUPONE
   TWO{}N
   %0
   MAKEARRY
   SWAP
   #1+_ONE_DO
   %RAN
   INDEX@
   PUTREALEL
   LOOP
  ;
  FIVE
  ::
   TwoListRE?
   COERCE2
   2DUP
   TWO{}N
   %0
   MAKEARRY
   3UNROLL
   #*
   #1+_ONE_DO
   %RAN
   INDEX@
   PUTREALEL
   LOOP
  ;
 ;

NIBB 1 8
xNAME NORM
 ::
  CK0
  %RAN
  %LN
  %-2
  %*
  %SQRT
  %RAN
  %>%%
  %%2PI
  %%*
  %%SINRAD
  %%>%
  %*
 ;

NIBB 1 8
xNAME NNORM
 ::
  CK3&Dispatch
  3REAL
  ::
   OVER
   %0>
   NcaseSIZEERR
   COERCE
   DUP#0=case
   SETSIZEERR
   SWAPDUP
   %*
   %-2
   %*
   3PICK
   %0=
   4NULLLAM{}
   BIND
   3GETLAM
   TWO
   #/
   #+
    ZERO_DO
    BEGIN
    %RAN
    %.5
    %-
    %RAN
    %.5
    %-
    OVERDUP
    %*
    OVERDUP
    %*
    %+
    DUP
    % .25
    %>
    WHILE
    3DROP
    REPEAT
    DUP
    %LN
    % 1.38629436112
    %+
    2GETLAM
    %*
    SWAP
    %/
    %SQRT
    DUPUNROT
    %*
    3UNROLL
    %*
    1GETLAM
    ?SKIP
    ::
     4GETLAM
     %+
     SWAP
     4GETLAM
     %+
    ;
    LOOP
   3GETLAM
   TWO
   #/
   DROP
   NDROP
   3GETLAM
   UNCOERCE
   %1
   TWO{}N
   XEQ>ARRAY
   ABND
  ;
 ;


 NIBB 1 8
 xNAME MAKERN
::
 CK1&Dispatch
 ONE
 ::
  COERCEDUP
  125000 #<
  NcaseSIZEERR
  DUPDUP
  #>HXS
  SWAP
  EXPAND
  '
  ::
MakeRN    ;
  SWAP
  >HCOMP
  '
  CK0NOLASTWD
  >HCOMP
  $ "RAN"
  ROT
  #>$
  &$
  $>ID
  ?STO_HERE
 ;
;
NIBB 1 8
xNAME STEST
 ::
  CK2&Dispatch
  EIGHTYONE
  ::
   COERCE
   DUP#0=case
   2DROP
   DOCLLCD
   SWAP
   DUPLENCOMP
   DUP
   ONE{}N
   %0
   MAKEARRY
   DUP
   TOTEMPOB
   ZERO
   ZERO
   '
   NULLLAM
   SEVEN
   NDUPN
   DOBIND
   7GETLAM
   #1+_ONE_DO
   5GETLAM
   #1+_ONE_DO
   INDEX@
   DUP
   UNCOERCE
   %RAN
   %*
   %CEIL
   COERCE
   UNROLL
   LOOP
   5GETLAM
   {}N
   1PUTLAM
   5GETLAM
   #1+_ONE_DO
   6GETLAM
   1GETLAM
   INDEX@
   NTHCOMPDROP
   DUP
   2PUTLAM
   NTHCOMPDROP
   TOTEMPOB
   ID TestPrg
   DEPTH
   #0<>
   DUP
   ITE
   ::
    OVER
    TYPEREAL?
   ;
   FALSE
   ANDNOTcase
:: "Error: Invalid or\nMissing 'TestPrg'"
* You might have to edit the above string to get the newline right.
  DO$EXIT ;
   4GETLAM
   2GETLAM
   PULLREALEL
   3PICK
   %+
   2GETLAM
   PUTREALEL
   DROP
   3GETLAM
   2GETLAM
   PULLREALEL
   ROTDUP
   %*
   %+
   2GETLAM
   PUTREALEL
   DROP
   INDEX@
   #>$
   DISP@17
   LOOP
   INDEX@
   #>$
   DISP@25
   LOOP
   4GETLAM
   7GETLAM
   UNCOERCE
   DUPDUP
   7PUTLAM
   %1-
   1PUTLAM
   x/
   3GETLAM
   5GETLAM
   #1+_ONE_DO
   INDEX@
   PULLREALEL
   ROT
   INDEX@
   PULLREALEL
   DUP
   %*
   7GETLAM
   %*
   SWAP
   4UNROLL
   %-
   1GETLAM
   DUP%0=
   ITE
   SWAPDROP
   %/
   %SQRT
   INDEX@
   PUTREALEL
   LOOP
   DUP
   1GETLAM
   % 50
   %<
   ITE
   ::
    1GETLAM
    DUP%0=
    ?SEMI
    % .025
    Talpha
   ;
   % 1.95996398454
   7GETLAM
   %SQRT
   %/
   x*
   3PICKOVER
   x-
   4PICK
   ROT
   x+
   %1
   5GETLAM
   DUP#1=
   ITE
   DROP
   ::
    ONE_DO
    DUP
    %1+
    LOOP
   ;
   DUP
   ONE{}N
   XEQ>ARRAY
   5UNROLL
   FIVE
   ROMPTR C3 16
* Body of COL->
   ABND
  ;
 ;
 NIBB 1 8
xNAME PREGR
 ::
  CK2NOLASTWD
  CK&DISPATCH1
  ARRYREAL
  ::
   COERCEDUP
   TWO
   #<case
   SETSIZEERR
   OVER
   TYPERARRY?
   NcaseTYPEERR
   1LAMBIND
   DUP
   ARSIZE
   #1+_ONE_DO
   INDEX@
   PULLREALEL
   %1
   SWAPDUP
   1GETLAM
   ONE_DO
   2DUP
   %*
   SWAP
   LOOP
   DROP
   1GETLAM
   #2+ROLL
   LOOP
   ARSIZE
   1GETABND
   #1+
   UNCOERCE2
   TWO{}N
   XEQ>ARRAY
  ;
 ;

NULLNAME XInDOk?
::
OVERSWAP XYInDOk?
SWAPDROP ;

NULLNAME XYInDOk?
   CODE
	GOSBVL	=SAVPTR
	C=DAT1	A
	D0=C
	A=DAT0	A
	LC(5)	=DOARRY
	?C#A	A
	GOYES	err1
	D0=D0+	10
	A=DAT0	A
	LC(5)	=DOREAL
	?C#A	A
	GOYES	err1
	D0=D0+	5
	A=DAT0	A
	A=A-1	A
	A=A-1	A
	A=A-1	A
	GONC	err1
	D0=D0+	5
	A=DAT0	A
	?A=0	A
	GOYES	err1
	D0=D0+	5
	C=DAT0	A
	?C=0	A
	GOYES	err1
	D1=D1+	5
	A=DAT1	A
	D0=A
	D0=D0+	5
	A=DAT0	A
	A=A-1	A
	?C<=A	A
	GOYES	err2
	D1=D1+	5
	A=DAT1	A
	D0=A
	D0=D0+	5
	A=DAT0	A
	A=A-1	A
	?C<=A	A
	GOYES	err2
	GOVLNG	=GETPTRLOOP
err1	LA(5)	#41201
	GOVLNG	=Errjmp
err2	LA(5)	#41202
	GOVLNG	=Errjmp
ENDCODE

NULLNAME OkAsDat?
 CODE
	A=DAT1	A
	CD0EX
	RSTK=C
	D0=A
	A=DAT0	A
	LC(5)	=DOARRY
	?C#A	A
	GOYES	err3
	D0=D0+	10
	A=DAT0	A
	LC(5)	=DOREAL
	?C#A	A
	GOYES	err3
	D0=D0+	5
	A=DAT0	A
	A=A-1	A
	A=A-1	A
	A=A-1	A
	GONC	err3
	D0=D0+	5
	A=DAT0	A
	?A=0	A
	GOYES	err3
	D0=D0+	5
	A=DAT0	A
	?A=0	A
	GOYES	err3
	C=RSTK
	D0=C
	GOVLNG	=Loop
err3	C=RSTK
	D0=C
	LA(5)	#41201
	GOVLNG	=Errjmp
ENDCODE

NULLNAME TwoListRE?
 ::
  PTR 51519
  DTYPEREAL?
  NcaseSIZEERR
  OVER
  TYPEREAL?
  NcaseSIZEERR
 ;

 NULLNAME Madd
 ::
  DUP
  TYPERARRY?
  NcaseTYPEERR
  TOTEMPOB
  DUP
  ARSIZE
  #1+_ONE_DO
  INDEX@
  DUPUNROT
  PULLREALEL
  4PICK
  %+
  ROT
  PUTREALEL
  LOOP
  SWAPDROP
 ;

NULLNAME RevArr
 CODE
	GOSBVL	=SAVPTR
	A=DAT1	A
	D1=A
	D1=D1+	5
	C=DAT1	A
	B=C	A
	C=C+A	A
	D0=C
	D0=D0-	11
	D1=D1+	10
	C=DAT1	A
	C=C-1	A
	?C=0	A
	GOYES	L84338
	LC(5)	#19
	D1=D1+	15
	GONC	L84342
L84338	LC(5)	#14
	D1=D1+	10
L84342	A=B	A
	A=A-C	A
	ASR	A
	ASRB.F	A
	B=A	A
L8434F	B=B-1	A
	GOC	L8436D
	A=DAT1	W
	C=DAT0	W
	DAT0=A	W
	DAT1=C	W
	D1=D1+	16
	D0=D0-	16
	GONC	L8434F
L8436D	GOVLNG	=GETPTRLOOP
ENDCODE

 NULLNAME Sort2
 CODE
	GOSBVL	=SAVPTR
	A=DAT1	A
	D1=A
	D1=D1+	5
	C=DAT1	A
	A=A+C	A
	LC(5)	#1B
	A=A-C	A
	R4=A
	D1=D1+	10
	A=DAT1	A
	D1=D1+	5
	C=DAT1	A
	A=A-CON	A,2
	GOC	L843C8
	D1=D1+	5
L843C8	D1=D1-	11
	D1=D1-	16
	AD1EX
	R3=A
	R2=C
	CSRB.F	A
	D=C	A
	C=C-1	A
	GOC	L8442D
L843E3	C=D	A
	B=C	A
	GOSUB	L8447B
	D=D-1	A
	?D#0	A
	GOYES	L843E3
	C=R2
	D=C	A
	D=D-CON	A,2
	GONC	L84404
L84400	GOSUB	L8447B
L84404	B=0	A
	B=B+1	A
	LC(5)	#20
	A=R3
	A=A+C	A
	D1=A
	A=R4
	D0=A
	A=A-C	A
	R4=A
	GOSUB	L84436
	D=D-1	A
	GONC	L84400
L8442B	C=RSTK
L8442D	P=	0
	GOVLNG	=GETPTRLOOP
L84436	A=DAT0	W
	C=DAT1	W
	DAT1=A	W
	DAT0=C	W
	D0=D0+	16
	D1=D1+	16
	A=DAT0	W
	C=DAT1	W
	DAT1=A	W
	DAT0=C	W
	D0=D0+	16
	D1=D1+	16
	LC(5)	#20
	AD1EX
	A=A-C	A
	AD1EX
	AD0EX
	A=A-C	A
	AD0EX
	RTN
L8447B	D1=(5)	#4226C
	C=DAT1	A
	D1=C
	C=DAT1	A
	C=C-1	A
	GONC	L8442B
	BSL	A
	C=B	A
	B=B+B	A
	A=R3
	A=A+B	A
L8449B	D1=A
	A=A+B	A
	D0=A
	B=B+B	A
	C=R4
	?C>A	A
	GOYES	L844B4
	?C=A	A
	GOYES	L844DD
	RTN
L844B4	C=DAT0	W
	D0=D0+	16
	D0=D0+	16
	A=DAT0	W
	GOSUB	L844F7
	LC(5)	#20
	GOC	L844D5
	B=B+C	A
	GONC	L844DD
L844D5	AD0EX
	A=A-C	A
	AD0EX
L844DD	C=DAT0	W
	A=DAT1	W
	GOSUB	L844F7
	RTNNC
	GOSUB	L84436
	AD0EX
	GOTO	L8449B
L844F7	SETDEC
	GOSBVL	=Y<=X
	SETHEX
	P=	0
	RTN
ENDCODE

 NULLNAME Test2
 ::
  OVER
  TYPERARRY?
  OVER
  TYPERARRY?
  AND
  NcaseTYPEERR
  OVER
  ARSIZE
  OVER
  ARSIZE
  EQUAL
  ?SEMI
  # 501
  ERROROUT
 ;

NULLNAME MetaToVec
 ::
  CKNNOLASTWD
  UNCOERCE
  ONE{}N
  XEQ>ARRAY
 ;

 NULLNAME ListToVec
 ::
  DUPLENCOMP
  DUP#0=IT
  SETSIZEERR
  ONE{}N
  %0
  MAKEARRY
  CODE
	GOSBVL	=PopASavptr
	R0=A
	D0=A
	A=DAT1	A
	D1=A
	D1=D1+	5
	D0=D0+	9
	LC(5)	=DOREAL
	B=C	A
L84946	D0=D0+	16
	A=DAT1	A
	D1=D1+	5
	?A#B	A
	GOYES	L84963
	A=DAT1	W
	D1=D1+	16
	DAT0=A	W
	GONC	L84946
L84963	AD1EX
	C=DAT1	A
	?B#C	A
	GOYES	L84980
	D1=D1+	5
	C=DAT1	W
	DAT0=C	W
	D1=A
	GONC	L84946
L84980	AD1EX
	LC(5)	=SEMI
	?C=A	A
	GOYES	L8499D
	LC(5)	#202
	GOVLNG	=GPErrjmpC
L8499D	GOVLNG	=GPOverWrR0Lp
ENDCODE
 ;

 NULLNAME MatToVec
 ::
  DUP
  ARSIZE
  ONE{}N
  MATREDIM
 ;

* ID x029
* ::
*  DUP
*  ARSIZE
*  ONE
*  TWO{}N
*  MATREDIM
*  ONE
* ;

NULLNAME SumSQ
 ::
  %%0
  FALSE
  .CmXX
  %%>%
 ;

NULLNAME IGammFun
 ::
  UNROTOVER
  %0>
  NcaseSIZEERR
  DUP
  %0>
  NOTcase
  ::
   3DROP
   %0
  ;
  2DUP
  %-
  %-1
  %<
  ITE
  ::
   2DUPSWAP
   %^
   OVER
   %EXP
   %/
   3UNROLL
   %1
   3PICK
   %-
   %1
   DUP
   5PICK
   %1+
   %0
   RNDXY
   COERCE
   #2*
   FOUR
   #MIN
   DUP1LAMBIND
   ONE_DO
   4PICK
   4PICK
   %1+
   %1
   4PICK
   %1+
   LOOP
   4PICK
   1GETABND
   ZERO_DO
   %/
   %+
   %/
   %+
   LOOP
   %1/
   ROT
   %*
   SWAP
   %1-
   %FACT
   DUPUNROT
   %-
   %CHS
  ;
  ::
   OVERDUP
   %1-
   %FACT
   4UNROLL
   %1+
   2DUP
   %/
   DUP
   %1+
   SWAP
   BEGIN
   4PICK
   4ROLL
   %1
   %+
   DUP
   5UNROLL
   %/
   %*
   DUPUNROT
   %+
   SWAPDUP
   % .00007
   %<
   UNTIL
   4PICK
   4ROLL
   %1+
   %/
   %*
   %+
   3UNROLL
   2DUPSWAP
   %^
   3UNROLL
   %EXP
   SWAP
   %*
   %/
   %*
  ;
  SWAPROT
  caseDROP
  %/
 ;

 NULLNAME Talpha
 ::
  SWAPDUP
  %0>
  NcaseSIZEERR
  %0
  RNDXY
  DUPDUP
  %*
  2DUP
  %*
  '
  NULLLAM
  DUPDUP
  THREE
  DOBIND
  FALSE
  SWAP
  Zalpha
  DUP
  2DUP
  1GETLAM
  2GETLAM
  % .125
  %*
  %+
  3GETLAM
  % .15625
  %*
  %-
  % .041015625
  %-
  %*
  % .25
  %*
  UNROTDUP
  %*
  DUPROT
  %*
  DUP
  1GETLAM
  % .25
  %*
  2GETLAM
  % .166666666667
  %*
  %+
  3GETLAM
  % .0442708333333
  %*
  %+
  % .0208333333333
  %-
  %*
  UNROTOVER
  %*
  DUP
  2GETLAM
  % .0520833333333
  %*
  3GETLAM
  % .0494791666667
  %*
  %+
  % .0160807291667
  %+
  %*
  UNROTOVER
  %*
  DUP
  3GETLAM
  % .0078125
  %*
  % .00842013888889
  %+
  %*
  3UNROLL
  %*
  % .000857204861111
  %*
  %+
  %+
  %+
  %+
  2GETLAM
  DUP
  %*
  %/
  %+
  ABND
 ;

 NULLNAME Zalpha
 ::
  DUP
  %1
  %<=
  OVER
  %0>=
  ANDNOTcase
  SETSIZEERR
  DUP
  %.5
  %=
  case2drop
  %0
  %>%%
  DUP
  %%.5
  %%>
  ITE
  ::
   TRUE
   %%1
   ROT
   %%-
  ;
  ::
   FALSE
   SWAP
  ;
  ROT
  ITE
  ::
   DUP
   2DUP
   %%*
   2DUP
   %%*
   %% -.0238569544311
   %%*
   SWAP
   %% .00928706503605
   %%*
   %%+
   SWAP
   %% .00232969827698
   %%*
   %%+
   %% .000483968950023
   %%-
  ;
  %%0
  SWAP
  %%LN
  %% -2
  %%*
  %%SQRT
  DUPDUP
  DUP
  %%*
  DUP
  %% .010328
  %%*
  3PICK
  %% .802853
  %%*
  %%+
  %% 2.515517
  %%+
  3UNROLL
  2DUP
  %%*
  %% .001308
  %%*
  SWAP
  %% .189269
  %%*
  %%+
  SWAP
  %% 1.432788
  %%*
  %%+
  %%1
  %%+
  %%/
  %%-
  %%+
  %%>%
  SWAP
  case
  %CHS
 ;

NULLNAME TNewton
 ::
  2DUPSWAP
  %0
  CODE
	GOSBVL	#77E62
	GOSBVL	#78077
	GOSBVL	=PACK
	GOVLNG	=PUSH%LOOP
ENDCODE
  4PICK
  %-
  OVERDUP
  %*
  4PICK
  %/
  %1+
  4PICK
  %1+
  %2
  %/
  DUPUNROT
  %^
  SWAP
  %1-
  %FACT
  %/
  %*
  3PICK
  DUP
  %2
  %/
  %1-
  %FACT
  SWAP
  %PI
  %*
  %SQRT
  %*
  %*
  %+
 ;

 NULLNAME ZNewton
 ::
  DUP
  %>%%
  CODE
	GOSBVL	#77EA8
	GOSBVL	#77EBC
	GOSBVL	=PACK
	GOVLNG	=PUSH%LOOP
ENDCODE
  3PICK
  %-
  % 2.50662827463
  %*
  OVERDUP
  %*
  %2
  %/
  %EXP
  %*
  %+
 ;

 NULLNAME Medi
 ::
  SWAP
  ColM
  Qsrt
  DUP
  ARSIZE
  TWO
  #/
  SWAP2DUP
  #+
  4ROLLSWAP
  PULLREALEL
  4UNROLL
  3UNROLL
  #1=
  ITE
  2DROP
  ::
   #1+
   PULLREALEL
   SWAPDROP
   %+
   %2
   %/
  ;
 ;

 NULLNAME Ptile
 ::
  DUP
  %0>=
  OVER
  %100
  %<=
  ANDNOTcase
  SETSIZEERR
  SWAP
  TOTEMPOB
  Qsrt
  DUP
  ARSIZE
  UNCOERCE
  %1-
  ROT
  %*
  %100
  %/
  %1+
  DUP
  %FP
  %0=case
  ::
   DROP
   COERCE
   PULLREALEL
   SWAPDROP
  ;
  3UNROLL
  DUPUNROT
  %CEIL
  COERCE
  PULLREALEL
  SWAPROT
  %FLOOR
  COERCE
  PULLREALEL
  SWAPDROP
  %1
  4PICK
  %-
  %*
  3UNROLL
  %*
  %+
 ;

NULLNAME RevSt
 ::
  ONE
  OVER
  #<
  IT
  CODE
	GOSBVL	=SAVPTR
	GOSBVL	=POP#
	C=A	A
	C=C+C	A
	C=C+C	A
	C=C+A	A
	B=0	W
	B=A	A
	BSRB
	AD1EX
	D1=A
	A=A+C	A
	D0=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HEX
	P=	0
	GONC	L856B1
	CAEX	W
	DAT1=C	W
	C=B	W
	DAT0=C	W
	GOTO	L8568F
L856DF	D1=D1+	16
L856E2	A=R3
	C=R4
	D0=C
	GOSUB	L85610
	AD1EX
	GOSUB	L85705
	D1=C
	GOSUB	L85610
L856FD	GOSUB	L85705
	PC=C
L85705	C=R4
	C=C-CON	A,5
	R4=C
	CD0EX
	C=DAT0	A
	RTN
ENDCODE

NULLNAME WVar
 ::
  %0
  %0
  .XYDatCK
  DUP
  MDIMS
  DROPSWAPDROP
  4ROLL
  4ROLL
  2DUPSWAP
  #-
  4ROLL
  '
  NULLLAM
  DUPDUP
  THREE
  DOBIND
  SWAPDUP
  ARSIZE
  #1+
  ROT
  DO
  INDEX@
  DUPUNROT
  PULLREALEL
  SWAPROT
  2GETLAM
  #+
  PULLREALEL
  3PICK
  %*
  DUP
  6ROLL
  %+
  5UNROLL
  ROT
  %*
  ROT
  %+
  SWAP
  1GETLAM
  +LOOP
  3GETLAM
  SWAP
  .CmTOT
  ROTDUP
  %*
  OVER
  %/
  ROTSWAP
  %-
  SWAP
  ABND
 ;

 NULLNAME VecDriver
 ::
  'R
  ROTDUP
  MDIMS
  ITE
  2DROP
  ::
   1 TWO{}N MATREDIM
  ;
 
  OkAsDat?
  DUP
  MDIMSDROP
  SWAP
  5ROLL
  #>?SKIP
  InsSErr
  DUPONE
  #=case
  ::
   SWAPROT
   EVAL
  ;
  .DUPMakeVec
  SWAP
  #1+_ONE_DO
  INDEX@
  3PICK
  5PICK
  EVAL
  INDEX@
  PUTREALEL
  LOOP
  ROTROT2DROP
 ;
 
*ID x036
* ::
*  SWAP
*  .CmTOT
* ;

*NULLNAME SDev0
* ::
*  SWAPDUP
*  MDIMS
*  2DROP
*  #1<>
*  NOTcase2drop
*  %0
*  .CmSDEV
* ;
 
NULLNAME ArrDiv
 ::
  DTYPEREAL?
  case
  ::
   'EvalNoCK:
   x/
  ;
  TOTEMPSWAP
  DUPDUP
  TYPERARRY?
  NcaseTYPEERR
  ARSIZE
  #1+_ONE_DO
  INDEX@
  DUPUNROT
  PULLREALEL
  4ROLL
  4PICK
  PULLREALEL
  ROTSWAP
  %/
  4ROLL
  PUTREALEL
  SWAP
  LOOP
  DROP
 ;

 NULLNAME SqArr
 ::
  TOTEMPOB
  DUP
  ARSIZE
  #1+_ONE_DO
  INDEX@
  DUPUNROT
  PULLREALEL
  DUP
  %*
  ROT
  PUTREALEL
  LOOP
 ;

* ID x03A
* ::
*  ID x029
*  ID x036
* ;
 
*ID x03B
* ::
*  ID x029
*  SWAP
*  SumSQ
* ;
 
NULLNAME Bins
 ::
  4PICK
  MDIMS
  ITE
  ::
   SWAPDROP
   #1=
   ?SEMI
   # 501
   ERROROUT
  ;
  DROP
  #2+
  DUP
  DUP1LAMBIND
  ONE{}N
  C%0
  MAKEARRY
  SWAP
  #2*
  TWO
  DO
  3PICK
  INDEX@
  PUTREALEL
  SWAPROT
  OVER
  %+
  SWAPROT
  TWO
  +LOOP
  %MAXREAL
  1GETLAM
  #2*
  PUTREALEL
  ROTROT2DROP
  SWAP
  BinsCore
 ;

NULLNAME BinsCore
 ::
  CODE
	GOSBVL	=PopASavptr
	D0=A
	D0=D0+	15
	A=DAT0	A
	D0=D0+	5
	C=DAT0	A
	D=C	A
	A=A-1	A
	A=A-1	A
	GOC	L85BAF
	D0=D0+	5
L85BAF	D0=D0+	5
	A=DAT1	A
	D1=A
	D1=D1+	16
	D1=D1+	4
	LC(5)	#20
	B=C	A
	C=DAT1	A
	CSRB.F	A
	CSL	A
	C=C+C	A
	D1=D1+	16
	D1=D1+	5
	AD1EX
	R0=A
	C=C+A	A
	D1=C
	C=C+B	A
	R1=C
	C=DAT1	W
	B=C	W
L85BF0	D=D-1	A
	GOC	L85C40
	C=DAT0	W
	LA(3)	#499
	?C#A	X
	GOYES	L85C09
	C=C-1	X
L85C09	A=B	W
	SETDEC
	GOSBVL	=Y<=X
	P=	0
	A=R1.F	A
	GOC	L85C26
	A=R0.F	A
L85C26	D1=A
L85C29	A=DAT1	W
	GOSBVL	=Y<=X
	GONC	L85C47
	D1=D1+	16
	D1=D1+	16
	GONC	L85C29
L85C40	GOVLNG	=GETPTRLOOP
L85C47	SETHEX
	P=	0
	D1=D1-	16
	A=DAT1	A
	A=A+1	A
	DAT1=A	A
	D0=D0+	16
	GONC	L85BF0
ENDCODE
  1GETLAM
  ONE{}N
  %0
  MAKEARRY
  SWAP
  CODE
	GOSBVL	=PopASavptr
	D0=A
	D0=D0+	16
	D0=D0+	4
	C=DAT0	A
	D=C	A
	D=-D	A
	D=D+1	A
	D0=D0+	5
	C=DAT1	A
	D1=C
	D1=D1+	16
	D1=D1+	9
	A=DAT0	W
	GOSBVL	=HXDCW
	GOSBVL	=FLOAT
	SETHEX
	P=	0
	R4=A
	D0=D0+	16
	D0=D0+	16
L85CC6	A=DAT0	W
	GOSBVL	=HXDCW
	GOSBVL	=FLOAT
	SETHEX
	P=	0
	DAT1=A	W
	D0=D0+	16
	D0=D0+	16
	D1=D1+	16
	D=D+1	A
	GONC	L85CC6
	A=R4
	DAT1=A	W
	GOVLNG	=GETPTRLOOP
ENDCODE
  1GETLAM
  DUPUNROT
  #1-
  PULLREALEL
  SWAPROT
  PULLREALEL
  ROT
  {
   %2
  }
  XEQ>ARRAY
  SWAP
  1GETABND
  #2-
  ONE
  TWO{}N
  MATREDIM
  SWAP
 ;

 NULLNAME Trn
 ::
  DUP 
 CKREF SWAP
  TrnCode
  ;
  NULLNAME !Trn
  ::
   DUP CKREF
   TrnCode
  ;
NULLNAME TrnCode
  CODE
	GOSBVL	=PopASavptr
	D0=A
	D0=D0+	10
	A=DAT0	A
	ST=0	1
	LC(5)	=DOREAL
	?C=A	A
	GOYES	L85DA5
	ST=1	1
L85DA5	D0=D0+	5
	A=DAT0	A
	A=A-1	A
	?A#0	A
	GOYES	L85DCA
	LA(5)	#501
	GOSBVL	=GETPTR
	GOVLNG	=Errjmp
L85DCA	D0=D0+	5
	A=DAT0	A
	D0=D0+	5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	GOYES	L8610A
L860F9	LA(5)	#203
	GOVLNG	=Errjmp
L8610A	R1=A
	GOSBVL	=PopASavptr
	D1=A
	D1=D1+	15
	A=DAT1	A
	LC(2)	2
	?C=A	B
	GOYES	L86148
	A=R0
	A=A-1	A
	?A=0	A
	GOYES	L8613B
	GOSBVL	=GETPTR
	GOTO	L860F9
L8613B	AD1EX
	A=A-CON	A,15
	GOTO	L86203
L86148	D1=D1+	5
	C=DAT1	A
	R3=C
	D1=D1+	5
	A=DAT1	A
	C=R1
	?C<=A	A
	GOYES	L8616A
	GOSBVL	=GETPTR
	GOTO	L860F9
L8616A	ASL	A
	R4=A
	D1=D1+	5
	A=R1
	A=A-1	A
	ASL	A
	CD1EX
	C=C+A	A
	R2=C
	A=R3
	ASL	A
	LC(5)	#14
	C=C+A	A
	ST=1	10
	GOSBVL	#5B80
	D0=D0-	10
	LC(5)	=DOARRY
	DAT0=C	A
	D0=D0+	10
	LC(5)	=DOREAL
	DAT0=C	A
	D0=D0+	5
	LC(5)	2
	DAT0=C	A
	D0=D0+	5
	C=R3
	DAT0=C	A
	D0=D0+	5
	C=0	A
	C=C+1	A
	DAT0=C	A
	D0=D0+	5
	C=R2
	D1=C
	C=R3
	D=C	A
	D=-D	A
	C=R4
	B=C	A
L861E8	C=DAT1	W
	DAT0=C	W
	D0=D0+	16
	AD1EX
	A=A+B	A
	D1=A
	D=D+1	A
	GONC	L861E8
	A=R0
L86203	GOSBVL	=GETPTR
	D1=D1-	5
	D=D-1	A
	DAT1=A	A
	A=DAT0	A
	D0=D0+	5
	PC=(A)
ENDCODE

NULLNAME InsSErr
:: # 41203 ERROROUT ;

NULLNAME MatToCol
:: DUP ARSIZE 1 TWO{}N MATREDIM ;
NULLNAME HMean
::
%1  SWAPROT ColM
RADiv ONE OVER .CmTOT
SWAP .NROWS SWAP %/ 
;
NULLNAME RADiv
:: TOTEMPOB
   DUP
   ARSIZE
   #1+_ONE_DO
   INDEX@
   DUPUNROT
   PULLREALEL
   4PICKSWAP
   %/
   ROT
   PUTREALEL
   LOOP
   SWAPDROP
;
NULLNAME Manip
::
SWAP
COERCE
DUP#0=
caseSIZEERR
  ROTDUP
  OkAsDat?
MDIMSDROP
DUP 6UNROLL
4PICKOVER
2DUP
#1+ #>
caseSIZEERR
#>
ITE
::
 ROT
 Trn
3PICK ROT
#1+    DUP4UNROLL
SWAP TWO{}N
MATREDIM
Trn
 ;
::
ROT TOTEMPOB 
;

 { LAM 'Man NULLLAM
LAM 'S
NULLLAM
NULLLAM
LAM 'A
 }
 BIND
R C #* #1+ LAM 'S
DO
PR COMPEVAL
CK1NOLASTWD CKREAL
LAM 'A SWAP INDEX@
PUTREALEL DROP
C +LOOP
LAM 'A ABND
 ; 
NULLNAME VecPros
:: CK2NOLASTWD
COERCE
DUP#0=IT
:: DROP MatToCol 1 ;
SWAP
XInDOk?
;
NULLNAME NegRow
::
SWAPCKREF
SWAP
!NegRow 
;
NULLNAME !NegRow
 CODE
	GOSBVL	=PopASavptr
	D0=A
	D0=D0+	5
	C=DAT0	A
	D=C	A	D=ROWNR
	A=DAT1	A
	D1=A
	D1=D1+	15
	A=DAT1	A
	D1=D1+	5
	C=DAT1	A	C=#ROWS
	?D>C	A
	GOYES	err
	D1=D1+	5	or #Elem
	A=A-1	A
	A=A-1	A
	GOC	1Dim
	A=DAT1	A	A=#COLS
	R1=A
	D1=D1+	5
con	?D#0	A
	GOYES	1Row
	GOSBVL	=MUL#	B=TOT#
run	B=-B	A
	DSL	A
	C=D1
	C=C+D	A
	D1=C
loop	A=DAT1	W
	?A=0	W
	GOYES	ok
	SETDEC
	A=-A-1	S
	SETHEX
	DAT1=A	W
ok	D1=D1+	16
	B=B+1	A
	GONC	loop
	GOVLNG	=GETPTRLOOP		
1Row	C=D	A
	C=C-1	A
	GOSBVL	=MUL#
	C=B	A
	D=C	A	D=(R-1)*C
	A=R1
	B=A	A	B=#COLS
	GOTO	run
1Dim	A=0	A
	A=A+1	A	A=1
	R1=A		R1=1
	GONC	con	
err	LA(5)	#203
	GOVLNG	=Errjmp
ENDCODE
NULLNAME MAddAA 
::

  CKREF
  SWAPDUP
   ARSIZE
   #1+_ONE_DO
   INDEX@
   DUPUNROT
   PULLREALEL
   4ROLL
   4PICK
   PULLREALEL
   ROTSWAP
   %+
   4ROLL
   PUTREALEL
   SWAP
   LOOP
   DROP
  ;
  NULLNAME Meta
::  DUP#0=
   casedrop
   %0
   %1
   SWAP
   DUP#1=
   ?SKIP
   ::
    ONE_DO
    DUP
    %1+
    LOOP
    DUP
   ;
   DROPDUP
 ;
 NULLNAME ColSort
 ::
    OVER
    TYPERARRY?
    NcaseTYPEERR
    DUP
    %0<
    3UNROLL
    %ABSCOERCE
    OVERSWAP
    ColM
    OVER
    MDIMSDROP
    DUP#1=
    case
    ::
     2DROP
     SWAPDROP
     Qsrt
     SWAP
     NOT?SEMI
     RevArr
    ;
    3UNROLL
    TWO
    SWAP
    TWO{}N
    MATREDIM
    SWAP4ROLL
    CODE
	GOSBVL	=popflag
	ST=0	0
	GONC	L82FAF
	ST=1	0
L82FAF	GOSBVL	=PopASavptr
	D0=A
	D0=D0+	5
	C=DAT0	A
	CSL	A
	D=C	A
	A=DAT1	A
	D1=A
	R0=A
	D1=D1+	16
	D1=D1+	9
	C=DAT1	A
	B=C	A
	?ST=0	0
	GOYES	L82FFF
	D1=D1+	5
	A=B	A
	A=-A	A
L82FE3	C=DAT1	W
	?C=0	M
	GOYES	L82FF7
	SETDEC
	C=-C-1	S
	SETHEX
	DAT1=C	W
L82FF7	D1=D1+	16
	A=A+1	A
	GONC	L82FE3
L82FFF	C=B	A
	B=-B	A
	CSL	A
	A=R0
	A=A+C	A
	LC(5)	#1E
	A=A+C	A
	D1=A
	C=0	A
L83018	DAT1=C	A
	D1=D1+	16
	C=C+D	A
	B=B+1	A
	GONC	L83018
	GOVLNG	=GETPTRLOOP
ENDCODE
    Trn
    Sort2
    OVER
    TOTEMPOB
    3UNROLL
    CODE
	A=DAT1	A
	LC(5)	#2E
	A=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
	GOC	L81A89
L81A83	D1=D1+	1
	GONC	L81A73
L81A89	C=0	S
	C=C+1	S
	DAT1=C	S
	A=B	A
	GOVLNG	=PUSH#ALOOP
L81A9C	LC(5)	#41204
	GOVLNG	=GPErrjmpC
ENDCODE
 SWAPDROP
 UNCOERCE
;
NULLNAME NDupn
CODE
	GOSBVL	=POP#
	C=A	A
	C=C-1	A
	GOC	drop
	RSTK=C
	D=D-C	A
	GOC	gc
rgc	A=DAT1	A
	GONC	test
-	D1=D1-	5
	DAT1=A	A
test	C=C-1	A
	GONC	-
	C=RSTK
	C=C+1	A
	GOVLNG	#7230
gc	GOSBVL	#341D
	GONC	rgc
drop	GOVLNG	=DROPZERO
ENDCODE
                                                                                
      
