-
Notifications
You must be signed in to change notification settings - Fork 5
/
hecke.hpp
354 lines (262 loc) · 8.98 KB
/
hecke.hpp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/*
This is hecke.cpp
Coxeter version 3.0 Copyright (C) 2002 Fokko du Cloux
See file main.cpp for full copyright notice
*/
#include "polynomials.h"
namespace hecke {
using namespace polynomials;
};
/*****************************************************************************
This module provides some definitions and functions (mostly output-oriented)
for Hecke algebra elements. We have refrained in this program from actually
implementing the Hecke algebra structure, which could easily lead to
immense computations. Our main purpose is to have convenient containers
for communicating data.
(For this reason also our coefficients are the ordinary k-l polynomials
in q, instead of Laurent polynomials in q^{1/2}, as they should be.)
Things are written as templates because various types of coefficients could
(and do, in this program) occur.
******************************************************************************/
namespace {
using namespace hecke;
template<class P> struct PPtrF {
typedef const P* valueType;
valueType operator() (const HeckeMonomial<P>& m) {return &m.pol();}
};
template<class P>
void appendStar(String& str, const HeckeMonomial<P>& m,
const SchubertContext& p, const Length& l);
template<class P>
Ulong maxLength(const List<HeckeMonomial<P> >& h, const SchubertContext& p,
const Interface& I, const Length& l);
template<class P>
void oneColumnPrint(FILE* file, const List<HeckeMonomial<P> >& h,
const Permutation& a, const SchubertContext& p,
const Interface& I, const Length& l, const Ulong& ls);
template<class P>
void twoColumnPrint(FILE* file, const List<HeckeMonomial<P> >& h,
const Permutation&a, const SchubertContext& p,
const Interface& I, const Length& l, const Ulong& ls);
};
/*****************************************************************************
Chapter II -- The HeckeMonomial class.
HeckeMonomial's are simply building blocks for HeckeElt's. They contain
a context number and a polynomial reference.
The following functions are defined :
- constructors and destructors :
- HeckeMonomial(x,pol);
- ~HeckeMonomial();
- accessors :
- manipulators :
- order(c) : orders according to c;
*****************************************************************************/
namespace hecke {
template <class P>
HeckeMonomial<P>::HeckeMonomial(const CoxNbr& x, const P* pol)
:d_x(x), d_pol(pol)
{}
template<class P> HeckeMonomial<P>::~HeckeMonomial()
/*
Automatic destruction is enough.
*/
{}
};
/*****************************************************************************
Chapter III -- Utilities.
This section defines some utility functions declared in hecke.h :
- append(str,m,p,I) : appends m to str using I;
- appendStar(str,m,p,l) : appends a star to str if there is a
mu-coefficient;
- maxLength(h,p,I,l) : computes the maximal length of an output line;
- oneColumnPrint(h,p,I,l,ls) : does one-column output;
- prettyPrint(f,h,I,l) : pretty-prints h on f, using I;
- singularStratification(hs,h,p) : puts in hs the singular stratification
of h;
- singularLocus(hs,h,p) : puts in hs the rational singular locus of h;
- twoColumnPrint(h,p,I,l,ls) : does two-column output;
*****************************************************************************/
namespace hecke {
template<class P>
void append(String& str, const HeckeMonomial<P>& m, const SchubertContext& p,
const Interface& I)
/*
Outputs m to str.
*/
{
p.append(str,m.x(),I);
io::append(str," : ");
polynomials::append(str,m.pol(),"q");
return;
}
};
namespace {
template<class P>
void appendStar(String& str, const HeckeMonomial<P>& m,
const SchubertContext& p, const Length& l)
{
Length lx = p.length(m.x());
if (static_cast<long>(2*m.pol().deg()) == static_cast<long>(l-lx-1))
append(str," *");
return;
}
template<class P>
Ulong maxLength(const List<HeckeMonomial<P> >& h, const SchubertContext& p,
const Interface& I, const Length& l)
/*
Returns the length of the longest line that would be printed out by
oneColumnPrint(file,h,I,l). This is a preliminary to prettyprinting.
*/
{
static String buf(0);
Ulong maxl = 0;
for (Ulong j = 0; j < h.size(); ++j) {
reset(buf);
const HeckeMonomial<P>& m = h[j];
hecke::append(buf,m,p,I);
appendStar(buf,m,p,l);
if (maxl < buf.length())
maxl = buf.length();
}
return maxl;
}
template<class P>
void oneColumnPrint(FILE* file,
const List<HeckeMonomial<P> >& h,
const Permutation& a,
const SchubertContext& p,
const Interface& I,
const Length& l,
const Ulong& ls)
/*
This function prints out the row in one-column format, trying to fold long
lines decently. The width of the column is given by ls.
*/
{
static String buf(0);
for (Ulong j = 0; j < h.size(); ++j) {
reset(buf);
hecke::append(buf,h[a[j]],p,I);
appendStar(buf,h[a[j]],p,l);
foldLine(file,buf,ls,4,"+");
fprintf(file,"\n");
}
}
};
namespace hecke {
template<class P>
void prettyPrint(FILE* file,
const List<HeckeMonomial<P> >& h,
const Permutation& a,
const SchubertContext& p,
const Interface& I,
const Length& l,
const Ulong& ls)
/*
This function does the prettyprinting of h to the file. The formatting
of the output is optimized for screen viewing. This means that if two
entries fit on a line, we will do two-column output. Otherwise, we do
one-column output, and moreover we try to fold long lines decently.
The parameter l is needed to determine the non-zero mu-coefficients.
*/
{
static String buf(0);
Ulong maxl = maxLength(h,p,I,l);
Ulong hl = (ls-1)/2;
if (maxl > hl)
return oneColumnPrint(file,h,a,p,I,l,ls);
else
return twoColumnPrint(file,h,a,p,I,l,ls);
return;
}
template<class P>
void singularStratification(List<HeckeMonomial<P> >& hs,
const List<HeckeMonomial<P> >& h,
const SchubertContext& p)
/*
This function extracts the "rational singular stratification". By this we
mean that we sort by Kazhdan-Lusztig polynomials, and then consider maximal
elements (for the Bruhat ordering) in each class.
Geometrically, when the Bruhat ordering comes from the stratification
of a Schubert variety cl(X_y), and the row is the extremal row for y,
this means that we are looking at a version of "equisingularity" (the
Kazhdan-Lusztig polynomial P_{x,y} being a measure of the failure of
smoothness along the subvariety X_x), and taking maximal elements amounts
to taking components of the equisingular locus. Note that as P_{x,y} is
constant on each orbit in [e,y] under the descent set of y, these
components always correspond to extremal elements.
This is the set of data that has been popularized by Goresky in the
files on his website. It is printed out in printRow.
Note that from Irving (Ann. ENS ...) it is known that P_{z,y} <= P_{x,y}
coefficientwise when x <= z, so P_{x,y} is a decreasing function of x,
in the case of finite Weyl groups; presumably this is also known for
general crystallographic Coxeter groups (= Weyl groups of Kac-Moody
algebras).
It is assumed that row is sorted in ShortLex order. The row is also
returned sorted in ShortLex order.
*/
{
/* sort row by kl-polynomial */
PPtrF<P> f;
Partition pi(h.begin(),h.end(),f);
/* find maximal elements in each class */
Ulong count = 0;
for (PartitionIterator i(pi); i; ++i) {
Ulong m = i()[0];
if (h[m].pol().deg() == 0) // polynomial is one
continue;
ToCoxNbr<P> f(&h);
List<CoxNbr> c(i().begin(),i().end(),f);
List<Ulong> a(0);
extractMaximals(p,c,a);
hs.setSize(count+a.size());
for (Ulong j = 0; j < a.size(); ++j)
hs[count+j] = h[i()[a[j]]];
count += a.size();
}
return;
}
};
namespace {
template<class P>
void twoColumnPrint(FILE* file,
const List<HeckeMonomial<P> >& h,
const Permutation& a,
const SchubertContext& p,
const Interface& I,
const Length& l,
const Ulong& ls)
/*
This function prints out the row in two-column format, on lines of length
ls. It is assumed that it has been checked (using maxLength for instance)
that the maximum size of an output line in print(file,kl,row) is at most
(ls-1)/2 (so that there is room for at least one unit of whitespace
in-between columns.)
*/
{
static String buf(0);
Ulong hl = (ls-1)/2; /* width of output column */
Ulong fl = h.size()/2; /* number of full lines */
Ulong i = 0;
for (Ulong j = 0; j < fl; ++j) { /* print out a full line */
reset(buf);
hecke::append(buf,h[a[i]],p,I);
appendStar(buf,h[a[i]],p,l);
pad(buf,ls-hl);
i++;
hecke::append(buf,h[a[i]],p,I);
appendStar(buf,h[a[i]],p,l);
i++;
print(file,buf);
fprintf(file,"\n");
}
if (h.size()%2) { /* print out a half line */
reset(buf);
hecke::append(buf,h[a[i]],p,I);
appendStar(buf,h[a[i]],p,l);
print(file,buf);
fprintf(file,"\n");
}
return;
}
};