/
spl.gi
71 lines (57 loc) · 2.12 KB
/
spl.gi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Import(paradigms.smp);
Class(fCubeTranspose, PermClass, rec(
domain := self >> self.params[1],
range := self >> self.params[1],
def := (N, stage, cube) -> rec(),
lambda := self >> let(i := Ind(self.params[1]), errExp(TInt)),
transpose := self >> self,
isIdentity := True
));
Class(fCubeEmbed, PermClass, rec(
domain := self >> self.params[3][1],
range := self >> self.params[1],
def := (N, stage, cube) -> rec(),
lambda := self >> let(i := Ind(self.params[1]), errExp(TInt)),
transpose := self >> self,
isIdentity := True
));
Class(MPIPrm, Prm,
rec(
dims := self >> let([self.func.range(), self.func.domain()])
));
Class(MPIRCPrm, Prm,
rec(
dims := self >> let(2*[self.func.range(), self.func.domain()])
));
Declare(MPITensor);
Class(MPISum, SMPSum);
Class(MPIGath, Gath);
Class(MPIScat, Scat);
Class(MPITensor, BaseMat, SumsBase, rec(
dims := self >> self.L.dims() * self.P,
isReal := self >> true,
#-----------------------------------------------------------------------
rChildren := self >> [self.L, self.P],
rSetChild := rSetChildFields("L", "P"),
#-----------------------------------------------------------------------
new := (self, L, P) >> SPL(WithBases(self,
rec(L := L,
P := P,
dimensions := L.dims()*P)
)),
#-----------------------------------------------------------------------
transpose := self >> MPITensor(self.L.transpose(), self.P),
#-----------------------------------------------------------------------
print := (self,i,is) >> Print(self.name, "(",
self.L.print(i+is,is), ", ", self.P, ")"),
#-----------------------------------------------------------------------
toAMat := self >> Tensor(I(self.P), self.L).toAMat(),
#-----------------------------------------------------------------------
isPermutation := False
));
Class(MPISumsgenMixin, rec(
MPITensor := (self, o, opts) >> let(p:= o.P, i:= Ind(p),
MPISum(p, i, p,
MPIScat(fTensor(fBase(i), fId(Rows(o.L)))) * o.L * MPIGath(fTensor(fBase(i), fId(Cols(o.L))))
))
));