Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

790

791

792

793

794

795

796

797

798

799

800

801

802

803

804

805

806

807

808

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

859

860

861

862

863

864

865

866

867

868

869

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894

895

896

897

898

899

900

901

902

903

904

905

906

907

908

909

910

911

912

913

914

915

916

917

918

919

920

921

922

923

924

925

926

927

928

929

930

931

932

933

934

935

936

937

938

939

940

941

942

943

944

945

946

947

948

949

950

951

952

953

954

955

956

957

958

959

960

961

962

963

964

965

966

967

968

969

970

971

972

973

974

975

976

977

978

979

980

981

982

983

984

985

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

1013

1014

1015

1016

1017

1018

1019

1020

1021

1022

1023

1024

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057

1058

1059

1060

1061

1062

1063

1064

1065

1066

1067

1068

1069

1070

1071

1072

1073

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1087

1088

1089

1090

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1111

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1125

1126

1127

1128

1129

1130

1131

1132

1133

1134

1135

1136

1137

1138

1139

1140

1141

1142

1143

1144

1145

1146

1147

1148

1149

1150

1151

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1163

1164

1165

1166

1167

1168

1169

1170

1171

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1182

1183

1184

1185

1186

1187

1188

1189

1190

1191

1192

1193

1194

1195

1196

1197

1198

1199

1200

1201

1202

1203

1204

1205

1206

1207

1208

1209

1210

1211

1212

1213

1214

1215

1216

1217

1218

1219

1220

1221

1222

1223

1224

1225

1226

1227

1228

1229

1230

1231

1232

1233

1234

1235

1236

1237

1238

1239

1240

1241

1242

1243

1244

1245

1246

1247

1248

1249

1250

1251

1252

1253

1254

1255

1256

1257

1258

1259

1260

1261

1262

1263

1264

1265

1266

1267

1268

1269

1270

1271

1272

1273

1274

1275

1276

1277

1278

1279

1280

1281

1282

1283

1284

1285

1286

1287

1288

1289

1290

1291

1292

1293

1294

1295

1296

1297

1298

1299

1300

1301

1302

1303

1304

1305

1306

1307

1308

1309

1310

1311

1312

1313

1314

1315

1316

1317

1318

1319

1320

1321

1322

1323

1324

1325

1326

1327

1328

1329

1330

1331

1332

1333

1334

1335

1336

1337

1338

1339

1340

1341

1342

1343

1344

1345

1346

1347

1348

1349

1350

1351

1352

1353

1354

1355

1356

1357

1358

1359

1360

1361

1362

1363

1364

1365

1366

1367

1368

1369

1370

1371

1372

1373

1374

1375

1376

1377

1378

1379

1380

1381

1382

1383

1384

1385

1386

1387

1388

1389

1390

1391

1392

1393

1394

1395

1396

1397

1398

1399

1400

1401

1402

1403

1404

1405

1406

1407

1408

1409

1410

1411

1412

1413

1414

1415

1416

1417

1418

1419

1420

1421

1422

1423

1424

1425

1426

1427

1428

1429

1430

1431

1432

1433

1434

1435

1436

1437

1438

1439

1440

1441

1442

1443

1444

1445

1446

1447

1448

1449

1450

1451

1452

1453

1454

1455

1456

1457

1458

1459

1460

1461

1462

1463

1464

1465

1466

1467

1468

1469

1470

1471

1472

1473

1474

1475

1476

1477

1478

1479

1480

1481

1482

1483

1484

1485

1486

1487

1488

1489

1490

1491

1492

1493

1494

1495

1496

1497

1498

1499

1500

1501

1502

1503

1504

1505

1506

1507

1508

1509

1510

1511

1512

1513

1514

1515

1516

1517

1518

1519

1520

1521

1522

1523

1524

1525

1526

1527

1528

1529

1530

1531

1532

1533

1534

1535

1536

1537

1538

1539

1540

1541

1542

1543

1544

1545

1546

1547

1548

1549

1550

1551

1552

1553

1554

1555

1556

1557

1558

1559

1560

1561

1562

1563

1564

1565

1566

1567

1568

1569

1570

1571

1572

1573

1574

1575

1576

1577

1578

1579

1580

1581

1582

1583

1584

1585

1586

1587

1588

1589

1590

1591

1592

1593

1594

1595

1596

1597

1598

1599

1600

1601

1602

1603

1604

1605

1606

1607

1608

1609

1610

1611

1612

1613

1614

1615

1616

1617

1618

1619

1620

1621

1622

1623

1624

1625

1626

1627

1628

1629

1630

1631

1632

1633

1634

1635

1636

1637

1638

1639

1640

1641

1642

1643

1644

1645

1646

1647

1648

1649

1650

1651

1652

1653

1654

1655

1656

1657

1658

1659

1660

1661

1662

1663

1664

1665

1666

1667

1668

1669

1670

1671

1672

1673

1674

1675

1676

1677

1678

1679

1680

1681

1682

1683

1684

1685

1686

1687

1688

1689

1690

1691

1692

1693

1694

1695

1696

1697

1698

1699

1700

1701

1702

1703

1704

1705

1706

1707

1708

1709

1710

1711

1712

1713

1714

1715

1716

1717

1718

1719

1720

1721

1722

1723

1724

1725

1726

1727

1728

1729

1730

1731

1732

1733

1734

1735

1736

1737

1738

1739

1740

1741

1742

1743

1744

1745

1746

1747

1748

1749

1750

1751

1752

1753

1754

1755

1756

1757

1758

1759

1760

1761

1762

1763

1764

1765

1766

1767

1768

1769

1770

1771

1772

1773

1774

1775

1776

1777

1778

1779

1780

1781

1782

1783

1784

1785

1786

1787

1788

1789

1790

1791

1792

1793

1794

1795

1796

1797

1798

1799

1800

1801

1802

1803

1804

1805

1806

1807

1808

1809

1810

1811

1812

1813

1814

1815

1816

1817

1818

1819

1820

1821

1822

1823

1824

1825

1826

1827

1828

1829

1830

1831

1832

1833

1834

1835

1836

1837

1838

1839

1840

1841

1842

1843

1844

1845

1846

1847

1848

1849

1850

1851

1852

1853

1854

1855

1856

1857

1858

1859

1860

1861

1862

1863

1864

1865

1866

1867

1868

1869

1870

1871

1872

1873

1874

1875

1876

1877

1878

1879

1880

1881

1882

1883

1884

1885

1886

1887

1888

1889

1890

1891

1892

1893

1894

1895

1896

1897

1898

1899

1900

1901

1902

1903

1904

1905

1906

1907

1908

1909

1910

1911

1912

1913

1914

1915

1916

1917

1918

1919

1920

1921

1922

1923

1924

1925

1926

1927

1928

1929

1930

1931

1932

1933

1934

1935

1936

1937

1938

1939

1940

1941

1942

1943

1944

1945

1946

1947

1948

1949

1950

1951

1952

1953

1954

1955

1956

1957

1958

1959

1960

1961

1962

1963

1964

1965

1966

1967

1968

1969

1970

1971

1972

1973

1974

1975

1976

1977

1978

1979

1980

1981

1982

1983

1984

1985

1986

1987

1988

1989

1990

1991

1992

1993

1994

1995

1996

1997

1998

1999

2000

2001

2002

2003

2004

2005

2006

2007

2008

2009

2010

2011

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

2022

2023

2024

2025

2026

2027

2028

2029

2030

2031

2032

2033

2034

2035

2036

2037

2038

2039

2040

2041

2042

2043

2044

2045

2046

2047

2048

2049

2050

2051

2052

2053

2054

2055

2056

2057

2058

2059

2060

2061

2062

2063

2064

2065

2066

2067

2068

2069

2070

2071

2072

2073

2074

2075

2076

2077

2078

2079

2080

2081

2082

2083

2084

2085

2086

2087

2088

2089

2090

2091

2092

2093

2094

2095

2096

2097

2098

2099

2100

2101

2102

2103

2104

2105

2106

2107

2108

2109

2110

2111

2112

2113

2114

2115

2116

2117

2118

2119

2120

2121

2122

2123

2124

2125

2126

2127

2128

2129

2130

2131

2132

2133

2134

2135

2136

2137

2138

2139

2140

2141

2142

2143

2144

2145

2146

2147

2148

2149

2150

2151

2152

2153

2154

2155

2156

2157

2158

2159

2160

2161

2162

2163

2164

2165

2166

2167

2168

2169

2170

2171

2172

2173

2174

2175

2176

2177

2178

2179

2180

2181

2182

2183

2184

2185

2186

2187

2188

2189

2190

2191

2192

2193

2194

2195

2196

2197

2198

2199

2200

2201

2202

2203

2204

2205

2206

2207

2208

2209

2210

2211

2212

2213

2214

2215

2216

2217

2218

2219

2220

2221

2222

2223

2224

2225

2226

2227

2228

2229

2230

2231

2232

2233

2234

2235

2236

2237

2238

2239

2240

2241

2242

2243

2244

2245

2246

2247

2248

2249

2250

2251

2252

2253

2254

2255

2256

2257

2258

2259

2260

2261

2262

2263

2264

2265

2266

2267

2268

2269

2270

2271

2272

2273

2274

2275

2276

2277

2278

2279

2280

2281

2282

2283

2284

2285

2286

2287

2288

2289

2290

2291

2292

2293

2294

2295

2296

2297

2298

2299

2300

2301

2302

2303

2304

2305

2306

2307

2308

2309

2310

2311

2312

2313

2314

2315

2316

2317

2318

2319

2320

2321

2322

2323

2324

2325

2326

2327

2328

2329

2330

2331

2332

2333

2334

2335

2336

2337

2338

2339

2340

2341

2342

2343

2344

2345

2346

2347

2348

2349

2350

2351

2352

2353

2354

2355

2356

2357

2358

2359

2360

2361

2362

2363

2364

2365

2366

2367

2368

r""" 

Rigged Configuration Elements 

 

A rigged configuration element is a sequence of 

:class:`~sage.combinat.rigged_configurations.rigged_partition.RiggedPartition` 

objects. 

 

AUTHORS: 

 

- Travis Scrimshaw (2010-09-26): Initial version 

- Travis Scrimshaw (2012-10-25): Added virtual rigged configurations 

""" 

 

#***************************************************************************** 

# Copyright (C) 2010-2012 Travis Scrimshaw <tscrim@ucdavis.edu> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# 

# This code is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

# General Public License for more details. 

# 

# The full text of the GPL is available at: 

# 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

from __future__ import print_function, division 

 

from sage.misc.cachefunc import cached_method 

from sage.structure.list_clone import ClonableArray 

from sage.rings.integer import Integer 

from sage.rings.integer_ring import ZZ 

from sage.combinat.rigged_configurations.rigged_partition import RiggedPartition, \ 

RiggedPartitionTypeB 

 

#################################################### 

## Base classes for rigged configuration elements ## 

#################################################### 

 

class RiggedConfigurationElement(ClonableArray): 

""" 

A rigged configuration for simply-laced types. 

 

For more information on rigged configurations, see 

:class:`RiggedConfigurations`. For rigged configurations for 

non-simply-laced types, use :class:`RCNonSimplyLacedElement`. 

 

Typically to create a specific rigged configuration, the user will pass in 

the optional argument ``partition_list`` and if the user wants to specify 

the rigging values, give the optional argument ``rigging_list`` as well. 

If ``rigging_list`` is not passed, the rigging values are set to the 

corresponding vacancy numbers. 

 

INPUT: 

 

- ``parent`` -- the parent of this element 

 

- ``rigged_partitions`` -- a list of rigged partitions 

 

There are two optional arguments to explicitly construct a rigged 

configuration. The first is ``partition_list`` which gives a list of 

partitions, and the second is ``rigging_list`` which is a list of 

corresponding lists of riggings. If only partition_list is specified, 

then it sets the rigging equal to the calculated vacancy numbers. 

 

If we are constructing a rigged configuration from a rigged configuration 

(say of another type) and we don't want to recompute the vacancy numbers, 

we can use the ``use_vacancy_numbers`` to avoid the recomputation. 

 

EXAMPLES: 

 

Type `A_n^{(1)}` examples:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]]) 

sage: RC(partition_list=[[2], [2, 2], [2], [2]]) 

<BLANKLINE> 

0[ ][ ]0 

<BLANKLINE> 

-2[ ][ ]-2 

-2[ ][ ]-2 

<BLANKLINE> 

2[ ][ ]2 

<BLANKLINE> 

-2[ ][ ]-2 

<BLANKLINE> 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[1, 1], [1, 1]]) 

sage: RC(partition_list=[[], [], [], []]) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

 

Type `D_n^{(1)}` examples:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: RC(partition_list=[[3], [3,2], [4], [3]]) 

<BLANKLINE> 

-1[ ][ ][ ]-1 

<BLANKLINE> 

1[ ][ ][ ]1 

0[ ][ ]0 

<BLANKLINE> 

-3[ ][ ][ ][ ]-3 

<BLANKLINE> 

-1[ ][ ][ ]-1 

<BLANKLINE> 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[1, 1], [2, 1]]) 

sage: RC(partition_list=[[1], [1,1], [1], [1]]) 

<BLANKLINE> 

1[ ]1 

<BLANKLINE> 

0[ ]0 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

sage: elt = RC(partition_list=[[1], [1,1], [1], [1]], rigging_list=[[0], [0,0], [0], [0]]); elt 

<BLANKLINE> 

1[ ]0 

<BLANKLINE> 

0[ ]0 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

 

sage: from sage.combinat.rigged_configurations.rigged_partition import RiggedPartition 

sage: RC2 = RiggedConfigurations(['D', 5, 1], [[2, 1], [3, 1]]) 

sage: l = [RiggedPartition()] + list(elt) 

sage: ascii_art(RC2(*l)) 

(/) 1[ ]0 0[ ]0 0[ ]0 0[ ]0 

0[ ]0 

sage: ascii_art(RC2(*l, use_vacancy_numbers=True)) 

(/) 1[ ]0 0[ ]0 0[ ]0 0[ ]0 

0[ ]0 

""" 

def __init__(self, parent, rigged_partitions=[], **options): 

r""" 

Construct a rigged configuration element. 

 

.. WARNING:: 

 

This changes the vacancy numbers of the rigged partitions, so 

if the rigged partitions comes from another rigged configuration, 

a deep copy should be made before being passed here. We do not 

make a deep copy here because the crystal operators generate 

their own rigged partitions. See :trac:`17054`. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]]) 

sage: RC(partition_list=[[], [], [], []]) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

sage: RC(partition_list=[[1], [1], [], []]) 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

sage: elt = RC(partition_list=[[1], [1], [], []], rigging_list=[[-1], [0], [], []]); elt 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

sage: TestSuite(elt).run() 

""" 

n = options.get('n', parent._cartan_type.rank()) 

if "partition_list" in options: 

data = options["partition_list"] 

if len(data) == 0: 

# Create a size n array of empty rigged tableau since no tableau 

# were given 

nu = [] 

for i in range(n): 

nu.append(RiggedPartition()) 

else: 

if len(data) != n: # otherwise n should be equal to the number of tableaux 

raise ValueError("incorrect number of partitions") 

 

nu = [] 

if "rigging_list" in options: 

rigging_data = options["rigging_list"] 

 

if len(rigging_data) != n: 

raise ValueError("incorrect number of riggings") 

 

for i in range(n): 

nu.append(RiggedPartition(tuple(data[i]), \ 

list(rigging_data[i]))) 

else: 

for partition_data in data: 

nu.append(RiggedPartition(tuple(partition_data))) 

elif n == len(rigged_partitions) and isinstance(rigged_partitions[0], RiggedPartition): 

# The isinstance check is to make sure we are not in the n == 1 special case because 

# Parent's __call__ always passes at least 1 argument to the element constructor 

 

if options.get('use_vacancy_numbers', False): 

ClonableArray.__init__(self, parent, rigged_partitions) 

return 

nu = rigged_partitions 

else: 

# Otherwise we did not receive any info, create a size n array of 

# empty rigged partitions 

nu = [] 

for i in range(n): 

nu.append(RiggedPartition()) 

#raise ValueError("Invalid input") 

#raise ValueError("Incorrect number of rigged partitions") 

 

# Set the vacancy numbers 

for a, partition in enumerate(nu): 

# If the partition is empty, there's nothing to do 

if len(partition) <= 0: 

continue 

 

# Setup the first block 

block_len = partition[0] 

vac_num = parent._calc_vacancy_number(nu, a, block_len) 

 

for i, row_len in enumerate(partition): 

# If we've gone to a different sized block, then update the 

# values which change when moving to a new block size 

if block_len != row_len: 

vac_num = parent._calc_vacancy_number(nu, a, row_len) 

block_len = row_len 

 

partition.vacancy_numbers[i] = vac_num 

if partition.rigging[i] is None: 

partition.rigging[i] = partition.vacancy_numbers[i] 

 

ClonableArray.__init__(self, parent, nu) 

 

def check(self): 

""" 

Check the rigged configuration is properly defined. 

 

There is nothing to check here. 

 

EXAMPLES:: 

 

sage: RC = crystals.infinity.RiggedConfigurations(['A', 4]) 

sage: b = RC.module_generators[0].f_string([1,2,1,1,2,4,2,3,3,2]) 

sage: b.check() 

""" 

pass 

 

def _repr_(self): 

""" 

Return a string representation of ``self``. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: elt = RC(partition_list=[[2], [3,1], [3], [3]]); elt 

<BLANKLINE> 

-1[ ][ ]-1 

<BLANKLINE> 

2[ ][ ][ ]2 

0[ ]0 

<BLANKLINE> 

-2[ ][ ][ ]-2 

<BLANKLINE> 

-2[ ][ ][ ]-2 

<BLANKLINE> 

sage: RC.options(display='horizontal') 

sage: elt 

-1[ ][ ]-1 2[ ][ ][ ]2 -2[ ][ ][ ]-2 -2[ ][ ][ ]-2 

0[ ]0 

sage: RC.options._reset() 

""" 

return self.parent().options._dispatch(self, '_repr_', 'display') 

 

def _repr_vertical(self): 

""" 

Return the string representation of ``self`` vertically. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: print(RC(partition_list=[[2], [3,1], [3], [3]])._repr_vertical()) 

<BLANKLINE> 

-1[ ][ ]-1 

<BLANKLINE> 

2[ ][ ][ ]2 

0[ ]0 

<BLANKLINE> 

-2[ ][ ][ ]-2 

<BLANKLINE> 

-2[ ][ ][ ]-2 

<BLANKLINE> 

sage: print(RC(partition_list=[[],[],[],[]])._repr_vertical()) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

""" 

ret_str = "" 

for tableau in self: 

ret_str += "\n" + repr(tableau) 

return(ret_str) 

 

def _repr_horizontal(self): 

""" 

Return the string representation of ``self`` horizontally. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: print(RC(partition_list=[[2], [3,1], [3], [3]])._repr_horizontal()) 

-1[ ][ ]-1 2[ ][ ][ ]2 -2[ ][ ][ ]-2 -2[ ][ ][ ]-2 

0[ ]0 

sage: print(RC(partition_list=[[],[],[],[]])._repr_horizontal()) 

(/) (/) (/) (/) 

""" 

tab_str = [repr(x).splitlines() for x in self] 

height = max(len(t) for t in tab_str) 

widths = [max(len(x) for x in t) for t in tab_str] 

ret_str = '' 

for i in range(height): 

if i != 0: 

ret_str += '\n' 

for j,t in enumerate(tab_str): 

if j != 0: 

ret_str += ' ' 

if i < len(t): 

ret_str += t[i] + ' ' * (widths[j]-len(t[i])) 

else: 

ret_str += ' ' * widths[j] 

return ret_str 

 

def _latex_(self): 

r""" 

Return the LaTeX representation of ``self``. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: latex(RC(partition_list=[[2], [3,1], [3], [3]])) 

{ 

\begin{array}[t]{r|c|c|l} 

\cline{2-3} -1 &\phantom{|}&\phantom{|}& -1 \\ 

\cline{2-3} 

\end{array} 

} 

\quad 

{ 

\begin{array}[t]{r|c|c|c|l} 

\cline{2-4} 2 &\phantom{|}&\phantom{|}&\phantom{|}& 2 \\ 

\cline{2-4} 0 &\phantom{|}& \multicolumn{3 }{l}{ 0 } \\ 

\cline{2-2} 

\end{array} 

} 

\quad 

{ 

\begin{array}[t]{r|c|c|c|l} 

\cline{2-4} -2 &\phantom{|}&\phantom{|}&\phantom{|}& -2 \\ 

\cline{2-4} 

\end{array} 

} 

\quad 

{ 

\begin{array}[t]{r|c|c|c|l} 

\cline{2-4} -2 &\phantom{|}&\phantom{|}&\phantom{|}& -2 \\ 

\cline{2-4} 

\end{array} 

} 

sage: latex(RC(partition_list=[[],[],[],[]])) 

{\emptyset} 

\quad 

{\emptyset} 

\quad 

{\emptyset} 

\quad 

{\emptyset} 

""" 

ret_string = self[0]._latex_() 

 

for partition in self[1:]: 

ret_string += "\n\quad\n" + partition._latex_() 

 

return ret_string 

 

def _ascii_art_(self): 

""" 

Return an ASCII art representation of ``self``. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: ascii_art(RC(partition_list=[[2], [3,1], [3], [3]])) 

-1[ ][ ]-1 2[ ][ ][ ]2 -2[ ][ ][ ]-2 -2[ ][ ][ ]-2 

0[ ]0 

sage: ascii_art(RC(partition_list=[[],[],[],[]])) 

(/) (/) (/) (/) 

sage: RC = RiggedConfigurations(['D', 7, 1], [[3,3],[5,2],[4,3],[2,3],[4,4],[3,1],[1,4],[2,2]]) 

sage: elt = RC(partition_list=[[2],[3,2,1],[2,2,1,1],[2,2,1,1,1,1],[3,2,1,1,1,1],[2,1,1],[2,2]], 

....: rigging_list=[[2],[1,0,0],[4,1,2,1],[1,0,0,0,0,0],[0,1,0,0,0,0],[0,0,0],[0,0]]) 

sage: ascii_art(elt) 

3[ ][ ]2 1[ ][ ][ ]1 4[ ][ ]4 2[ ][ ]1 0[ ][ ][ ]0 0[ ][ ]0 0[ ][ ]0 

2[ ][ ]0 4[ ][ ]1 2[ ][ ]0 2[ ][ ]1 0[ ]0 0[ ][ ]0 

1[ ]0 3[ ]2 0[ ]0 0[ ]0 0[ ]0 

3[ ]1 0[ ]0 0[ ]0 

0[ ]0 0[ ]0 

0[ ]0 0[ ]0 

sage: Partitions.options(convention='French') 

sage: ascii_art(elt) 

0[ ]0 0[ ]0 

0[ ]0 0[ ]0 

3[ ]1 0[ ]0 0[ ]0 

1[ ]0 3[ ]2 0[ ]0 0[ ]0 0[ ]0 

2[ ][ ]0 4[ ][ ]1 2[ ][ ]0 2[ ][ ]1 0[ ]0 0[ ][ ]0 

3[ ][ ]2 1[ ][ ][ ]1 4[ ][ ]4 2[ ][ ]1 0[ ][ ][ ]0 0[ ][ ]0 0[ ][ ]0 

sage: Partitions.options._reset() 

""" 

from sage.combinat.partition import Partitions 

if Partitions.options.convention == "French": 

baseline = lambda s: 0 

else: 

baseline = lambda s: len(s) 

from sage.typeset.ascii_art import AsciiArt 

s = repr(self[0]).splitlines() 

ret = AsciiArt(s, baseline=baseline(s)) 

for tableau in self[1:]: 

s = repr(tableau).splitlines() 

ret += AsciiArt([" "], baseline=baseline(s)) + AsciiArt(s, baseline=baseline(s)) 

return ret 

 

def nu(self): 

r""" 

Return the list `\nu` of rigged partitions of this rigged 

configuration element. 

 

OUTPUT: 

 

The `\nu` array as a list. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]]) 

sage: RC(partition_list=[[2], [2,2], [2], [2]]).nu() 

[0[ ][ ]0 

, -2[ ][ ]-2 

-2[ ][ ]-2 

, 2[ ][ ]2 

, -2[ ][ ]-2 

] 

""" 

return list(self) 

 

# TODO: Change e/f to work for all types 

def e(self, a): 

r""" 

Return the action of the crystal operator `e_a` on ``self``. 

 

This implements the method defined in [CrysStructSchilling06]_ which 

finds the value `k` which is the length of the string with the 

smallest negative rigging of smallest length. Then it removes a box 

from a string of length `k` in the `a`-th rigged partition, keeping all 

colabels fixed and increasing the new label by one. If no such string 

exists, then `e_a` is undefined. 

 

INPUT: 

 

- ``a`` -- the index of the partition to remove a box 

 

OUTPUT: 

 

The resulting rigged configuration element. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]]) 

sage: elt = RC(partition_list=[[1], [1], [1], [1]]) 

sage: elt.e(3) 

sage: elt.e(1) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

""" 

if a not in self.parent()._rc_index_inverse: 

raise ValueError("{} is not in the index set".format(a)) 

a = self.parent()._rc_index_inverse[a] 

 

new_list = self[a][:] 

new_vac_nums = self[a].vacancy_numbers[:] 

new_rigging = self[a].rigging[:] 

 

# Find k and perform e_a 

k = None 

num_rows = len(new_list) 

cur_rigging = -1 

rigging_index = None 

for i in range(num_rows): 

if new_rigging[i] <= cur_rigging: 

cur_rigging = new_rigging[i] 

rigging_index = i 

 

# If we've not found a valid k 

if rigging_index is None: 

return None 

 

# Note that because the riggings are weakly decreasing, we will always 

# remove the last box on of a block 

k = new_list[rigging_index] 

set_vac_num = False 

if k == 1: 

new_list.pop() 

new_vac_nums.pop() 

new_rigging.pop() 

else: 

new_list[rigging_index] -= 1 

cur_rigging += 1 

# Properly sort the riggings 

j = rigging_index + 1 

# Update the vacancy number if the row lengths are the same 

if j < num_rows and new_list[j] == new_list[rigging_index]: 

new_vac_nums[rigging_index] = new_vac_nums[j] 

set_vac_num = True 

while j < num_rows and new_list[j] == new_list[rigging_index] \ 

and new_rigging[j] > cur_rigging: 

new_rigging[j-1] = new_rigging[j] # Shuffle it along 

j += 1 

new_rigging[j-1] = cur_rigging 

 

new_partitions = [] 

for b in range(len(self)): 

if b != a: 

new_partitions.append(self._generate_partition_e(a, b, k)) 

else: 

# Update the vacancy numbers and the rigging 

for i in range(len(new_vac_nums)): 

if new_list[i] < k: 

break 

 

new_vac_nums[i] += 2 

new_rigging[i] += 2 

 

 

if k != 1 and not set_vac_num: # If we did not remove a row nor found another row of length k-1 

new_vac_nums[rigging_index] += 2 

 

new_partitions.append(RiggedPartition(new_list, new_rigging, new_vac_nums)) 

 

ret_RC = self.__class__(self.parent(), new_partitions, use_vacancy_numbers=True) 

nu = ret_RC.nu() 

if k != 1 and not set_vac_num: # If we did not remove a row nor found another row of length k-1 

# Update that row's vacancy number 

ret_RC[a].vacancy_numbers[rigging_index] = \ 

self.parent()._calc_vacancy_number(nu, a, nu[a][rigging_index]) 

return ret_RC 

 

def _generate_partition_e(self, a, b, k): 

r""" 

Generate a new partition for a given value of `a` by updating the 

vacancy numbers and preserving co-labels for the map `e_a`. 

 

INPUT: 

 

- ``a`` -- the index of the partition we operated on 

- ``b`` -- the index of the partition to generate 

- ``k`` -- the length of the string with the smallest negative 

rigging of smallest length 

 

OUTPUT: 

 

The constructed rigged partition. 

 

TESTS:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]]) 

sage: RC(partition_list=[[1], [1], [1], [1]])._generate_partition_e(1, 2, 1) 

-1[ ]-1 

<BLANKLINE> 

""" 

# Check to make sure we will do something 

if not self.parent()._cartan_matrix[a,b]: 

return self[b] 

 

new_list = self[b]._list 

new_vac_nums = self[b].vacancy_numbers[:] 

new_rigging = self[b].rigging[:] 

 

# Update the vacancy numbers and the rigging 

value = self.parent()._cartan_matrix[b,a] 

for i in range(len(new_vac_nums)): 

if new_list[i] < k: 

break 

 

new_vac_nums[i] += value 

new_rigging[i] += value 

 

return RiggedPartition(new_list, new_rigging, new_vac_nums) 

 

def f(self, a): 

r""" 

Return the action of the crystal operator `f_a` on ``self``. 

 

This implements the method defined in [CrysStructSchilling06]_ which 

finds the value `k` which is the length of the string with the 

smallest nonpositive rigging of largest length. Then it adds a box from 

a string of length `k` in the `a`-th rigged partition, keeping all 

colabels fixed and decreasing the new label by one. If no such string 

exists, then it adds a new string of length 1 with label `-1`. However 

we need to modify the definition to work for `B(\infty)` by removing 

the condition that the resulting rigged configuration is valid. 

 

INPUT: 

 

- ``a`` -- the index of the partition to add a box 

 

OUTPUT: 

 

The resulting rigged configuration element. 

 

EXAMPLES:: 

 

sage: RC = crystals.infinity.RiggedConfigurations(['A', 3]) 

sage: nu0 = RC.module_generators[0] 

sage: nu0.f(2) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

-2[ ]-1 

<BLANKLINE> 

(/) 

<BLANKLINE> 

""" 

if a not in self.parent()._rc_index_inverse: 

raise ValueError("{} is not in the index set".format(a)) 

a = self.parent()._rc_index_inverse[a] 

 

new_list = self[a][:] 

new_vac_nums = self[a].vacancy_numbers[:] 

new_rigging = self[a].rigging[:] 

 

# Find k and perform f_a 

k = None 

add_index = -1 # Index where we will add our row too 

rigging_index = None # Index which we will pull the rigging from 

cur_rigging = ZZ.zero() 

num_rows = len(new_list) 

for i in reversed(range(num_rows)): 

# If we need to increment a row, look for when we change rows for 

# the correct index. 

if add_index is None and new_list[i] != new_list[rigging_index]: 

add_index = i+1 

 

if new_rigging[i] <= cur_rigging: 

cur_rigging = new_rigging[i] 

k = new_list[i] 

rigging_index = i 

add_index = None 

 

# If we've not found a valid k 

if k is None: 

new_list.append(1) 

new_rigging.append(Integer(-1)) 

new_vac_nums.append(None) 

k = 0 

add_index = num_rows 

num_rows += 1 # We've added a row 

else: 

if add_index is None: # We are adding to the first row in the list 

add_index = 0 

new_list[add_index] += 1 

new_rigging.insert(add_index, new_rigging[rigging_index] - 1) 

new_vac_nums.insert(add_index, None) 

new_rigging.pop(rigging_index + 1) # add 1 for the insertion 

new_vac_nums.pop(rigging_index + 1) 

 

new_partitions = [] 

for b in range(len(self)): 

if b != a: 

new_partitions.append(self._generate_partition_f(a, b, k)) 

else: 

# Update the vacancy numbers and the rigging 

for i in range(num_rows): 

if new_list[i] <= k: 

break 

 

if i != add_index: 

new_vac_nums[i] -= 2 

new_rigging[i] -= 2 

 

new_partitions.append(RiggedPartition(new_list, new_rigging, new_vac_nums)) 

 

new_partitions[a].vacancy_numbers[add_index] = \ 

self.parent()._calc_vacancy_number(new_partitions, a, 

new_partitions[a][add_index]) 

 

# Note that we do not need to sort the rigging since if there was a 

# smaller rigging in a larger row, then `k` would be larger. 

return self.__class__(self.parent(), new_partitions, use_vacancy_numbers=True) 

 

def _generate_partition_f(self, a, b, k): 

r""" 

Generate a new partition for a given value of `a` by updating the 

vacancy numbers and preserving co-labels for the map `f_a`. 

 

INPUT: 

 

- ``a`` -- the index of the partition we operated on 

- ``b`` -- the index of the partition to generate 

- ``k`` -- the length of the string with smallest nonpositive rigging 

of largest length 

 

OUTPUT: 

 

The constructed rigged partition. 

 

TESTS:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]]) 

sage: RC(partition_list=[[1], [1], [1], [1]])._generate_partition_f(1, 2, 1) 

0[ ]0 

<BLANKLINE> 

""" 

# Check to make sure we will do something 

if not self.parent()._cartan_matrix[a,b]: 

return self[b] 

 

new_list = self[b]._list 

new_vac_nums = self[b].vacancy_numbers[:] 

new_rigging = self[b].rigging[:] 

 

# Update the vacancy numbers and the rigging 

value = self.parent()._cartan_matrix[b,a] 

for i in range(len(new_vac_nums)): 

if new_list[i] <= k: 

break 

 

new_vac_nums[i] -= value 

new_rigging[i] -= value 

 

return RiggedPartition(new_list, new_rigging, new_vac_nums) 

 

def epsilon(self, a): 

r""" 

Return `\varepsilon_a` of ``self``. 

 

Let `x_{\ell}` be the smallest string of `\nu^{(a)}` or `0` if 

`\nu^{(a)} = \emptyset`, then we have 

`\varepsilon_a = -\min(0, x_{\ell})`. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['B',2]).weight_lattice().fundamental_weights() 

sage: RC = crystals.RiggedConfigurations(La[1]+La[2]) 

sage: I = RC.index_set() 

sage: matrix([[rc.epsilon(i) for i in I] for rc in RC[:4]]) 

[0 0] 

[1 0] 

[0 1] 

[0 2] 

""" 

a = self.parent()._rc_index_inverse[a] 

if not self[a]: 

return ZZ.zero() 

return Integer(-min(0, min(self[a].rigging))) 

 

def phi(self, a): 

r""" 

Return `\varphi_a` of ``self``. 

 

Let `x_{\ell}` be the smallest string of `\nu^{(a)}` or `0` if 

`\nu^{(a)} = \emptyset`, then we have 

`\varepsilon_a = p_{\infty}^{(a)} - \min(0, x_{\ell})`. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['B',2]).weight_lattice().fundamental_weights() 

sage: RC = crystals.RiggedConfigurations(La[1]+La[2]) 

sage: I = RC.index_set() 

sage: matrix([[rc.phi(i) for i in I] for rc in RC[:4]]) 

[1 1] 

[0 3] 

[0 2] 

[1 1] 

""" 

a = self.parent()._rc_index_inverse[a] 

p_inf = self.parent()._calc_vacancy_number(self, a, float("inf")) 

if not self[a]: 

return Integer(p_inf) 

return Integer(p_inf - min(0, min(self[a].rigging))) 

 

def vacancy_number(self, a, i): 

r""" 

Return the vacancy number `p_i^{(a)}`. 

 

INPUT: 

 

- ``a`` -- the index of the rigged partition 

 

- ``i`` -- the row of the rigged partition 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]]) 

sage: elt = RC(partition_list=[[1], [2,1], [1], []]) 

sage: elt.vacancy_number(2, 3) 

-2 

sage: elt.vacancy_number(2, 2) 

-2 

sage: elt.vacancy_number(2, 1) 

-1 

 

sage: RC = RiggedConfigurations(['D',4,1], [[2,1], [2,1]]) 

sage: x = RC(partition_list=[[3], [3,1,1], [2], [3,1]]); ascii_art(x) 

-1[ ][ ][ ]-1 1[ ][ ][ ]1 0[ ][ ]0 -3[ ][ ][ ]-3 

0[ ]0 -1[ ]-1 

0[ ]0 

sage: x.vacancy_number(2,2) 

1 

""" 

a = self.parent()._rc_index_inverse[a] 

return self.parent()._calc_vacancy_number(self, a, i) 

 

def partition_rigging_lists(self): 

""" 

Return the list of partitions and the associated list of riggings 

of ``self``. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A',3,1], [[1,2],[2,2]]) 

sage: rc = RC(partition_list=[[2],[1],[1]], rigging_list=[[-1],[0],[-1]]); rc 

<BLANKLINE> 

-1[ ][ ]-1 

<BLANKLINE> 

1[ ]0 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

sage: rc.partition_rigging_lists() 

[[[2], [1], [1]], [[-1], [0], [-1]]] 

""" 

partitions = [] 

riggings = [] 

for p in self: 

partitions.append(list(p)) 

riggings.append(list(p.rigging)) 

return [partitions, riggings] 

 

class RCNonSimplyLacedElement(RiggedConfigurationElement): 

""" 

Rigged configuration elements for non-simply-laced types. 

 

TESTS:: 

 

sage: vct = CartanType(['C',2,1]).as_folding() 

sage: RC = crystals.infinity.RiggedConfigurations(vct) 

sage: elt = RC.module_generators[0].f_string([1,0,2,2,0,1]); elt 

<BLANKLINE> 

-2[ ][ ]-1 

<BLANKLINE> 

-2[ ]-1 

-2[ ]-1 

<BLANKLINE> 

-2[ ][ ]-1 

<BLANKLINE> 

sage: TestSuite(elt).run() 

""" 

def to_virtual_configuration(self): 

""" 

Return the corresponding rigged configuration in the virtual crystal. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[1,1],[2,1]]) 

sage: elt = RC(partition_list=[[3],[2]]); elt 

<BLANKLINE> 

0[ ][ ][ ]0 

<BLANKLINE> 

0[ ][ ]0 

sage: elt.to_virtual_configuration() 

<BLANKLINE> 

0[ ][ ][ ]0 

<BLANKLINE> 

0[ ][ ][ ][ ]0 

<BLANKLINE> 

0[ ][ ][ ]0 

""" 

return self.parent().to_virtual(self) 

 

def e(self, a): 

""" 

Return the action of `e_a` on ``self``. 

 

This works by lifting into the virtual configuration, then applying 

 

.. MATH:: 

 

e^v_a = \prod_{j \in \iota(a)} \hat{e}_j^{\gamma_j} 

 

and pulling back. 

 

EXAMPLES:: 

 

sage: vct = CartanType(['C',2,1]).as_folding() 

sage: RC = crystals.infinity.RiggedConfigurations(vct) 

sage: elt = RC(partition_list=[[2],[1,1],[2]], rigging_list=[[-1],[-1,-1],[-1]]) 

sage: ascii_art(elt.e(0)) 

0[ ]0 -2[ ]-1 -2[ ][ ]-1 

-2[ ]-1 

sage: ascii_art(elt.e(1)) 

-3[ ][ ]-2 0[ ]1 -3[ ][ ]-2 

sage: ascii_art(elt.e(2)) 

-2[ ][ ]-1 -2[ ]-1 0[ ]0 

-2[ ]-1 

""" 

vct = self.parent()._folded_ct 

L = [] 

gamma = vct.scaling_factors() 

for i in vct.folding_orbit()[a]: 

L.extend([i]*gamma[a]) 

virtual_rc = self.parent().to_virtual(self).e_string(L) 

if virtual_rc is None: 

return None 

return self.parent().from_virtual(virtual_rc) 

 

def f(self, a): 

""" 

Return the action of `f_a` on ``self``. 

 

This works by lifting into the virtual configuration, then applying 

 

.. MATH:: 

 

f^v_a = \prod_{j \in \iota(a)} \hat{f}_j^{\gamma_j} 

 

and pulling back. 

 

EXAMPLES:: 

 

sage: vct = CartanType(['C',2,1]).as_folding() 

sage: RC = crystals.infinity.RiggedConfigurations(vct) 

sage: elt = RC(partition_list=[[2],[1,1],[2]], rigging_list=[[-1],[-1,-1],[-1]]) 

sage: ascii_art(elt.f(0)) 

-4[ ][ ][ ]-2 -2[ ]-1 -2[ ][ ]-1 

-2[ ]-1 

sage: ascii_art(elt.f(1)) 

-1[ ][ ]0 -2[ ][ ]-2 -1[ ][ ]0 

-2[ ]-1 

sage: ascii_art(elt.f(2)) 

-2[ ][ ]-1 -2[ ]-1 -4[ ][ ][ ]-2 

-2[ ]-1 

""" 

vct = self.parent()._folded_ct 

L = [] 

gamma = vct.scaling_factors() 

for i in vct.folding_orbit()[a]: 

L.extend([i]*gamma[a]) 

virtual_rc = self.parent().to_virtual(self).f_string(L) 

if virtual_rc is None: 

return None 

return self.parent().from_virtual(virtual_rc) 

 

########################################################## 

## Highest weight crystal rigged configuration elements ## 

########################################################## 

 

class RCHighestWeightElement(RiggedConfigurationElement): 

""" 

Rigged configurations in highest weight crystals. 

 

TESTS:: 

 

sage: La = RootSystem(['A',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: RC = crystals.RiggedConfigurations(['A',2,1], La[0]) 

sage: elt = RC(partition_list=[[1,1],[1],[2]]); elt 

<BLANKLINE> 

-1[ ]-1 

-1[ ]-1 

<BLANKLINE> 

1[ ]1 

<BLANKLINE> 

-1[ ][ ]-1 

<BLANKLINE> 

sage: TestSuite(elt).run() 

""" 

def check(self): 

""" 

Make sure all of the riggings are less than or equal to the 

vacancy number. 

 

TESTS:: 

 

sage: La = RootSystem(['A',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: RC = crystals.RiggedConfigurations(['A',2,1], La[0]) 

sage: elt = RC(partition_list=[[1,1],[1],[2]]) 

sage: elt.check() 

""" 

for a, partition in enumerate(self): 

for i, vac_num in enumerate(partition.vacancy_numbers): 

if vac_num < partition.rigging[i]: 

raise ValueError("rigging can be at most the vacancy number") 

 

def f(self, a): 

r""" 

Return the action of the crystal operator `f_a` on ``self``. 

 

This implements the method defined in [CrysStructSchilling06]_ which 

finds the value `k` which is the length of the string with the 

smallest nonpositive rigging of largest length. Then it adds a box 

from a string of length `k` in the `a`-th rigged partition, keeping 

all colabels fixed and decreasing the new label by one. If no such 

string exists, then it adds a new string of length 1 with label `-1`. 

If any of the resulting vacancy numbers are larger than the labels 

(i.e. it is an invalid rigged configuration), then `f_a` is 

undefined. 

 

INPUT: 

 

- ``a`` -- the index of the partition to add a box 

 

OUTPUT: 

 

The resulting rigged configuration element. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['A',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: RC = crystals.RiggedConfigurations(['A',2,1], La[0]) 

sage: elt = RC(partition_list=[[1,1],[1],[2]]) 

sage: elt.f(0) 

<BLANKLINE> 

-2[ ][ ]-2 

-1[ ]-1 

<BLANKLINE> 

1[ ]1 

<BLANKLINE> 

0[ ][ ]0 

<BLANKLINE> 

sage: elt.f(1) 

<BLANKLINE> 

0[ ]0 

0[ ]0 

<BLANKLINE> 

-1[ ]-1 

-1[ ]-1 

<BLANKLINE> 

0[ ][ ]0 

<BLANKLINE> 

sage: elt.f(2) 

""" 

if not self.phi(a): 

return None 

return RiggedConfigurationElement.f(self, a) 

 

def weight(self): 

""" 

Return the weight of ``self``. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['A',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: B = crystals.RiggedConfigurations(['A',2,1], La[0]) 

sage: mg = B.module_generators[0] 

sage: mg.f_string([0,1,2,0]).weight() 

-Lambda[0] + Lambda[1] + Lambda[2] - 2*delta 

""" 

P = self.parent().weight_lattice_realization() 

alpha = list(P.simple_roots()) 

return self.parent()._wt - sum(sum(x) * alpha[i] for i,x in enumerate(self)) 

 

class RCHWNonSimplyLacedElement(RCNonSimplyLacedElement): 

""" 

Rigged configurations in highest weight crystals. 

 

TESTS:: 

 

sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: vct = CartanType(['C',2,1]).as_folding() 

sage: RC = crystals.RiggedConfigurations(vct, La[0]) 

sage: elt = RC(partition_list=[[1,1],[2],[2]]); ascii_art(elt) 

-1[ ]-1 2[ ][ ]2 -2[ ][ ]-2 

-1[ ]-1 

sage: TestSuite(elt).run() 

""" 

def check(self): 

""" 

Make sure all of the riggings are less than or equal to the 

vacancy number. 

 

TESTS:: 

 

sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: vct = CartanType(['C',2,1]).as_folding() 

sage: RC = crystals.RiggedConfigurations(vct, La[0]) 

sage: elt = RC(partition_list=[[1,1],[2],[2]]) 

sage: elt.check() 

""" 

for partition in self: 

for i, vac_num in enumerate(partition.vacancy_numbers): 

if vac_num < partition.rigging[i]: 

raise ValueError("rigging can be at most the vacancy number") 

 

def f(self, a): 

r""" 

Return the action of `f_a` on ``self``. 

 

This works by lifting into the virtual configuration, then applying 

 

.. MATH:: 

 

f^v_a = \prod_{j \in \iota(a)} \hat{f}_j^{\gamma_j} 

 

and pulling back. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: vct = CartanType(['C',2,1]).as_folding() 

sage: RC = crystals.RiggedConfigurations(vct, La[0]) 

sage: elt = RC(partition_list=[[1,1],[2],[2]]) 

sage: elt.f(0) 

sage: ascii_art(elt.f(1)) 

0[ ]0 0[ ][ ]0 -1[ ][ ]-1 

0[ ]0 -1[ ]-1 

sage: elt.f(2) 

""" 

if not self.phi(a): 

return None 

return RCNonSimplyLacedElement.f(self, a) 

 

# FIXME: Do not duplicate with the simply-laced HW RC element class 

def weight(self): 

""" 

Return the weight of ``self``. 

 

EXAMPLES:: 

 

sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights() 

sage: vct = CartanType(['C',2,1]).as_folding() 

sage: B = crystals.RiggedConfigurations(vct, La[0]) 

sage: mg = B.module_generators[0] 

sage: mg.f_string([0,1,2]).weight() 

2*Lambda[1] - Lambda[2] - delta 

""" 

P = self.parent().weight_lattice_realization() 

alpha = list(P.simple_roots()) 

return self.parent()._wt - sum(sum(x) * alpha[i] for i,x in enumerate(self)) 

 

############################################## 

## KR crystal rigged configuration elements ## 

############################################## 

 

class KRRiggedConfigurationElement(RiggedConfigurationElement): 

r""" 

`U_q^{\prime}(\mathfrak{g})` rigged configurations. 

 

EXAMPLES: 

 

We can go between :class:`rigged configurations <RiggedConfigurations>` 

and tensor products of :class:`tensor products of KR tableaux 

<sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux>`:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[1,1], [2,1]]) 

sage: rc_elt = RC(partition_list=[[1], [1,1], [1], [1]]) 

sage: tp_krtab = rc_elt.to_tensor_product_of_kirillov_reshetikhin_tableaux(); tp_krtab 

[[-2]] (X) [[1], [2]] 

sage: tp_krcrys = rc_elt.to_tensor_product_of_kirillov_reshetikhin_crystals(); tp_krcrys 

[[[-2]], [[1], [2]]] 

sage: tp_krcrys == tp_krtab.to_tensor_product_of_kirillov_reshetikhin_crystals() 

True 

sage: RC(tp_krcrys) == rc_elt 

True 

sage: RC(tp_krtab) == rc_elt 

True 

sage: tp_krtab.to_rigged_configuration() == rc_elt 

True 

""" 

def __init__(self, parent, rigged_partitions=[], **options): 

r""" 

Construct a rigged configuration element. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]]) 

sage: RC(partition_list=[[], [], [], []]) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

sage: RC(partition_list=[[1], [1], [], []]) 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

sage: elt = RC(partition_list=[[1], [1], [], []], rigging_list=[[-1], [0], [], []]); elt 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

(/) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

sage: TestSuite(elt).run() 

""" 

n = len(parent._rc_index) 

if "KT_constructor" in options: 

# Used only by the Kleber tree 

# Not recommended to be called by the user since it avoids safety 

# checks for speed 

data = options["KT_constructor"] 

shape_data = data[0] 

rigging_data = data[1] 

vac_data = data[2] 

nu = [] 

for i in range(n): 

nu.append(RiggedPartition(shape_data[i], rigging_data[i], vac_data[i])) 

# Special display case 

if parent.cartan_type().type() == 'B': 

nu[-1] = RiggedPartitionTypeB(nu[-1]) 

ClonableArray.__init__(self, parent, nu) 

return 

RiggedConfigurationElement.__init__(self, parent, rigged_partitions, n=n, **options) 

# Special display case 

if parent.cartan_type().type() == 'B': 

self._set_mutable() 

self[-1] = RiggedPartitionTypeB(self[-1]) 

self.set_immutable() 

 

def check(self): 

""" 

Make sure all of the riggings are less than or equal to the 

vacancy number. 

 

TESTS:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]]) 

sage: elt = RC(partition_list=[[1], [1], [], []]) 

sage: elt.check() 

""" 

for partition in self: 

for i, vac_num in enumerate(partition.vacancy_numbers): 

if vac_num < partition.rigging[i]: 

raise ValueError("rigging can be at most the vacancy number") 

 

def e(self, a): 

r""" 

Return the action of the crystal operator `e_a` on ``self``. 

 

For the classical operators, this implements the method defined 

in [CrysStructSchilling06]_. For `e_0`, this converts the class to 

a tensor product of KR tableaux and does the corresponding `e_0` 

and pulls back. 

 

.. TODO:: 

 

Implement `e_0` without appealing to tensor product of 

KR tableaux. 

 

INPUT: 

 

- ``a`` -- the index of the partition to remove a box 

 

OUTPUT: 

 

The resulting rigged configuration element. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]]) 

sage: elt = RC(partition_list=[[1], [1], [1], [1]]) 

sage: elt.e(3) 

sage: elt.e(1) 

<BLANKLINE> 

(/) 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

""" 

if a not in self.parent()._cartan_type.index_set(): 

raise ValueError("{} is not in the index set".format(a)) 

if a == self.parent()._cartan_type.special_node(): 

try: 

ret = self.to_tensor_product_of_kirillov_reshetikhin_tableaux().e(a) 

if ret is None: 

return None 

return ret.to_rigged_configuration() 

except NotImplementedError: 

# We haven't implemented the bijection yet, so return None 

# This is to make sure we can at least view it as a classical 

# crystal if there is no bijection. 

return None 

 

return RiggedConfigurationElement.e(self, a) 

 

def f(self, a): 

r""" 

Return the action of the crystal operator `f_a` on ``self``. 

 

For the classical operators, this implements the method defined 

in [CrysStructSchilling06]_. For `f_0`, this converts the class to 

a tensor product of KR tableaux and does the corresponding `f_0` 

and pulls back. 

 

.. TODO:: 

 

Implement `f_0` without appealing to tensor product of 

KR tableaux. 

 

INPUT: 

 

- ``a`` -- the index of the partition to add a box 

 

OUTPUT: 

 

The resulting rigged configuration element. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]]) 

sage: elt = RC(partition_list=[[1], [1], [1], [1]]) 

sage: elt.f(1) 

sage: elt.f(2) 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

-1[ ]-1 

-1[ ]-1 

<BLANKLINE> 

1[ ]1 

<BLANKLINE> 

-1[ ]-1 

<BLANKLINE> 

""" 

ct = self.parent()._cartan_type 

if a not in ct.index_set(): 

raise ValueError("{} is not in the index set".format(a)) 

if a == ct.special_node(): 

try: 

ret = self.to_tensor_product_of_kirillov_reshetikhin_tableaux().f(a) 

if ret is None: 

return None 

return ret.to_rigged_configuration() 

except NotImplementedError: 

# We haven't implemented the bijection yet, so return None 

# This is to make sure we can at least view it as a classical 

# crystal if there is no bijection. 

return None 

 

if not self.phi(a): 

return None 

 

return RiggedConfigurationElement.f(self, a) 

 

def epsilon(self, a): 

r""" 

Return `\varepsilon_a` of ``self``. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: I = RC.index_set() 

sage: matrix([[mg.epsilon(i) for i in I] for mg in RC.module_generators]) 

[4 0 0 0 0] 

[3 0 0 0 0] 

[2 0 0 0 0] 

""" 

if a == self.parent()._cartan_type.special_node(): 

return self.to_tensor_product_of_kirillov_reshetikhin_tableaux().epsilon(a) 

return RiggedConfigurationElement.epsilon(self, a) 

 

def phi(self, a): 

r""" 

Return `\varphi_a` of ``self``. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: I = RC.index_set() 

sage: matrix([[mg.phi(i) for i in I] for mg in RC.module_generators]) 

[0 0 2 0 0] 

[1 0 1 0 0] 

[2 0 0 0 0] 

""" 

if a == self.parent()._cartan_type.special_node(): 

return self.to_tensor_product_of_kirillov_reshetikhin_tableaux().phi(a) 

return RiggedConfigurationElement.phi(self, a) 

 

def weight(self): 

""" 

Return the weight of ``self``. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['E', 6, 1], [[2,2]]) 

sage: [x.weight() for x in RC.module_generators] 

[-4*Lambda[0] + 2*Lambda[2], -2*Lambda[0] + Lambda[2], 0] 

sage: KR = crystals.KirillovReshetikhin(['E',6,1], 2,2) 

sage: [x.weight() for x in KR.module_generators] # long time 

[0, -2*Lambda[0] + Lambda[2], -4*Lambda[0] + 2*Lambda[2]] 

 

sage: RC = RiggedConfigurations(['D', 6, 1], [[4,2]]) 

sage: [x.weight() for x in RC.module_generators] 

[-4*Lambda[0] + 2*Lambda[4], -4*Lambda[0] + Lambda[2] + Lambda[4], 

-2*Lambda[0] + Lambda[4], -4*Lambda[0] + 2*Lambda[2], 

-2*Lambda[0] + Lambda[2], 0] 

""" 

WLR = self.parent().weight_lattice_realization() 

La = WLR.fundamental_weights() 

cl_index = self.parent()._rc_index 

wt = WLR.sum((self.phi(i) - self.epsilon(i)) * La[i] for i in cl_index) 

return -wt.level() * La[0] + wt 

 

@cached_method 

def classical_weight(self): 

r""" 

Return the classical weight of ``self``. 

 

The classical weight `\Lambda` of a rigged configuration is 

 

.. MATH:: 

 

\Lambda = \sum_{a \in \overline{I}} \sum_{i > 0} 

i L_i^{(a)} \Lambda_a - \sum_{a \in \overline{I}} \sum_{i > 0} 

i m_i^{(a)} \alpha_a. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D',4,1], [[2,2]]) 

sage: elt = RC(partition_list=[[2],[2,1],[1],[1]]) 

sage: elt.classical_weight() 

(0, 1, 1, 0) 

 

This agrees with the corresponding classical weight as KR tableaux:: 

 

sage: krt = elt.to_tensor_product_of_kirillov_reshetikhin_tableaux(); krt 

[[2, 1], [3, -1]] 

sage: krt.classical_weight() == elt.classical_weight() 

True 

 

TESTS: 

 

We check the classical weights agree in an entire crystal:: 

 

sage: RC = RiggedConfigurations(['A',2,1], [[2,1], [1,1]]) 

sage: for x in RC: 

....: y = x.to_tensor_product_of_kirillov_reshetikhin_tableaux() 

....: assert x.classical_weight() == y.classical_weight() 

""" 

F = self.cartan_type().classical().root_system() 

if F.ambient_space() is None: 

WLR = F.weight_lattice() 

else: 

WLR = F.ambient_space() 

La = WLR.fundamental_weights() 

wt = WLR.sum(La[r] * s for r,s in self.parent().dims) 

 

alpha = WLR.simple_roots() 

rc_index = self.parent()._rc_index 

for a, nu in enumerate(self): 

wt -= sum(nu) * alpha[rc_index[a]] 

return wt 

 

 

def to_tensor_product_of_kirillov_reshetikhin_tableaux(self, display_steps=False, build_graph=False): 

r""" 

Perform the bijection from this rigged configuration to a tensor 

product of Kirillov-Reshetikhin tableaux given in [RigConBijection]_ 

for single boxes and with [BijectionLRT]_ and [BijectionDn]_ for 

multiple columns and rows. 

 

.. NOTE:: 

 

This is only proven to be a bijection in types `A_n^{(1)}` 

and `D_n^{(1)}`, as well as `\bigotimes_i B^{r_i,1}` and 

`\bigotimes_i B^{1,s_i}` for general affine types. 

 

INPUT: 

 

- ``display_steps`` -- (default: ``False``) boolean which indicates 

if we want to print each step in the algorithm 

- ``build_graph`` -- (default: ``False``) boolean which indicates 

if we want to construct and return a graph of the bijection whose 

vertices are rigged configurations obtained at each step and edges 

are labeled by either the return value of `\delta` or the 

doubling/halving map 

 

OUTPUT: 

 

- The tensor product of KR tableaux element corresponding to this 

rigged configuration. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]]) 

sage: RC(partition_list=[[2], [2,2], [2], [2]]).to_tensor_product_of_kirillov_reshetikhin_tableaux() 

[[3, 3], [5, 5]] 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: elt = RC(partition_list=[[2], [2,2], [1], [1]]) 

sage: tp_krt = elt.to_tensor_product_of_kirillov_reshetikhin_tableaux(); tp_krt 

[[2, 3], [3, -2]] 

 

This is invertible by calling 

:meth:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux_element.TensorProductOfKirillovReshetikhinTableauxElement.to_rigged_configuration()`:: 

 

sage: ret = tp_krt.to_rigged_configuration(); ret 

<BLANKLINE> 

0[ ][ ]0 

<BLANKLINE> 

-2[ ][ ]-2 

-2[ ][ ]-2 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

sage: elt == ret 

True 

 

To view the steps of the bijection in the output, run with 

the ``display_steps=True`` option:: 

 

sage: elt.to_tensor_product_of_kirillov_reshetikhin_tableaux(True) 

==================== 

... 

==================== 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

-2[ ][ ]-2 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

-------------------- 

[[3, 2]] 

-------------------- 

... 

[[2, 3], [3, -2]] 

 

We can also construct and display a graph of the bijection 

as follows:: 

 

sage: ret, G = elt.to_tensor_product_of_kirillov_reshetikhin_tableaux(build_graph=True) 

sage: view(G) # not tested 

""" 

from sage.combinat.rigged_configurations.bijection import RCToKRTBijection 

bij = RCToKRTBijection(self) 

ret = bij.run(display_steps, build_graph) 

if build_graph: 

return (ret, bij._graph) 

return ret 

 

def to_tensor_product_of_kirillov_reshetikhin_crystals(self, display_steps=False, build_graph=False): 

r""" 

Return the corresponding tensor product of Kirillov-Reshetikhin 

crystals. 

 

This is a composition of the map to a tensor product of KR tableaux, 

and then to a tensor product of KR crystals. 

 

INPUT: 

 

- ``display_steps`` -- (default: ``False``) boolean which indicates 

if we want to print each step in the algorithm 

- ``build_graph`` -- (default: ``False``) boolean which indicates 

if we want to construct and return a graph of the bijection whose 

vertices are rigged configurations obtained at each step and edges 

are labeled by either the return value of `\delta` or the 

doubling/halving map 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]]) 

sage: elt = RC(partition_list=[[2], [2,2], [1], [1]]) 

sage: krc = elt.to_tensor_product_of_kirillov_reshetikhin_crystals(); krc 

[[[2, 3], [3, -2]]] 

 

We can recover the rigged configuration:: 

 

sage: ret = RC(krc); ret 

<BLANKLINE> 

0[ ][ ]0 

<BLANKLINE> 

-2[ ][ ]-2 

-2[ ][ ]-2 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

sage: elt == ret 

True 

 

We can also construct and display a graph of the bijection 

as follows:: 

 

sage: ret, G = elt.to_tensor_product_of_kirillov_reshetikhin_crystals(build_graph=True) 

sage: view(G) # not tested 

""" 

if build_graph: 

kr_tab, G = self.to_tensor_product_of_kirillov_reshetikhin_tableaux(display_steps, build_graph) 

return (kr_tab.to_tensor_product_of_kirillov_reshetikhin_crystals(), G) 

kr_tab = self.to_tensor_product_of_kirillov_reshetikhin_tableaux(display_steps) 

return kr_tab.to_tensor_product_of_kirillov_reshetikhin_crystals() 

 

# TODO: Move the morphisms to a lazy attribute of RiggedConfigurations 

# once #15463 is done 

def left_split(self): 

r""" 

Return the image of ``self`` under the left column splitting 

map `\beta`. 

 

Consider the map `\beta : RC(B^{r,s} \otimes B) \to RC(B^{r,1} 

\otimes B^{r,s-1} \otimes B)` for `s > 1` which is a natural classical 

crystal injection. On rigged configurations, the map `\beta` does 

nothing (except possibly changing the vacancy numbers). 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['C',4,1], [[3,3]]) 

sage: mg = RC.module_generators[-1] 

sage: ascii_art(mg) 

0[ ][ ]0 0[ ][ ]0 0[ ][ ]0 0[ ]0 

0[ ][ ]0 0[ ][ ]0 0[ ]0 

0[ ][ ]0 0[ ]0 

sage: ascii_art(mg.left_split()) 

0[ ][ ]0 0[ ][ ]0 1[ ][ ]0 0[ ]0 

0[ ][ ]0 1[ ][ ]0 0[ ]0 

1[ ][ ]0 0[ ]0 

""" 

P = self.parent() 

if P.dims[0][1] == 1: 

raise ValueError("cannot split a single column") 

r,s = P.dims[0] 

B = [[r,1], [r,s-1]] 

B.extend(P.dims[1:]) 

from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations 

RC = RiggedConfigurations(P._cartan_type, B) 

return RC(*[x._clone() for x in self]) # Make a deep copy 

 

def right_split(self): 

r""" 

Return the image of ``self`` under the right column splitting 

map `\beta^*`. 

 

Let `\theta` denote the 

:meth:`complement rigging map<complement_rigging>` which reverses 

the tensor factors and `\beta` denote the 

:meth:`left splitting map<left_split>`, we define the right 

splitting map by `\beta^* := \theta \circ \beta \circ \theta`. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['C',4,1], [[3,3]]) 

sage: mg = RC.module_generators[-1] 

sage: ascii_art(mg) 

0[ ][ ]0 0[ ][ ]0 0[ ][ ]0 0[ ]0 

0[ ][ ]0 0[ ][ ]0 0[ ]0 

0[ ][ ]0 0[ ]0 

sage: ascii_art(mg.right_split()) 

0[ ][ ]0 0[ ][ ]0 1[ ][ ]1 0[ ]0 

0[ ][ ]0 1[ ][ ]1 0[ ]0 

1[ ][ ]1 0[ ]0 

 

sage: RC = RiggedConfigurations(['D',4,1], [[2,2],[1,2]]) 

sage: elt = RC(partition_list=[[3,1], [2,2,1], [2,1], [2]]) 

sage: ascii_art(elt) 

-1[ ][ ][ ]-1 0[ ][ ]0 -1[ ][ ]-1 1[ ][ ]1 

0[ ]0 0[ ][ ]0 -1[ ]-1 

0[ ]0 

sage: ascii_art(elt.right_split()) 

-1[ ][ ][ ]-1 0[ ][ ]0 -1[ ][ ]-1 1[ ][ ]1 

1[ ]0 0[ ][ ]0 -1[ ]-1 

0[ ]0 

 

We check that the bijection commutes with the right spliting map:: 

 

sage: RC = RiggedConfigurations(['A', 3, 1], [[1,1], [2,2]]) 

sage: all(rc.right_split().to_tensor_product_of_kirillov_reshetikhin_tableaux() 

....: == rc.to_tensor_product_of_kirillov_reshetikhin_tableaux().right_split() for rc in RC) 

True 

""" 

return self.complement_rigging(True).left_split().complement_rigging(True) 

 

def left_box(self, return_b=False): 

r""" 

Return the image of ``self`` under the left box removal map `\delta`. 

 

The map `\delta : RC(B^{r,1} \otimes B) \to RC(B^{r-1,1} 

\otimes B)` (if `r = 1`, then we remove the left-most factor) is the 

basic map in the bijection `\Phi` between rigged configurations and 

tensor products of Kirillov-Reshetikhin tableaux. For more 

information, see 

:meth:`to_tensor_product_of_kirillov_reshetikhin_tableaux()`. 

We can extend `\delta` when the left-most factor is not a single 

column by precomposing with a :meth:`left_split()`. 

 

.. NOTE:: 

 

Due to the special nature of the bijection for the spinor cases in 

types `D_n^{(1)}`, `B_n^{(1)}`, and `A_{2n-1}^{(2)}`, this map is 

not defined in these cases. 

 

INPUT: 

 

- ``return_b`` -- (default: ``False``) whether to return the 

resulting letter from `\delta` 

 

OUTPUT: 

 

The resulting rigged configuration or if ``return_b`` is ``True``, 

then a tuple of the resulting rigged configuration and the letter. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['C',4,1], [[3,2]]) 

sage: mg = RC.module_generators[-1] 

sage: ascii_art(mg) 

0[ ][ ]0 0[ ][ ]0 0[ ][ ]0 0[ ]0 

0[ ][ ]0 0[ ][ ]0 0[ ]0 

0[ ][ ]0 0[ ]0 

sage: ascii_art(mg.left_box()) 

0[ ]0 0[ ][ ]0 0[ ][ ]0 0[ ]0 

0[ ]0 0[ ][ ]0 0[ ]0 

sage: x,b = mg.left_box(True) 

sage: b 

-1 

sage: b.parent() 

The crystal of letters for type ['C', 4] 

""" 

# Don't do spinor cases 

P = self.parent() 

ct = P.cartan_type() 

if ct.type() == 'D': 

if P.dims[0][0] >= ct.rank() - 2: 

raise ValueError("only for non-spinor cases") 

elif ct.type() == 'B' or ct.dual().type() == 'B': 

if P.dims[0][0] == ct.rank() - 1: 

raise ValueError("only for non-spinor cases") 

 

from sage.combinat.rigged_configurations.bijection import RCToKRTBijection 

rc = self 

if P.dims[0][1] != 1: 

rc = self.left_split() 

bij = RCToKRTBijection(rc) 

ht = bij.cur_dims[0][0] 

bij.cur_dims[0][0] = bij._next_index(ht) 

b = bij.next_state(ht) 

if bij.cur_dims[0][0] == 0: 

bij.cur_dims.pop(0) 

from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations 

RC = RiggedConfigurations(ct, bij.cur_dims) 

rc = RC(*bij.cur_partitions) 

if return_b: 

from sage.combinat.crystals.letters import CrystalOfLetters 

L = CrystalOfLetters(self.parent()._cartan_type.classical()) 

return (rc, L(b)) 

return rc 

 

delta = left_box 

 

def left_column_box(self): 

r""" 

Return the image of ``self`` under the left column box splitting 

map `\gamma`. 

 

Consider the map `\gamma : RC(B^{r,1} \otimes B) \to RC(B^{1,1} 

\otimes B^{r-1,1} \otimes B)` for `r > 1`, which is a natural strict 

classical crystal injection. On rigged configurations, the map 

`\gamma` adds a singular string of length `1` to `\nu^{(a)}`. 

 

We can extend `\gamma` when the left-most factor is not a single 

column by precomposing with a :meth:`left_split()`. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['C',3,1], [[3,1], [2,1]]) 

sage: mg = RC.module_generators[-1] 

sage: ascii_art(mg) 

0[ ]0 0[ ][ ]0 0[ ]0 

0[ ]0 0[ ]0 

sage: ascii_art(mg.left_column_box()) 

0[ ]0 0[ ][ ]0 0[ ]0 

0[ ]0 0[ ]0 0[ ]0 

0[ ]0 

 

sage: RC = RiggedConfigurations(['C',3,1], [[2,1], [1,1], [3,1]]) 

sage: mg = RC.module_generators[7] 

sage: ascii_art(mg) 

1[ ]0 0[ ][ ]0 0[ ]0 

0[ ]0 0[ ]0 

sage: ascii_art(mg.left_column_box()) 

1[ ]1 0[ ][ ]0 0[ ]0 

1[ ]0 0[ ]0 0[ ]0 

""" 

P = self.parent() 

r = P.dims[0][0] 

if r == 1: 

raise ValueError("cannot split a single box") 

ct = P.cartan_type() 

if ct.type() == 'D': 

if P.dims[0][0] >= ct.rank() - 2: 

raise ValueError("only for non-spinor cases") 

elif ct.type() == 'B' or ct.dual().type() == 'B': 

if P.dims[0][0] == ct.rank() - 1: 

raise ValueError("only for non-spinor cases") 

 

if P.dims[0][1] > 1: 

return self.left_split().left_column_box() 

 

B = [[1,1], [r-1,1]] 

B.extend(P.dims[1:]) 

from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations 

RC = RiggedConfigurations(P._cartan_type, B) 

parts = [x._clone() for x in self] # Make a deep copy 

for nu in parts[:r-1]: 

nu._list.append(1) 

for a, nu in enumerate(parts[:r-1]): 

vac_num = RC._calc_vacancy_number(parts, a, 1) 

i = nu._list.index(1) 

nu.vacancy_numbers.insert(i, vac_num) 

nu.rigging.insert(i, vac_num) 

return RC(*parts) 

 

def right_column_box(self): 

r""" 

Return the image of ``self`` under the right column box splitting 

map `\gamma^*`. 

 

Consider the map `\gamma^* : RC(B \otimes B^{r,1}) \to RC(B \otimes 

B^{r-1,1} \otimes B^{1,1})` for `r > 1`, which is a natural strict 

classical crystal injection. On rigged configurations, the map 

`\gamma` adds a string of length `1` with rigging 0 to `\nu^{(a)}` 

for all `a < r` to a classically highest weight element and extended 

as a classical crystal morphism. 

 

We can extend `\gamma^*` when the right-most factor is not a single 

column by precomposing with a :meth:`right_split()`. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['C',3,1], [[2,1], [1,1], [3,1]]) 

sage: mg = RC.module_generators[7] 

sage: ascii_art(mg) 

1[ ]0 0[ ][ ]0 0[ ]0 

0[ ]0 0[ ]0 

sage: ascii_art(mg.right_column_box()) 

1[ ]0 0[ ][ ]0 0[ ]0 

1[ ]0 0[ ]0 0[ ]0 

0[ ]0 

""" 

P = self.parent() 

r = P.dims[-1][0] 

if r == 1: 

raise ValueError("cannot split a single box") 

ct = P.cartan_type() 

if ct.type() == 'D': 

if P.dims[-1][0] >= ct.rank() - 2: 

raise ValueError("only for non-spinor cases") 

elif ct.type() == 'B' or ct.dual().type() == 'B': 

if P.dims[-1][0] == ct.rank() - 1: 

raise ValueError("only for non-spinor cases") 

 

if P.dims[-1][1] > 1: 

return self.right_split().right_column_box() 

 

rc, e_string = self.to_highest_weight(P._rc_index) 

 

B = P.dims[:-1] + ([r-1,1], [1,1]) 

from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations 

RC = RiggedConfigurations(P._cartan_type, B) 

parts = [x._clone() for x in rc] # Make a deep copy 

for nu in parts[:r-1]: 

nu._list.append(1) 

for a, nu in enumerate(parts[:r-1]): 

vac_num = RC._calc_vacancy_number(parts, a, -1) 

nu.vacancy_numbers.append(vac_num) 

nu.rigging.append(0) 

return RC(*parts).f_string(reversed(e_string)) 

 

def complement_rigging(self, reverse_factors=False): 

r""" 

Apply the complement rigging morphism `\theta` to ``self``. 

 

Consider a highest weight rigged configuration `(\nu, J)`, the 

complement rigging morphism `\theta : RC(L) \to RC(L)` is given by 

sending `(\nu, J) \mapsto (\nu, J')`, where `J'` is obtained by 

taking the coriggings `x' = p_i^{(a)} - x`, and then extending as 

a crystal morphism. (The name comes from taking the complement 

partition for the riggings in a `m_i^{(a)} \times p_i^{(a)}` box.) 

 

INPUT: 

 

- ``reverse_factors`` -- (default: ``False``) if ``True``, then this 

returns an element in `RC(B')` where `B'` is the tensor factors 

of ``self`` in reverse order 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['D',4,1], [[1,1],[2,2]]) 

sage: mg = RC.module_generators[-1] 

sage: ascii_art(mg) 

1[ ][ ]1 0[ ][ ]0 0[ ][ ]0 0[ ][ ]0 

0[ ][ ]0 

sage: ascii_art(mg.complement_rigging()) 

1[ ][ ]0 0[ ][ ]0 0[ ][ ]0 0[ ][ ]0 

0[ ][ ]0 

 

sage: lw = mg.to_lowest_weight([1,2,3,4])[0] 

sage: ascii_art(lw) 

-1[ ][ ]-1 0[ ][ ]0 0[ ][ ]0 0[ ][ ]0 

-1[ ]-1 0[ ][ ]0 0[ ]0 0[ ]0 

-1[ ]-1 0[ ]0 

0[ ]0 

sage: ascii_art(lw.complement_rigging()) 

-1[ ][ ][ ]-1 0[ ][ ][ ]0 0[ ][ ][ ]0 0[ ][ ][ ]0 

-1[ ]-1 0[ ][ ][ ]0 

sage: lw.complement_rigging() == mg.complement_rigging().to_lowest_weight([1,2,3,4])[0] 

True 

 

sage: mg.complement_rigging(True).parent() 

Rigged configurations of type ['D', 4, 1] and factor(s) ((2, 2), (1, 1)) 

 

We check that the Lusztig involution (under the modification of also 

mapping to the highest weight element) intertwines with the 

complement map `\theta` (that reverses the tensor factors) 

under the bijection `\Phi`:: 

 

sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2], [2, 1], [1, 2]]) 

sage: for mg in RC.module_generators: # long time 

....: y = mg.to_tensor_product_of_kirillov_reshetikhin_tableaux() 

....: hw = y.lusztig_involution().to_highest_weight([1,2,3,4])[0] 

....: c = mg.complement_rigging(True) 

....: hwc = c.to_tensor_product_of_kirillov_reshetikhin_tableaux() 

....: assert hw == hwc 

 

TESTS: 

 

We check that :trac:`18898` is fixed:: 

 

sage: RC = RiggedConfigurations(['D',4,1], [[2,1], [2,1], [2,3]]) 

sage: x = RC(partition_list=[[1], [1,1], [1], [1]], rigging_list=[[0], [2,1], [0], [0]]) 

sage: ascii_art(x) 

0[ ]0 2[ ]2 0[ ]0 0[ ]0 

2[ ]1 

sage: ascii_art(x.complement_rigging()) 

0[ ]0 2[ ]1 0[ ]0 0[ ]0 

2[ ]0 

""" 

P = self.parent() 

if reverse_factors: 

from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations 

P = RiggedConfigurations(P._cartan_type, reversed(P.dims)) 

 

mg, e_str = self.to_highest_weight(P._rc_index) 

nu = [] 

rig = [] 

for a,p in enumerate(mg): 

nu.append(list(p)) 

vac_nums = p.vacancy_numbers 

riggings = [vac - p.rigging[i] for i,vac in enumerate(vac_nums)] 

block = 0 

for j,i in enumerate(p): 

if p[block] != i: 

riggings[block:j] = sorted(riggings[block:j], reverse=True) 

block = j 

riggings[block:] = sorted(riggings[block:], reverse=True) 

rig.append(riggings) 

 

rc = P(partition_list=nu, rigging_list=rig) 

return rc.f_string(reversed(e_str)) 

 

class KRRCSimplyLacedElement(KRRiggedConfigurationElement): 

r""" 

`U_q^{\prime}(\mathfrak{g})` rigged configurations in simply-laced types. 

 

TESTS:: 

 

sage: RC = RiggedConfigurations(['A', 3, 1], [[3, 2], [2,1], [1,1]]) 

sage: elt = RC(partition_list=[[1], [1], []]); elt 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

0[ ]0 

<BLANKLINE> 

(/) 

<BLANKLINE> 

sage: TestSuite(elt).run() 

""" 

@cached_method 

def cocharge(self): 

r""" 

Compute the cocharge statistic of ``self``. 

 

Computes the cocharge statistic [CrysStructSchilling06]_ on this 

rigged configuration `(\nu, J)`. The cocharge statistic is defined as: 

 

.. MATH:: 

 

cc(\nu, J) = \frac{1}{2} \sum_{a, b \in I_0} 

\sum_{j,k > 0} \left( \alpha_a \mid \alpha_b \right) 

\min(j, k) m_j^{(a)} m_k^{(b)} 

+ \sum_{a \in I} \sum_{i > 0} \left\lvert J^{(a, i)} \right\rvert. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 3, 1], [[3, 2], [2,1], [1,1]]) 

sage: RC(partition_list=[[1], [1], []]).cocharge() 

1 

""" 

cc = 0 

rigging_sum = 0 

for a, p in enumerate(self): 

for pos, i in enumerate(p._list): 

# Add the rigging 

rigging_sum += p.rigging[pos] 

# Add the L matrix contribution 

for dim in self.parent().dims: 

if dim[0] == a + 1: 

cc += min(dim[1], i) 

# Subtract the vacancy number 

cc -= p.vacancy_numbers[pos] 

return cc // 2 + rigging_sum 

 

cc = cocharge 

 

@cached_method 

def charge(self): 

r""" 

Compute the charge statistic of ``self``. 

 

Let `B` denote a set of rigged configurations. The *charge* `c` of 

a rigged configuration `b` is computed as 

 

.. MATH:: 

 

c(b) = \max(cc(b) \mid b \in B) - cc(b). 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A', 3, 1], [[3, 2], [2,1], [1,1]]) 

sage: RC(partition_list=[[],[],[]]).charge() 

2 

sage: RC(partition_list=[[1], [1], []]).charge() 

1 

""" 

B = self.parent() 

if not hasattr(B, "_max_charge"): 

B._max_charge = max(b.cocharge() for b in B.module_generators) 

return B._max_charge - self.cocharge() 

 

class KRRCNonSimplyLacedElement(KRRiggedConfigurationElement, RCNonSimplyLacedElement): 

r""" 

`U_q^{\prime}(\mathfrak{g})` rigged configurations in non-simply-laced 

types. 

 

TESTS:: 

 

sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[1,1],[2,1]]) 

sage: elt = RC(partition_list=[[3],[2]]); elt 

<BLANKLINE> 

0[ ][ ][ ]0 

<BLANKLINE> 

0[ ][ ]0 

sage: TestSuite(elt).run() 

""" 

def e(self, a): 

r""" 

Return the action of `e_a` on ``self``. 

 

This works by lifting into the virtual configuration, then applying 

 

.. MATH:: 

 

e^v_a = \prod_{j \in \iota(a)} \hat{e}_j^{\gamma_j} 

 

and pulling back. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A',6,2], [[1,1]]*7) 

sage: elt = RC(partition_list=[[1]*5,[2,1,1],[3,2]]) 

sage: elt.e(3) 

<BLANKLINE> 

0[ ]0 

0[ ]0 

0[ ]0 

0[ ]0 

0[ ]0 

<BLANKLINE> 

0[ ][ ]0 

1[ ]1 

1[ ]1 

<BLANKLINE> 

1[ ][ ]1 

1[ ]0 

<BLANKLINE> 

""" 

if a == self.parent()._cartan_type.special_node(): 

try: 

ret = self.to_tensor_product_of_kirillov_reshetikhin_tableaux().e(a) 

if ret is None: 

return None 

return ret.to_rigged_configuration() 

except (NotImplementedError, TypeError): 

# We haven't implemented the bijection yet, so try by lifting 

# to the simply-laced case 

return RCNonSimplyLacedElement.e(self, a) 

 

if not self.epsilon(a): 

return None 

return RCNonSimplyLacedElement.e(self, a) 

 

def f(self, a): 

r""" 

Return the action of `f_a` on ``self``. 

 

This works by lifting into the virtual configuration, then applying 

 

.. MATH:: 

 

f^v_a = \prod_{j \in \iota(a)} \hat{f}_j^{\gamma_j} 

 

and pulling back. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['A',6,2], [[1,1]]*7) 

sage: elt = RC(partition_list=[[1]*5,[2,1,1],[2,1]], rigging_list=[[0]*5,[0,1,1],[1,0]]) 

sage: elt.f(3) 

<BLANKLINE> 

0[ ]0 

0[ ]0 

0[ ]0 

0[ ]0 

0[ ]0 

<BLANKLINE> 

1[ ][ ]1 

1[ ]1 

1[ ]1 

<BLANKLINE> 

-1[ ][ ][ ]-1 

0[ ][ ]0 

<BLANKLINE> 

""" 

if a == self.parent()._cartan_type.special_node(): 

try: 

ret = self.to_tensor_product_of_kirillov_reshetikhin_tableaux().f(a) 

if ret is None: 

return None 

return ret.to_rigged_configuration() 

except (NotImplementedError, TypeError): 

# We haven't implemented the bijection yet, so try by lifting 

# to the simply-laced case 

return RCNonSimplyLacedElement.f(self, a) 

 

if not self.phi(a): 

return None 

return RCNonSimplyLacedElement.f(self, a) 

 

@cached_method 

def cocharge(self): 

r""" 

Compute the cocharge statistic. 

 

Computes the cocharge statistic [OSS03]_ on this 

rigged configuration `(\nu, J)` by computing the cocharge as a virtual 

rigged configuration `(\hat{\nu}, \hat{J})` and then using the 

identity `cc(\hat{\nu}, \hat{J}) = \gamma_0 cc(\nu, J)`. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(['C', 3, 1], [[2,1], [1,1]]) 

sage: RC(partition_list=[[1,1],[2,1],[1,1]]).cocharge() 

1 

""" 

#return self.to_virtual_configuration().cocharge() / self.parent()._folded_ct.gamma[0] 

vct = self.parent()._folded_ct 

cc = ZZ.zero() 

rigging_sum = ZZ.zero() 

sigma = vct.folding_orbit() 

gamma = vct.scaling_factors() 

for a, p in enumerate(self): 

t_check = len(sigma[a + 1]) * gamma[a+1] // gamma[0] 

for pos, i in enumerate(p._list): 

# Add the rigging 

rigging_sum += t_check * p.rigging[pos] 

# Add the L matrix contribution 

for dim in self.parent().dims: 

if dim[0] == a + 1: 

cc += t_check * min(dim[1], i) 

# Subtract the vacancy number 

cc -= t_check * p.vacancy_numbers[pos] 

return cc // 2 + rigging_sum 

 

cc = cocharge 

 

class KRRCTypeA2DualElement(KRRCNonSimplyLacedElement): 

r""" 

`U_q^{\prime}(\mathfrak{g})` rigged configurations in type 

`A_{2n}^{(2)\dagger}`. 

""" 

def epsilon(self, a): 

r""" 

Return the value of `\varepsilon_a` of ``self``. 

 

Here we need to modify the usual definition by 

`\varepsilon_n^{\prime} := 2 \varepsilon_n`. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[1,1], [2,2]]) 

sage: def epsilon(x, i): 

....: x = x.e(i) 

....: eps = 0 

....: while x is not None: 

....: x = x.e(i) 

....: eps = eps + 1 

....: return eps 

sage: all(epsilon(rc, 2) == rc.epsilon(2) for rc in RC) 

True 

""" 

if a == self.parent()._cartan_type.special_node(): 

return self.to_tensor_product_of_kirillov_reshetikhin_tableaux().epsilon(a) 

 

a = self.parent()._rc_index_inverse[a] 

if not self[a]: 

epsilon = 0 

else: 

epsilon = -min(0, min(self[a].rigging)) 

n = len(self.parent()._rc_index) 

if a == n-1: # -1 for indexing 

epsilon *= 2 

return Integer(epsilon) 

 

def phi(self, a): 

r""" 

Return the value of `\varphi_a` of ``self``. 

 

Here we need to modify the usual definition by 

`\varphi_n^{\prime} := 2 \varphi_n`. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[1,1], [2,2]]) 

sage: def phi(x, i): 

....: x = x.f(i) 

....: ph = 0 

....: while x is not None: 

....: x = x.f(i) 

....: ph = ph + 1 

....: return ph 

sage: all(phi(rc, 2) == rc.phi(2) for rc in RC) 

True 

""" 

if a == self.parent()._cartan_type.special_node(): 

return self.to_tensor_product_of_kirillov_reshetikhin_tableaux().phi(a) 

 

a = self.parent()._rc_index_inverse[a] 

p_inf = self.parent()._calc_vacancy_number(self, a, float("inf")) 

if not self[a]: 

phi = p_inf 

else: 

phi = p_inf - min(0, min(self[a].rigging)) 

n = len(self.parent()._rc_index) 

if a == n-1: # -1 for indexing 

phi *= 2 

return Integer(phi) 

 

@cached_method 

def cocharge(self): 

r""" 

Compute the cocharge statistic. 

 

Computes the cocharge statistic [RigConBijection]_ on this 

rigged configuration `(\nu, J)`. The cocharge statistic is 

computed as: 

 

.. MATH:: 

 

cc(\nu, J) = \frac{1}{2} \sum_{a \in I_0} \sum_{i > 0} 

t_a^{\vee} m_i^{(a)} \left( \sum_{j > 0} \min(i, j) L_j^{(a)} 

- p_i^{(a)} \right) + \sum_{a \in I} t_a^{\vee} \sum_{i > 0} 

\left\lvert J^{(a, i)} \right\rvert. 

 

EXAMPLES:: 

 

sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[1,1],[2,2]]) 

sage: sc = RC.cartan_type().as_folding().scaling_factors() 

sage: all(mg.cocharge() * sc[0] == mg.to_virtual_configuration().cocharge() 

....: for mg in RC.module_generators) 

True 

""" 

#return self.to_virtual_configuration().cocharge() / self.parent()._folded_ct.gamma[0] 

vct = self.parent()._folded_ct 

cc = ZZ.zero() 

rigging_sum = ZZ.zero() 

#sigma = vct.folding_orbit() 

#gammatilde = list(vct.scaling_factors()) 

#gammatilde[-1] = 2 

for a, p in enumerate(self): 

t_check = 1 # == len(sigma[a+1]) * gammatilde[a+1] / gammatilde[0] 

for pos, i in enumerate(p._list): 

# Add the rigging 

rigging_sum += t_check * p.rigging[pos] 

# Add the L matrix contribution 

for dim in self.parent().dims: 

if dim[0] == a + 1: 

cc += t_check * min(dim[1], i) 

# Subtract the vacancy number 

cc -= t_check * p.vacancy_numbers[pos] 

return cc / ZZ(2) + rigging_sum 

 

cc = cocharge