musical
edge_nsimplex_couples(complex)
Couples together edge ids with their highest-dimensional cofaces ids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
complex
|
SimplicialComplex
|
The SimplicialComplex to work on. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A Nc * 2 arrays each row corresponds to a couple (eid, nsid). |
Note
Each edge id (eid) can appear multiple times, depending on its n-valence (i.e. number of n-cofaces). The number of row corresponds to the sum of the edge n-valences for all edges.
Source code in src/dxtr/operators/musical.py
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 | |
edge_nsimplex_weight(on, for_operator='dual_to_primal_flat')
Computes the edge_nsimplex_weight for each edge-n-Simplex couple.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on
|
SimplicialManifold
|
The simplicial manifold we work on. |
required |
for_operator
|
str
|
A flag to change the normalization factor depending on the use case. Should either be 'dual_to_primal_flat', '_dual_to_dual_flat', 'sharp' or 'div'. Default is 'dual_to_primal_flat'. |
'dual_to_primal_flat'
|
Returns:
| Type | Description |
|---|---|
csr_matrix
|
A (N1 x Nn)-sparse matrix that contains the sought edge_nsimplex_weight. |
Notes
All edges (i.e. shared by multiple n-cofaces) have one weight for each of their n-cofaces. * The values of these weights depends on the operator to compute, c.f. See also section for more details. * In the sharp and flat cases: For each edge, the sum of its edge_nsimplex_weight must egals one. * This condition seems validated only if the n-simplices are well-centered. * With this definition, the divergence theorem for vector fields defined as vector-values dual 0-forms is verified.
See also
Hirani's PhD Thesis for more details: * For the sharp weight formula: Proposition 5.5.1, p.51. * For the flat weight formula: Definition 5.8.1, p.58. * For the div weight formula: Lemma 6.1.2 p.60.
Source code in src/dxtr/operators/musical.py
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 | |
flat(vector_field, manifold=None, dual=False, name='1-cochain, flat from vector field')
Transforms a vector field into a 1-Cochain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_field
|
ndarray or Cochain
|
The vector field to convert. |
required |
manifold
|
SimplicialManifold
|
The Simplicial Manifold where the vector field is defined. If the
provided vector field is a vector-valued |
None
|
dual
|
bool
|
If True, a dual 1- |
False
|
name
|
str
|
The name to give to the flattened cochain. Default is '1-cochain, flat from vector field'. |
'1-cochain, flat from vector field'
|
Returns:
| Type | Description |
|---|---|
Cochain or None
|
The resulting 1-cochain defined on the prescribed manifold. |
Notes
The input vector field must be defined on the circumcenters of the
top simplices of the considered SimplicialManifold.
This implementation of the discrete flat operator is derived from the definitions provided by Anil Hirani in his PhD manuscript.
We chose to implement two types of discrete flat: one returns a primal
1-cochain, the other a dual 1-cochain. The dual argument enables the
selection of the desired one.
TODO: Add the ability to flatten a vector field defined on the 0-simplices.
See Also
dual_to_primal_flat : Transforms a vector field into a primal 1-cochain. dual_to_dual_flat : Transforms a vector field into a dual 1-cochain.
Source code in src/dxtr/operators/musical.py
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 | |
interpolate_cochain_on_nsimplices(cochain)
Interpolates a k-cochain on the circumcenters of the top-simplices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cochain
|
Cochain
|
The cochain to interpolate. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
(Nn, Nk, D)-array containing the corresponding k-vector field. Nn: number of n-simplices, Nk: number of k-simplices, D: embedding dimension. |
Notes
In the computation we added a factor 2 in order to get the proper results, but we don't know how or why it should be here. We just noticed that without it the sharp(flat(vector_field)) ended up being scaled by a factor 2 for regular complexes.
TODO: understand where this factor 2 comes from, maybe: look into the divergence theorem, see chapter 6 of Hirani's thesis.
Source code in src/dxtr/operators/musical.py
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 | |
project(vector_field, on, of)
Projects a vector field onto the edges of a simplicial/cellular complex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_field
|
ndarray
|
The vector field to project. |
required |
on
|
str
|
Should either be 'primal' or 'dual'. Specifies on which complex the vector field should be projected: Either on the edges formed by the 1-simplices or the edges formed by the dual cells of the (n-1)-simplices. |
required |
of
|
SimplicialManifold
|
The simplicial manifold where to project the vector field. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
An array of shape (Nk,); Nk = manifold[n-1].size containing the projected values. |
Notes
The provided vector field must be defined as a vector-valued dual
0-cochain. Meaning that it must contain 1 vector per top-simplex of
the considered SimplicialManifold.
Source code in src/dxtr/operators/musical.py
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 | |
sharp(cochain, name='Discrete vector field')
Transforms a primal 1-Cochain into a discrete vector field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cochain
|
Cochain
|
The primal 1- |
required |
name
|
str
|
The name to give to the output |
'Discrete vector field'
|
Returns:
| Type | Description |
|---|---|
Cochain or None
|
A dual vector-valued 0- |
Notes
In the present version, we can only transform a primal 1-Cochain
into a dual vector-valued 0-Cochain.
Source code in src/dxtr/operators/musical.py
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 | |