2016-12-27 08:10:47 -08:00

27 lines
587 B
APL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

RM COMBIN N;D;E;F;G;P
⍝ Returns a matrix of every possible
⍝ combination of M elements from the
⍝ vector N. That is, returns a
⍝ matrix with M!N rows and N columns.
E(PN-RM-1)-⎕IO
DR+P
R(P,1)D
PP1
L1:(⎕IO>1DD-1)0
P+\P
G+\¯10,FP
EF/E-G
R(F/D),R[E+E;]
EG
L1
RM QUICKEXP N
⍝ Matrix exponentiation
B 1 + 2 N
V (B 2) N
L M
R +.× / V / L { L ( A +.× A L) , L }¨ B-1