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

r""" 

Strata of differentials on Riemann surfaces 

 

.. WARNING:: 

 

This module is deprecated. You are advised to install and use the 

surface_dynamics package instead available at 

https://pypi.python.org/pypi/surface_dynamics/ 

 

The space of Abelian (or quadratic) differentials is stratified by the 

degrees of the zeroes (and simple poles for quadratic 

differentials). Each stratum has one, two or three connected 

components and each is associated to an (extended) Rauzy class. The 

:meth:`~sage.dynamics.flat_surfaces.strata.AbelianStratum.connected_components` 

method (only available for Abelian stratum) give the decomposition of 

a stratum (which corresponds to the SAGE object 

:class:`~sage.dynamics.flat_surfaces.strata.AbelianStratum`). 

 

The work for Abelian differentials was done by Maxim Kontsevich and Anton 

Zorich in [KZ2003]_ and for quadratic differentials by Erwan Lanneau in 

[Lan2008]_. Zorich gave an algorithm to pass from a connected component of a 

stratum to the associated Rauzy class (for both interval exchange 

transformations and linear involutions) in [Zor2008]_ and is implemented for 

Abelian stratum at different level (approximately one for each component): 

 

- for connected stratum :meth:`~ConnectedComponentOfAbelianStratum.representative` 

- for hyperelliptic component :meth:`~HypConnectedComponentOfAbelianStratum.representative` 

- for non hyperelliptic component, the algorithm is the same as for connected 

component 

- for odd component :meth:`~OddConnectedComponentOfAbelianStratum.representative` 

- for even component :meth:`~EvenConnectedComponentOfAbelianStratum.representative` 

 

The inverse operation (pass from an interval exchange transformation to 

the connected component) is partially written in [KZ2003]_ and 

simply named here 

:meth:`~sage.dynamics.interval_exchanges.template.PermutationIET.connected_component`. 

 

All the code here was first available on Mathematica [Zor]_. 

 

.. NOTE:: 

 

The quadratic strata are not yet implemented. 

 

AUTHORS: 

 

- Vincent Delecroix (2009-09-29): initial version 

 

 

EXAMPLES: 

 

Construction of a stratum from a list of singularity degrees:: 

 

sage: a = AbelianStratum(1,1) 

doctest:warning 

... 

DeprecationWarning: AbelianStratum is deprecated and will be removed from Sage. 

You are advised to install the surface_dynamics package via: 

sage -pip install surface_dynamics 

If you do not have write access to the Sage installation you can 

alternatively do 

sage -pip install surface_dynamics --user 

The package surface_dynamics subsumes all flat surface related 

computation that are currently available in Sage. See more 

information at 

http://www.labri.fr/perso/vdelecro/surface-dynamics/latest/ 

See http://trac.sagemath.org/20695 for details. 

sage: a 

H(1, 1) 

sage: a.genus() 

2 

sage: a.nintervals() 

5 

 

:: 

 

sage: a = AbelianStratum(4,3,2,1) 

sage: a 

H(4, 3, 2, 1) 

sage: a.genus() 

6 

sage: a.nintervals() 

15 

 

By convention, the degrees are always written in decreasing order:: 

 

sage: a1 = AbelianStratum(4,3,2,1) 

sage: a1 

H(4, 3, 2, 1) 

sage: a2 = AbelianStratum(2,3,1,4) 

sage: a2 

H(4, 3, 2, 1) 

sage: a1 == a2 

True 

 

It is also possible to consider stratum with an incoming or an 

outgoing separatrix marked (the aim of this consideration is to 

attach a specified degree at the left or the right of the associated 

interval exchange transformation):: 

 

sage: a_out = AbelianStratum(1, 1, marked_separatrix='out') 

sage: a_out 

H^out(1, 1) 

sage: a_in = AbelianStratum(1, 1, marked_separatrix='in') 

sage: a_in 

H^in(1, 1) 

sage: a_out == a_in 

False 

 

Get a list of strata with constraints on genus or on the number of intervals 

of a representative:: 

 

sage: for a in AbelianStrata(genus=3): 

....: print(a) 

doctest:warning 

... 

DeprecationWarning: AbelianStrata is deprecated and will be removed from Sage. 

You are advised to install the surface_dynamics package via: 

sage -pip install surface_dynamics 

If you do not have write access to the Sage installation you can 

alternatively do 

sage -pip install surface_dynamics --user 

The package surface_dynamics subsumes all flat surface related 

computation that are currently available in Sage. See more 

information at 

http://www.labri.fr/perso/vdelecro/surface-dynamics/latest/ 

See http://trac.sagemath.org/20695 for details. 

H(4) 

H(3, 1) 

H(2, 2) 

H(2, 1, 1) 

H(1, 1, 1, 1) 

 

:: 

 

sage: for a in AbelianStrata(nintervals=5): 

....: print(a) 

H^out(0, 2) 

H^out(2, 0) 

H^out(1, 1) 

H^out(0, 0, 0, 0) 

 

:: 

 

sage: for a in AbelianStrata(genus=2, nintervals=5): 

....: print(a) 

H^out(0, 2) 

H^out(2, 0) 

H^out(1, 1) 

 

Obtains the connected components of a stratum:: 

 

sage: a = AbelianStratum(0) 

sage: a.connected_components() 

[H_hyp(0)] 

 

:: 

 

sage: a = AbelianStratum(6) 

sage: cc = a.connected_components() 

sage: cc 

[H_hyp(6), H_odd(6), H_even(6)] 

sage: for c in cc: 

....: print(c) 

....: print(c.representative(alphabet=range(1,9))) 

H_hyp(6) 

1 2 3 4 5 6 7 8 

8 7 6 5 4 3 2 1 

H_odd(6) 

1 2 3 4 5 6 7 8 

4 3 6 5 8 7 2 1 

H_even(6) 

1 2 3 4 5 6 7 8 

6 5 4 3 8 7 2 1 

 

:: 

 

sage: a = AbelianStratum(1, 1, 1, 1) 

sage: a.connected_components() 

[H_c(1, 1, 1, 1)] 

sage: c = a.connected_components()[0] 

sage: print(c.representative(alphabet="abcdefghi")) 

a b c d e f g h i 

e d c f i h g b a 

 

The zero attached on the left of the associated Abelian permutation 

corresponds to the first singularity degree:: 

 

sage: a = AbelianStratum(4, 2, marked_separatrix='out') 

sage: b = AbelianStratum(2, 4, marked_separatrix='out') 

sage: a == b 

False 

sage: a, a.connected_components() 

(H^out(4, 2), [H_odd^out(4, 2), H_even^out(4, 2)]) 

sage: b, b.connected_components() 

(H^out(2, 4), [H_odd^out(2, 4), H_even^out(2, 4)]) 

sage: a_odd, a_even = a.connected_components() 

sage: b_odd, b_even = b.connected_components() 

 

The representatives are hence different:: 

 

sage: a_odd.representative(alphabet=range(1,10)) 

1 2 3 4 5 6 7 8 9 

4 3 6 5 7 9 8 2 1 

sage: b_odd.representative(alphabet=range(1,10)) 

1 2 3 4 5 6 7 8 9 

4 3 5 7 6 9 8 2 1 

 

:: 

 

sage: a_even.representative(alphabet=range(1,10)) 

1 2 3 4 5 6 7 8 9 

6 5 4 3 7 9 8 2 1 

sage: b_even.representative(alphabet=range(1,10)) 

1 2 3 4 5 6 7 8 9 

7 6 5 4 3 9 8 2 1 

 

You can retrieve the decomposition of the irreducible Abelian permutations into 

Rauzy diagrams from the classification of strata:: 

 

sage: a = AbelianStrata(nintervals=4) 

sage: l = sum([stratum.connected_components() for stratum in a], []) 

sage: n = [x.rauzy_diagram().cardinality() for x in l] 

sage: for c,i in zip(l,n): 

....: print("{} : {}".format(c, i)) 

H_hyp^out(2) : 7 

H_hyp^out(0, 0, 0) : 6 

sage: sum(n) 

13 

 

:: 

 

sage: a = AbelianStrata(nintervals=5) 

sage: l = sum([stratum.connected_components() for stratum in a], []) 

sage: n = [x.rauzy_diagram().cardinality() for x in l] 

sage: for c,i in zip(l,n): 

....: print("{} : {}".format(c, i)) 

H_hyp^out(0, 2) : 11 

H_hyp^out(2, 0) : 35 

H_hyp^out(1, 1) : 15 

H_hyp^out(0, 0, 0, 0) : 10 

sage: sum(n) 

71 

 

:: 

 

sage: a = AbelianStrata(nintervals=6) 

sage: l = sum([stratum.connected_components() for stratum in a], []) 

sage: n = [x.rauzy_diagram().cardinality() for x in l] 

sage: for c,i in zip(l,n): 

....: print("{} : {}".format(c, i)) 

H_hyp^out(4) : 31 

H_odd^out(4) : 134 

H_hyp^out(0, 2, 0) : 66 

H_hyp^out(2, 0, 0) : 105 

H_hyp^out(0, 1, 1) : 20 

H_hyp^out(1, 1, 0) : 90 

H_hyp^out(0, 0, 0, 0, 0) : 15 

sage: sum(n) 

461 

""" 

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

# Copyright (C) 2009 Vincent Delecroix <20100.delecroix@gmail.com> 

# 

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

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

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

from __future__ import print_function 

from six.moves import range 

 

from sage.structure.sage_object import SageObject 

 

from sage.combinat.combinat import CombinatorialClass 

from sage.combinat.combinat import InfiniteAbstractCombinatorialClass 

from sage.combinat.partition import Partitions 

 

from sage.rings.integer import Integer 

 

 

def AbelianStrata(genus=None, nintervals=None, marked_separatrix=None): 

r""" 

Abelian strata. 

 

INPUT: 

 

- ``genus`` - a non negative integer or ``None`` 

 

- ``nintervals`` - a non negative integer or ``None`` 

 

- ``marked_separatrix`` - 'no' (for no marking), 'in' (for marking an 

incoming separatrix) or 'out' (for marking an outgoing separatrix) 

 

EXAMPLES: 

 

Abelian strata with a given genus:: 

 

sage: for s in AbelianStrata(genus=1): print(s) 

H(0) 

 

:: 

 

sage: for s in AbelianStrata(genus=2): print(s) 

H(2) 

H(1, 1) 

 

:: 

 

sage: for s in AbelianStrata(genus=3): print(s) 

H(4) 

H(3, 1) 

H(2, 2) 

H(2, 1, 1) 

H(1, 1, 1, 1) 

 

:: 

 

sage: for s in AbelianStrata(genus=4): print(s) 

H(6) 

H(5, 1) 

H(4, 2) 

H(4, 1, 1) 

H(3, 3) 

H(3, 2, 1) 

H(3, 1, 1, 1) 

H(2, 2, 2) 

H(2, 2, 1, 1) 

H(2, 1, 1, 1, 1) 

H(1, 1, 1, 1, 1, 1) 

 

Abelian strata with a given number of intervals:: 

 

sage: for s in AbelianStrata(nintervals=2): print(s) 

H^out(0) 

 

:: 

 

sage: for s in AbelianStrata(nintervals=3): print(s) 

H^out(0, 0) 

 

:: 

 

sage: for s in AbelianStrata(nintervals=4): print(s) 

H^out(2) 

H^out(0, 0, 0) 

 

:: 

 

sage: for s in AbelianStrata(nintervals=5): print(s) 

H^out(0, 2) 

H^out(2, 0) 

H^out(1, 1) 

H^out(0, 0, 0, 0) 

 

Abelian strata with both constraints:: 

 

sage: for s in AbelianStrata(genus=2, nintervals=4): print(s) 

H^out(2) 

 

:: 

 

sage: for s in AbelianStrata(genus=5, nintervals=12): print(s) 

H^out(8, 0, 0) 

H^out(0, 8, 0) 

H^out(0, 7, 1) 

H^out(1, 7, 0) 

H^out(7, 1, 0) 

H^out(0, 6, 2) 

H^out(2, 6, 0) 

H^out(6, 2, 0) 

H^out(1, 6, 1) 

H^out(6, 1, 1) 

H^out(0, 5, 3) 

H^out(3, 5, 0) 

H^out(5, 3, 0) 

H^out(1, 5, 2) 

H^out(2, 5, 1) 

H^out(5, 2, 1) 

H^out(0, 4, 4) 

H^out(4, 4, 0) 

H^out(1, 4, 3) 

H^out(3, 4, 1) 

H^out(4, 3, 1) 

H^out(2, 4, 2) 

H^out(4, 2, 2) 

H^out(2, 3, 3) 

H^out(3, 3, 2) 

""" 

from sage.dynamics.surface_dynamics_deprecation import surface_dynamics_deprecation 

surface_dynamics_deprecation("AbelianStrata") 

 

if genus is None: 

if nintervals is None: 

return AbelianStrata_all() 

else: 

return AbelianStrata_d( 

nintervals=nintervals, 

marked_separatrix=marked_separatrix) 

else: 

if nintervals is None: 

return AbelianStrata_g( 

genus=genus, 

marked_separatrix=marked_separatrix) 

else: 

return AbelianStrata_gd( 

genus=genus, 

nintervals=nintervals, 

marked_separatrix=marked_separatrix) 

 

 

class AbelianStrata_g(CombinatorialClass): 

r""" 

Stratas of genus g surfaces. 

 

INPUT: 

 

- ``genus`` - a non negative integer 

 

- ``marked_separatrix`` - 'no', 'out' or 'in' 

""" 

def __init__(self, genus=None, marked_separatrix=None): 

r""" 

TESTS:: 

 

sage: s = AbelianStrata(genus=3) 

sage: s == loads(dumps(s)) 

True 

 

sage: AbelianStrata(genus=-3) 

Traceback (most recent call last): 

... 

ValueError: genus must be positive 

 

sage: AbelianStrata(genus=3, marked_separatrix='yes') 

Traceback (most recent call last): 

... 

ValueError: marked_separatrix must be no, out or in 

""" 

genus = Integer(genus) 

 

if not(genus >= 0): 

raise ValueError('genus must be positive') 

 

if marked_separatrix is None: 

marked_separatrix = 'no' 

if not marked_separatrix in ['no', 'out', 'in']: 

raise ValueError("marked_separatrix must be no, out or in") 

self._marked_separatrix = marked_separatrix 

 

self._genus = genus 

 

def _repr_(self): 

r""" 

TESTS:: 

 

sage: repr(AbelianStrata(genus=3)) #indirect doctest 

'Abelian strata of genus 3 surfaces' 

""" 

if self._marked_separatrix == 'no': 

return "Abelian strata of genus %d surfaces" % (self._genus) 

elif self._marked_separatrix == 'in': 

return "Abelian strata of genus %d surfaces and a marked incoming separatrix" % (self._genus) 

else: 

return "Abelian strata of genus %d surfaces and a marked outgoing separatrix" % (self._genus) 

 

def __iter__(self): 

r""" 

TESTS:: 

 

sage: list(AbelianStrata(genus=1)) 

[H(0)] 

""" 

if self._genus == 0: 

pass 

elif self._genus == 1: 

yield AbelianStratum(0, marked_separatrix=self._marked_separatrix) 

else: 

if self._marked_separatrix == 'no': 

for p in Partitions(2*self._genus-2): 

yield AbelianStratum(p) 

else: 

for p in Partitions(2*self._genus-2): 

l = list(p) 

for t in set(l): 

i = l.index(t) 

yield AbelianStratum([t] + l[:i] + l[i+1:], 

marked_separatrix=self._marked_separatrix) 

 

 

class AbelianStrata_d(CombinatorialClass): 

r""" 

Strata with constraint number of intervals. 

 

INPUT: 

 

- ``nintervals`` - an integer greater than 1 

 

- ``marked_separatrix`` - 'no', 'out' or 'in' 

""" 

def __init__(self, nintervals=None, marked_separatrix=None): 

r""" 

TESTS:: 

 

sage: s = AbelianStrata(nintervals=10) 

sage: s == loads(dumps(s)) 

True 

 

sage: AbelianStrata(nintervals=1) 

Traceback (most recent call last): 

... 

ValueError: number of intervals must be at least 2 

 

sage: AbelianStrata(nintervals=4, marked_separatrix='maybe') 

Traceback (most recent call last): 

... 

ValueError: marked_separatrix must be no, out or in 

""" 

nintervals = Integer(nintervals) 

 

if not(nintervals > 1): 

raise ValueError("number of intervals must be at least 2") 

 

self._nintervals = nintervals 

 

if marked_separatrix is None: 

marked_separatrix = 'out' 

if not marked_separatrix in ['no', 'out', 'in']: 

raise ValueError("marked_separatrix must be no, out or in") 

self._marked_separatrix = marked_separatrix 

 

def _repr_(self): 

r""" 

TESTS:: 

 

sage: repr(AbelianStrata(nintervals=2,marked_separatrix='no')) #indirect doctest 

'Abelian strata with 2 intervals IET' 

""" 

if self._marked_separatrix == 'no': 

return "Abelian strata with %d intervals IET" % (self._nintervals) 

elif self._marked_separatrix == 'in': 

return "Abelian strata with %d intervals IET and a marked incoming separatrix" % (self._nintervals) 

else: 

return "Abelian strata with %d intervals IET and a marked outgoing separatrix" % (self._nintervals) 

 

def __iter__(self): 

r""" 

TESTS:: 

 

sage: for a in AbelianStrata(nintervals=4): print(a) 

H^out(2) 

H^out(0, 0, 0) 

""" 

n = self._nintervals 

for s in range(1+n % 2, n, 2): 

for p in Partitions(n-1, length=s): 

l = [k-1 for k in p] 

if self._marked_separatrix == 'no': 

yield AbelianStratum(l, marked_separatrix='no') 

else: 

for t in set(l): 

i = l.index(t) 

yield AbelianStratum([t] + l[:i] + l[i+1:], 

marked_separatrix=self._marked_separatrix) 

 

 

class AbelianStrata_gd(CombinatorialClass): 

r""" 

Abelian strata of prescribed genus and number of intervals. 

 

INPUT: 

 

- ``genus`` - integer: the genus of the surfaces 

 

- ``nintervals`` - integer: the number of intervals 

 

- ``marked_separatrix`` - 'no', 'in' or 'out' 

""" 

def __init__(self, genus=None, nintervals=None, marked_separatrix=None): 

r""" 

TESTS:: 

 

sage: s = AbelianStrata(genus=4,nintervals=10) 

sage: s == loads(dumps(s)) 

True 

 

sage: AbelianStrata(genus=-1) 

Traceback (most recent call last): 

... 

ValueError: genus must be positive 

 

sage: AbelianStrata(genus=1, nintervals=1) 

Traceback (most recent call last): 

... 

ValueError: number of intervals must be at least 2 

 

sage: AbelianStrata(genus=1, marked_separatrix='so') 

Traceback (most recent call last): 

... 

ValueError: marked_separatrix must be no, out or in 

""" 

genus = Integer(genus) 

 

if not(genus >= 0): 

raise ValueError("genus must be positive") 

self._genus = genus 

 

nintervals = Integer(nintervals) 

if not(nintervals > 1): 

raise ValueError("number of intervals must be at least 2") 

self._nintervals = nintervals 

 

if marked_separatrix is None: 

marked_separatrix = 'out' 

if not marked_separatrix in ['no', 'out', 'in']: 

raise ValueError("marked_separatrix must be no, out or in") 

 

self._marked_separatrix = marked_separatrix 

 

def __repr__(self): 

r""" 

TESTS:: 

 

sage: a = AbelianStrata(genus=2,nintervals=4,marked_separatrix='no') 

sage: repr(a) #indirect doctest 

'Abelian strata of genus 2 surfaces and 4 intervals' 

""" 

if self._marked_separatrix == 'no': 

return "Abelian strata of genus %d surfaces and %d intervals" % (self._genus, self._nintervals) 

elif self._marked_separatrix == 'in': 

return "Abelian strata of genus %d surfaces and %d intervals and a marked incoming ihorizontal separatrix" % (self._genus, self._nintervals) 

else: 

return "Abelian strata of genus %d surfaces and %d intervals and a marked outgoing horizontal separatrix" % (self._genus, self._nintervals) 

 

def __iter__(self): 

r""" 

TESTS:: 

 

sage: list(AbelianStrata(genus=2,nintervals=4)) 

[H^out(2)] 

""" 

if self._genus == 0: 

pass 

elif self._genus == 1: 

if self._nintervals >= 2: 

yield AbelianStratum([0]*(self._nintervals-1), 

marked_separatrix='out') 

else: 

s = self._nintervals - 2*self._genus + 1 

for p in Partitions(2*self._genus - 2 + s, length=s): 

l = [k-1 for k in p] 

for t in set(l): 

i = l.index(t) 

yield AbelianStratum([t] + l[:i] + 

l[i+1:], marked_separatrix='out') 

 

 

class AbelianStrata_all(InfiniteAbstractCombinatorialClass): 

r""" 

Abelian strata. 

""" 

def __repr__(self): 

r""" 

TESTS:: 

 

sage: repr(AbelianStrata()) #indirect doctest 

'Abelian strata' 

""" 

return "Abelian strata" 

 

def _infinite_cclass_slice(self, g): 

r""" 

TESTS:: 

 

sage: AbelianStrata()[0] 

H(0) 

sage: AbelianStrata()[1] 

H(2) 

sage: AbelianStrata()[2] 

H(1, 1) 

 

:: 

 

sage: a = AbelianStrata() 

sage: a._infinite_cclass_slice(0) == AbelianStrata(genus=0) 

True 

sage: a._infinite_cclass_slice(10) == AbelianStrata(genus=10) 

True 

""" 

return AbelianStrata_g(g) 

 

 

class AbelianStratum(SageObject): 

""" 

Stratum of Abelian differentials. 

 

A stratum with a marked outgoing separatrix corresponds to Rauzy diagram 

with left induction, a stratum with marked incoming separatrix correspond 

to Rauzy diagram with right induction. 

If there is no marked separatrix, the associated Rauzy diagram is the 

extended Rauzy diagram (consideration of the 

:meth:`sage.dynamics.interval_exchanges.template.Permutation.symmetric` 

operation of Boissy-Lanneau). 

 

When you want to specify a marked separatrix, the degree on which it is 

the first term of your degrees list. 

 

INPUT: 

 

- ``marked_separatrix`` - ``None`` (default) or 'in' (for incoming 

separatrix) or 'out' (for outgoing separatrix). 

 

EXAMPLES: 

 

Creation of an Abelian stratum and get its connected components:: 

 

sage: a = AbelianStratum(2, 2) 

sage: a 

H(2, 2) 

sage: a.connected_components() 

[H_hyp(2, 2), H_odd(2, 2)] 

 

Specification of marked separatrix: 

 

:: 

 

sage: a = AbelianStratum(4,2,marked_separatrix='in') 

sage: a 

H^in(4, 2) 

sage: b = AbelianStratum(2,4,marked_separatrix='in') 

sage: b 

H^in(2, 4) 

sage: a == b 

False 

 

:: 

 

sage: a = AbelianStratum(4,2,marked_separatrix='out') 

sage: a 

H^out(4, 2) 

sage: b = AbelianStratum(2,4,marked_separatrix='out') 

sage: b 

H^out(2, 4) 

sage: a == b 

False 

 

Get a representative of a connected component:: 

 

sage: a = AbelianStratum(2,2) 

sage: a_hyp, a_odd = a.connected_components() 

sage: a_hyp.representative() 

1 2 3 4 5 6 7 

7 6 5 4 3 2 1 

sage: a_odd.representative() 

0 1 2 3 4 5 6 

3 2 4 6 5 1 0 

 

You can choose the alphabet:: 

 

sage: a_odd.representative(alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ") 

A B C D E F G 

D C E G F B A 

 

By default, you get a reduced permutation, but you can specify 

that you want a labelled one:: 

 

sage: p_reduced = a_odd.representative() 

sage: p_labelled = a_odd.representative(reduced=False) 

""" 

def __init__(self, *l, **d): 

""" 

TESTS:: 

 

sage: s = AbelianStratum(0) 

sage: s == loads(dumps(s)) 

True 

sage: s = AbelianStratum(1,1,1,1) 

sage: s == loads(dumps(s)) 

True 

 

sage: AbelianStratum('no','way') 

Traceback (most recent call last): 

... 

ValueError: input must be a list of integers 

 

sage: AbelianStratum([1,1,1,1], marked_separatrix='full') 

Traceback (most recent call last): 

... 

ValueError: marked_separatrix must be one of 'no', 'in', 'out' 

""" 

from sage.dynamics.surface_dynamics_deprecation import surface_dynamics_deprecation 

surface_dynamics_deprecation("AbelianStratum") 

 

if l == (): 

pass 

 

elif hasattr(l[0], "__iter__") and len(l) == 1: 

l = l[0] 

 

if not all(isinstance(i, (Integer, int)) for i in l): 

raise ValueError("input must be a list of integers") 

 

if 'marked_separatrix' in d: 

m = d['marked_separatrix'] 

 

if m is None: 

m = 'no' 

 

if (m != 'no' and m != 'in' and m != 'out'): 

raise ValueError("marked_separatrix must be one of 'no', " 

"'in', 'out'") 

self._marked_separatrix = m 

 

else: # default value 

self._marked_separatrix = 'no' 

 

self._zeroes = list(l) 

 

if not self._marked_separatrix == 'no': 

self._zeroes[1:] = sorted(self._zeroes[1:], reverse=True) 

else: 

self._zeroes.sort(reverse=True) 

 

self._genus = sum(l)/2 + 1 

 

self._genus = Integer(self._genus) 

 

zeroes = sorted(x for x in self._zeroes if x > 0) 

 

if self._genus == 1: 

self._cc = (HypCCA,) 

 

elif self._genus == 2: 

self._cc = (HypCCA,) 

 

elif self._genus == 3: 

if zeroes == [2, 2] or zeroes == [4]: 

self._cc = (HypCCA, OddCCA) 

else: 

self._cc = (CCA,) 

 

elif len(zeroes) == 1: 

# just one zeros [2g-2] 

self._cc = (HypCCA, OddCCA, EvenCCA) 

 

elif zeroes == [self._genus-1, self._genus-1]: 

# two similar zeros [g-1, g-1] 

if self._genus % 2 == 0: 

self._cc = (HypCCA, NonHypCCA) 

 

else: 

self._cc = (HypCCA, OddCCA, EvenCCA) 

 

elif len([x for x in zeroes if x % 2]) == 0: 

# even zeroes [2 l_1, 2 l_2, ..., 2 l_n] 

self._cc = (OddCCA, EvenCCA) 

 

else: 

self._cc = (CCA, ) 

 

def _repr_(self): 

""" 

TESTS:: 

 

sage: repr(AbelianStratum(1,1)) #indirect doctest 

'H(1, 1)' 

""" 

if self._marked_separatrix == 'no': 

return "H(" + str(self._zeroes)[1:-1] + ")" 

else: 

return ("H" + 

'^' + self._marked_separatrix + 

"(" + str(self._zeroes)[1:-1] + ")") 

 

def __str__(self): 

r""" 

TESTS:: 

 

sage: str(AbelianStratum(1,1)) 

'H(1, 1)' 

""" 

if self._marked_separatrix == 'no': 

return "H(" + str(self._zeroes)[1:-1] + ")" 

else: 

return ("H" + 

'^' + self._marked_separatrix + 

"(" + str(self._zeroes)[1:-1] + ")") 

 

def __eq__(self, other): 

r""" 

TESTS: 

 

sage: a = AbelianStratum(1,3) 

sage: b = AbelianStratum(3,1) 

sage: c = AbelianStratum(1,3,marked_separatrix='out') 

sage: d = AbelianStratum(3,1,marked_separatrix='out') 

sage: e = AbelianStratum(1,3,marked_separatrix='in') 

sage: f = AbelianStratum(3,1,marked_separatrix='in') 

sage: a == b # no difference for unmarked 

True 

sage: c == d # difference for out mark 

False 

sage: e == f # difference for in mark 

False 

sage: a == c # difference between no mark and out mark 

False 

sage: a == e # difference between no mark and in mark 

False 

sage: c == e # difference between out mark adn in mark 

False 

 

sage: a == False 

Traceback (most recent call last): 

... 

TypeError: the right member must be a stratum 

""" 

if type(self) is not type(other): 

raise TypeError("the right member must be a stratum") 

 

return (self._marked_separatrix == other._marked_separatrix and 

self._zeroes == other._zeroes) 

 

def __ne__(self, other): 

r""" 

TESTS:: 

 

sage: a = AbelianStratum(1,3) 

sage: b = AbelianStratum(3,1) 

sage: c = AbelianStratum(1,3,marked_separatrix='out') 

sage: d = AbelianStratum(3,1,marked_separatrix='out') 

sage: e = AbelianStratum(1,3,marked_separatrix='in') 

sage: f = AbelianStratum(3,1,marked_separatrix='in') 

sage: a != b # no difference for unmarked 

False 

sage: c != d # difference for out mark 

True 

sage: e != f # difference for in mark 

True 

sage: a != c # difference between no mark and out mark 

True 

sage: a != e # difference between no mark and in mark 

True 

sage: c != e # difference between out mark adn in mark 

True 

sage: a != False 

Traceback (most recent call last): 

... 

TypeError: the right member must be a stratum 

""" 

if type(self) is not type(other): 

raise TypeError("the right member must be a stratum") 

 

return (self._marked_separatrix != other._marked_separatrix or 

self._zeroes != other._zeroes) 

 

def __cmp__(self, other): 

r""" 

The order is given by the natural: 

 

self < other iff adherance(self) c adherance(other) 

 

TESTS:: 

 

sage: a3 = AbelianStratum(3,2,1) 

sage: a3_out = AbelianStratum(3,2,1,marked_separatrix='out') 

sage: a3_in = AbelianStratum(3,2,1,marked_separatrix='in') 

sage: a3 == a3_out 

False 

sage: a3 == a3_in 

False 

sage: a3_out == a3_in 

False 

""" 

if (type(self) is not type(other) or 

self._marked_separatrix != other._marked_separatrix): 

raise TypeError("the other must be a stratum with same marking") 

 

if self._zeroes < other._zeroes: 

return 1 

elif self._zeroes > other._zeroes: 

return -1 

return 0 

 

def connected_components(self): 

""" 

Lists the connected components of the Stratum. 

 

OUTPUT: 

 

list -- a list of connected components of stratum 

 

EXAMPLES: 

 

:: 

 

sage: AbelianStratum(0).connected_components() 

[H_hyp(0)] 

 

:: 

 

sage: AbelianStratum(2).connected_components() 

[H_hyp(2)] 

sage: AbelianStratum(1,1).connected_components() 

[H_hyp(1, 1)] 

 

:: 

 

sage: AbelianStratum(4).connected_components() 

[H_hyp(4), H_odd(4)] 

sage: AbelianStratum(3,1).connected_components() 

[H_c(3, 1)] 

sage: AbelianStratum(2,2).connected_components() 

[H_hyp(2, 2), H_odd(2, 2)] 

sage: AbelianStratum(2,1,1).connected_components() 

[H_c(2, 1, 1)] 

sage: AbelianStratum(1,1,1,1).connected_components() 

[H_c(1, 1, 1, 1)] 

""" 

return [x(self) for x in self._cc] 

 

def is_connected(self): 

r""" 

Tests if the strata is connected. 

 

OUTPUT: 

 

boolean -- ``True`` if it is connected else ``False`` 

 

EXAMPLES: 

 

:: 

 

sage: AbelianStratum(2).is_connected() 

True 

sage: AbelianStratum(2).connected_components() 

[H_hyp(2)] 

 

:: 

 

sage: AbelianStratum(2,2).is_connected() 

False 

sage: AbelianStratum(2,2).connected_components() 

[H_hyp(2, 2), H_odd(2, 2)] 

""" 

return len(self._cc) == 1 

 

def genus(self): 

r""" 

Returns the genus of the stratum. 

 

OUTPUT: 

 

integer -- the genus 

 

EXAMPLES: 

 

:: 

 

sage: AbelianStratum(0).genus() 

1 

sage: AbelianStratum(1,1).genus() 

2 

sage: AbelianStratum(3,2,1).genus() 

4 

""" 

return self._genus 

 

def nintervals(self): 

r""" 

Returns the number of intervals of any iet of the strata. 

 

OUTPUT: 

 

integer -- the number of intervals for any associated iet 

 

EXAMPLES: 

 

:: 

 

sage: AbelianStratum(0).nintervals() 

2 

sage: AbelianStratum(0,0).nintervals() 

3 

sage: AbelianStratum(2).nintervals() 

4 

sage: AbelianStratum(1,1).nintervals() 

5 

""" 

return 2 * self.genus() + len(self._zeroes) - 1 

 

 

class ConnectedComponentOfAbelianStratum(SageObject): 

r""" 

Connected component of Abelian stratum. 

 

.. warning:: 

 

Internal class! Do not use directly! 

 

TESTS: 

 

Tests for outgoing marked separatrices:: 

 

sage: a = AbelianStratum(4,2,0,marked_separatrix='out') 

sage: a_odd, a_even = a.connected_components() 

sage: a_odd.representative().attached_out_degree() 

4 

sage: a_even.representative().attached_out_degree() 

4 

 

:: 

 

sage: a = AbelianStratum(2,4,0,marked_separatrix='out') 

sage: a_odd, a_even = a.connected_components() 

sage: a_odd.representative().attached_out_degree() 

2 

sage: a_even.representative().attached_out_degree() 

2 

 

:: 

 

sage: a = AbelianStratum(0,4,2,marked_separatrix='out') 

sage: a_odd, a_even = a.connected_components() 

sage: a_odd.representative().attached_out_degree() 

0 

sage: a_even.representative().attached_out_degree() 

0 

 

:: 

 

sage: a = AbelianStratum(3,2,1,marked_separatrix='out') 

sage: a_c = a.connected_components()[0] 

sage: a_c.representative().attached_out_degree() 

3 

 

:: 

 

sage: a = AbelianStratum(2,3,1,marked_separatrix='out') 

sage: a_c = a.connected_components()[0] 

sage: a_c.representative().attached_out_degree() 

2 

 

:: 

 

sage: a = AbelianStratum(1,3,2,marked_separatrix='out') 

sage: a_c = a.connected_components()[0] 

sage: a_c.representative().attached_out_degree() 

1 

 

Tests for incoming separatrices:: 

 

sage: a = AbelianStratum(4,2,0,marked_separatrix='in') 

sage: a_odd, a_even = a.connected_components() 

sage: a_odd.representative().attached_in_degree() 

4 

sage: a_even.representative().attached_in_degree() 

4 

 

:: 

 

sage: a = AbelianStratum(2,4,0,marked_separatrix='in') 

sage: a_odd, a_even = a.connected_components() 

sage: a_odd.representative().attached_in_degree() 

2 

sage: a_even.representative().attached_in_degree() 

2 

 

:: 

 

sage: a = AbelianStratum(0,4,2,marked_separatrix='in') 

sage: a_odd, a_even = a.connected_components() 

sage: a_odd.representative().attached_in_degree() 

0 

sage: a_even.representative().attached_in_degree() 

0 

 

:: 

 

sage: a = AbelianStratum(3,2,1,marked_separatrix='in') 

sage: a_c = a.connected_components()[0] 

sage: a_c.representative().attached_in_degree() 

3 

 

:: 

 

sage: a = AbelianStratum(2,3,1,marked_separatrix='in') 

sage: a_c = a.connected_components()[0] 

sage: a_c.representative().attached_in_degree() 

2 

 

:: 

 

sage: a = AbelianStratum(1,3,2,marked_separatrix='in') 

sage: a_c = a.connected_components()[0] 

sage: a_c.representative().attached_in_degree() 

1 

""" 

_name = 'c' 

 

def __init__(self, parent): 

r""" 

TESTS:: 

 

sage: a = AbelianStratum([1]*10).connected_components()[0] 

sage: a == loads(dumps(a)) 

True 

""" 

self._parent = parent 

 

def _repr_(self): 

r""" 

TESTS:: 

 

sage: a = AbelianStratum([1]*8).connected_components()[0] 

sage: repr(a) #indirect doctest 

'H_c(1, 1, 1, 1, 1, 1, 1, 1)' 

""" 

if self._parent._marked_separatrix == 'no': 

return ("H" + 

"_" + self._name + 

"(" + str(self._parent._zeroes)[1:-1] + ")") 

 

else: 

return ("H" + 

"_" + self._name + 

"^" + self._parent._marked_separatrix + 

"(" + str(self._parent._zeroes)[1:-1] + ")") 

 

def __str__(self): 

r""" 

TESTS:: 

 

sage: str(AbelianStratum([1]*8)) 

'H(1, 1, 1, 1, 1, 1, 1, 1)' 

""" 

if self._parent._marked_separatrix == 'no': 

return ("H" + 

"_" + self._name + 

"(" + str(self._parent._zeroes)[1:-1] + ")") 

 

else: 

return ("H" + 

"_" + self._name + 

"^" + self._parent._marked_separatrix + 

"(" + str(self._parent._zeroes)[1:-1] + ")") 

 

def parent(self): 

r""" 

The stratum of this component 

 

OUTPUT: 

 

stratum - the stratum where this component leaves 

 

EXAMPLES:: 

 

sage: p = iet.Permutation('a b','b a') 

doctest:warning 

... 

DeprecationWarning: Permutation is deprecated and will be removed from Sage. 

You are advised to install the surface_dynamics package via: 

sage -pip install surface_dynamics 

If you do not have write access to the Sage installation you can 

alternatively do 

sage -pip install surface_dynamics --user 

The package surface_dynamics subsumes all flat surface related 

computation that are currently available in Sage. See more 

information at 

http://www.labri.fr/perso/vdelecro/surface-dynamics/latest/ 

See http://trac.sagemath.org/20695 for details. 

sage: c = p.connected_component() 

sage: c.parent() 

H(0) 

""" 

return self._parent 

 

def representative(self, reduced=True, alphabet=None): 

r""" 

Returns the Zorich representative of this connected component. 

 

Zorich constructs explicitely interval exchange 

transformations for each stratum in [Zor2008]_. 

 

INPUT: 

 

- ``reduced`` - boolean (default: ``True``): whether you 

obtain a reduced or labelled permutation 

 

- ``alphabet`` - an alphabet or ``None``: whether you want to 

specify an alphabet for your permutation 

 

OUTPUT: 

 

permutation -- a permutation which lives in this component 

 

EXAMPLES: 

 

:: 

 

sage: c = AbelianStratum(1,1,1,1).connected_components()[0] 

sage: c 

H_c(1, 1, 1, 1) 

sage: p = c.representative(alphabet=range(9)) 

sage: p 

0 1 2 3 4 5 6 7 8 

4 3 2 5 8 7 6 1 0 

sage: p.connected_component() 

H_c(1, 1, 1, 1) 

""" 

g = self._parent._genus 

zeroes = [x for x in self._parent._zeroes if x > 0] 

n = self._parent._zeroes.count(0) 

 

l0 = list(range(4 * g - 3)) 

l1 = [4, 3, 2] 

for k in range(5, 4*g-6, 4): 

l1 += [k, k+3, k+2, k+1] 

l1 += [1, 0] 

k = 3 

for d in zeroes: 

for i in range(d-1): 

del l0[l0.index(k)] 

del l1[l1.index(k)] 

k += 2 

k += 2 

 

if n != 0: 

interval = list(range(4 * g - 3, 4 * g - 3 + n)) 

 

if self._parent._zeroes[0] == 0: 

k = l0.index(4) 

l0[k:k] = interval 

l1[-1:-1] = interval 

else: 

l0[1:1] = interval 

l1.extend(interval) 

 

if self._parent._marked_separatrix == 'in': 

l0.reverse() 

l1.reverse() 

 

if reduced: 

from sage.dynamics.interval_exchanges.reduced import ReducedPermutationIET 

return ReducedPermutationIET([l0, l1], alphabet=alphabet) 

 

else: 

from sage.dynamics.interval_exchanges.labelled import LabelledPermutationIET 

return LabelledPermutationIET([l0, l1], alphabet=alphabet) 

 

 

def genus(self): 

r""" 

Returns the genus of the surfaces in this connected component. 

 

OUTPUT: 

 

integer -- the genus of the surface 

 

EXAMPLES: 

 

:: 

 

sage: a = AbelianStratum(6,4,2,0,0) 

sage: c_odd, c_even = a.connected_components() 

sage: c_odd.genus() 

7 

sage: c_even.genus() 

7 

 

:: 

 

sage: a = AbelianStratum([1]*8) 

sage: c = a.connected_components()[0] 

sage: c.genus() 

5 

""" 

return self._parent.genus() 

 

def nintervals(self): 

r""" 

Returns the number of intervals of the representative. 

 

OUTPUT: 

 

integer -- the number of intervals in any representative 

 

EXAMPLES: 

 

:: 

 

sage: a = AbelianStratum(6,4,2,0,0) 

sage: c_odd, c_even = a.connected_components() 

sage: c_odd.nintervals() 

18 

sage: c_even.nintervals() 

18 

 

:: 

 

sage: a = AbelianStratum([1]*8) 

sage: c = a.connected_components()[0] 

sage: c.nintervals() 

17 

""" 

return self.parent().nintervals() 

 

def rauzy_diagram(self, reduced=True): 

r""" 

Returns the Rauzy diagram associated to this connected component. 

 

OUTPUT: 

 

rauzy diagram -- the Rauzy diagram associated to this stratum 

 

EXAMPLES: 

 

:: 

 

sage: c = AbelianStratum(0).connected_components()[0] 

sage: r = c.rauzy_diagram() 

""" 

return self.representative(reduced=reduced).rauzy_diagram() 

 

def __cmp__(self, other): 

r""" 

TESTS:: 

 

sage: a1 = AbelianStratum(1,1,1,1) 

sage: c1 = a1.connected_components()[0] 

sage: a2 = AbelianStratum(3,1) 

sage: c2 = a2.connected_components()[0] 

sage: c1 == c1 

True 

sage: c1 == c2 

False 

sage: a1 = AbelianStratum(1,1,1,1) 

sage: c1 = a1.connected_components()[0] 

sage: a2 = AbelianStratum(2, 2) 

sage: c2_hyp, c2_odd = a2.connected_components() 

sage: c1 != c1 

False 

sage: c1 != c2_hyp 

True 

sage: c2_hyp != c2_odd 

True 

sage: c1 == True 

False 

""" 

if not isinstance(other, CCA) or type(self) != type(other): 

return NotImplemented 

 

if self._parent._zeroes < other._parent._zeroes: 

return 1 

elif self._parent._zeroes > other._parent._zeroes: 

return -1 

return 0 

 

 

CCA = ConnectedComponentOfAbelianStratum 

 

 

class HypConnectedComponentOfAbelianStratum(CCA): 

""" 

Hyperelliptic component of Abelian stratum. 

 

.. warning:: 

 

Internal class! Do not use directly! 

""" 

_name = 'hyp' 

 

def representative(self, reduced=True, alphabet=None): 

r""" 

Returns the Zorich representative of this connected component. 

 

Zorich constructs explicitely interval exchange 

transformations for each stratum in [Zor2008]_. 

 

INPUT: 

 

- ``reduced`` - boolean (default: ``True``): whether you obtain 

a reduced or labelled permutation 

 

- ``alphabet`` - alphabet or ``None`` (default: ``None``): 

whether you want to specify an alphabet for your 

representative 

 

EXAMPLES: 

 

:: 

 

sage: c = AbelianStratum(0).connected_components()[0] 

sage: c 

H_hyp(0) 

sage: p = c.representative(alphabet="01") 

sage: p 

0 1 

1 0 

sage: p.connected_component() 

H_hyp(0) 

 

:: 

 

sage: c = AbelianStratum(0,0).connected_components()[0] 

sage: c 

H_hyp(0, 0) 

sage: p = c.representative(alphabet="abc") 

sage: p 

a b c 

c b a 

sage: p.connected_component() 

H_hyp(0, 0) 

 

:: 

 

sage: c = AbelianStratum(2).connected_components()[0] 

sage: c 

H_hyp(2) 

sage: p = c.representative(alphabet="ABCD") 

sage: p 

A B C D 

D C B A 

sage: p.connected_component() 

H_hyp(2) 

 

:: 

 

sage: c = AbelianStratum(1,1).connected_components()[0] 

sage: c 

H_hyp(1, 1) 

sage: p = c.representative(alphabet="01234") 

sage: p 

0 1 2 3 4 

4 3 2 1 0 

sage: p.connected_component() 

H_hyp(1, 1) 

""" 

g = self._parent._genus 

n = self._parent._zeroes.count(0) 

m = len(self._parent._zeroes) - n 

 

if m == 0: # on the torus 

if n == 1: 

l0 = [0, 1] 

l1 = [1, 0] 

elif n == 2: 

l0 = [0, 1, 2] 

l1 = [2, 1, 0] 

else: 

l0 = list(range(1, n + 2)) 

l1 = [n + 1] + list(range(1, n + 1)) 

 

elif m == 1: # H(2g-2,0^n) or H(0,2g-2,0^(n-1)) 

l0 = list(range(1, 2*g+1)) 

l1 = list(range(2*g, 0, -1)) 

interval = list(range(2*g+1, 2*g+n+1)) 

 

if self._parent._zeroes[0] == 0: 

l0[-1:-1] = interval 

l1[-1:-1] = interval 

else: 

l0[1:1] = interval 

l1[1:1] = interval 

 

else: # H(g-1,g-1,0^n) or H(0,g-1,g-1,0^(n-1)) 

l0 = list(range(1, 2*g+2)) 

l1 = list(range(2*g+1, 0, -1)) 

interval = list(range(2*g+2, 2*g+n+2)) 

 

if self._parent._zeroes[0] == 0: 

l0[-1:-1] = interval 

l1[-1:-1] = interval 

else: 

l0[1:1] = interval 

l1[1:1] = interval 

 

if self._parent._marked_separatrix == 'in': 

l0.reverse() 

l1.reverse() 

 

if reduced: 

from sage.dynamics.interval_exchanges.reduced import ReducedPermutationIET 

return ReducedPermutationIET([l0, l1], alphabet=alphabet) 

 

else: 

from sage.dynamics.interval_exchanges.labelled import LabelledPermutationIET 

return LabelledPermutationIET([l0, l1], alphabet=alphabet) 

 

HypCCA = HypConnectedComponentOfAbelianStratum 

 

 

class NonHypConnectedComponentOfAbelianStratum(CCA): 

""" 

Non hyperelliptic component of Abelian stratum. 

 

.. warning:: 

 

Internal class! Do not use directly! 

""" 

_name = 'nonhyp' 

 

NonHypCCA = NonHypConnectedComponentOfAbelianStratum 

 

 

class EvenConnectedComponentOfAbelianStratum(CCA): 

""" 

Connected component of Abelian stratum with even spin structure. 

 

.. warning:: 

 

Internal class! Do not use directly! 

""" 

_name = 'even' 

 

def representative(self, reduced=True, alphabet=None): 

r""" 

Returns the Zorich representative of this connected component. 

 

Zorich constructs explicitely interval exchange 

transformations for each stratum in [Zor2008]_. 

 

EXAMPLES: 

 

:: 

 

sage: c = AbelianStratum(6).connected_components()[2] 

sage: c 

H_even(6) 

sage: p = c.representative(alphabet=range(8)) 

sage: p 

0 1 2 3 4 5 6 7 

5 4 3 2 7 6 1 0 

sage: p.connected_component() 

H_even(6) 

 

:: 

 

sage: c = AbelianStratum(4,4).connected_components()[2] 

sage: c 

H_even(4, 4) 

sage: p = c.representative(alphabet=range(11)) 

sage: p 

0 1 2 3 4 5 6 7 8 9 10 

5 4 3 2 6 8 7 10 9 1 0 

sage: p.connected_component() 

H_even(4, 4) 

""" 

zeroes = [x for x in self._parent._zeroes if x > 0] 

n = self._parent._zeroes.count(0) 

g = self._parent._genus 

 

l0 = list(range(3*g-2)) 

l1 = [6, 5, 4, 3, 2, 7, 9, 8] 

for k in range(10, 3*g-4, 3): 

l1 += [k, k+2, k+1] 

l1 += [1, 0] 

 

k = 4 

for d in zeroes: 

for i in range(d/2-1): 

del l0[l0.index(k)] 

del l1[l1.index(k)] 

k += 3 

k += 3 

 

# if there are marked points we transform 0 in [3g-2, 3g-3, ...] 

if n != 0: 

interval = list(range(3*g-2, 3*g - 2 + n)) 

 

if self._parent._zeroes[0] == 0: 

k = l0.index(6) 

l0[k:k] = interval 

l1[-1:-1] = interval 

else: 

l0[1:1] = interval 

l1.extend(interval) 

 

if self._parent._marked_separatrix == 'in': 

l0.reverse() 

l1.reverse() 

 

if reduced: 

from sage.dynamics.interval_exchanges.reduced import ReducedPermutationIET 

return ReducedPermutationIET([l0, l1], alphabet=alphabet) 

 

else: 

from sage.dynamics.interval_exchanges.labelled import LabelledPermutationIET 

return LabelledPermutationIET([l0, l1], alphabet=alphabet) 

 

EvenCCA = EvenConnectedComponentOfAbelianStratum 

 

 

class OddConnectedComponentOfAbelianStratum(CCA): 

r""" 

Connected component of an Abelian stratum with odd spin parity. 

 

.. warning:: 

 

Internal class! Do not use directly! 

""" 

_name = 'odd' 

 

def representative(self, reduced=True, alphabet=None): 

""" 

Returns the Zorich representative of this connected component. 

 

Zorich constructs explicitely interval exchange 

transformations for each stratum in [Zor2008]_. 

 

EXAMPLES: 

 

:: 

 

sage: a = AbelianStratum(6).connected_components()[1] 

sage: a.representative(alphabet=range(8)) 

0 1 2 3 4 5 6 7 

3 2 5 4 7 6 1 0 

 

:: 

 

sage: a = AbelianStratum(4,4).connected_components()[1] 

sage: a.representative(alphabet=range(11)) 

0 1 2 3 4 5 6 7 8 9 10 

3 2 5 4 6 8 7 10 9 1 0 

""" 

zeroes = [x//2 for x in self._parent._zeroes if x > 0] 

 

n = self._parent._zeroes.count(0) 

g = self._parent._genus 

 

l0 = list(range(3*g-2)) 

l1 = [3, 2] 

for k in range(4, 3*g-4, 3): 

l1 += [k, k+2, k+1] 

l1 += [1, 0] 

 

k = 4 

for d in zeroes: 

for i in range(d-1): 

del l0[l0.index(k)] 

del l1[l1.index(k)] 

k += 3 

k += 3 

 

# marked points 

if n != 0: 

interval = list(range(3*g-2, 3*g-2+n)) 

 

if self._parent._zeroes[0] == 0: 

k = l0.index(3) 

l0[k:k] = interval 

l1[-1:-1] = interval 

else: 

l0[1:1] = interval 

l1.extend(interval) 

 

if self._parent._marked_separatrix == 'in': 

l0.reverse() 

l1.reverse() 

 

if reduced: 

from sage.dynamics.interval_exchanges.reduced import ReducedPermutationIET 

return ReducedPermutationIET([l0, l1], alphabet=alphabet) 

 

else: 

from sage.dynamics.interval_exchanges.labelled import LabelledPermutationIET 

return LabelledPermutationIET([l0, l1], alphabet=alphabet) 

 

OddCCA = OddConnectedComponentOfAbelianStratum