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
//! Simplicial complex represented by the set of all its simplices
//!
//! This module contains a function that accepts the sequence of all simplices as input, and returns an integer-indexed matrix, as output.
use Itertools;
use crateRingOperations;
use crate;
use Debug;
use Hash;
// ---------------------------------------------------------------------------
// SIMPLEX BIMAP TO BOUNDARY - SIMPLICES AS VECTORS
// ---------------------------------------------------------------------------
/// Returns a (integer indexed) boundary matrix of a simplicial complex, given (i) a bijection between the set of simplices `K` and the set of integers `{0, .., K-1}`, and (ii) a ring operator.
///
/// The `k`th row and column of the matrix correspond to the `k`th simplex, as enumerated by the bimap.
///
/// The constructed matrix has rows and columns indexed by `usize`, and coefficients of type `RingElt`.
// ---------------------------------------------------------------------------
// SIMPLEX BIMAP TO BOUNDARY - SIMPLICES AS SIMPLEX STRUCTS
// ---------------------------------------------------------------------------
// /// Similar to [boundary_matrix_from_simplex_bimap], but simplices are represented by objects of type `Simplex`, not `Vec`.
// pub fn boundary_matrix_from_complex_facets_simplexform< Vertex, RingOperator, RingElt >(
// simplex_bimap: BijectiveSequence< Simplex< Vertex > >,
// ring_operator: RingOperator
// )
// ->
// Vec< Vec < (usize, RingElt) >>
// where Vertex: Ord + Hash + Clone + Debug,
// RingOperator: Semiring< RingElt > + Ring< RingElt >,
// {
// if simplex_bimap.is_empty() { return vec![] }
// let mut boundary = Vec::with_capacity( simplex_bimap.len() );
// let mut state_iter = FacetIteratorNoReturnAscendingLex{
// simplex: Simplex{ vertices: SortedVec::new(vec![]) },
// facet: vec![],
// deleted_vertex_index: None
// };
// let mut global_int_index;
// let mut simplex_dim;
// let mut simplex_num_verts;
// for simplex in simplex_bimap.vec_elements_in_order().iter().cloned() {
// simplex_dim = simplex.dimension();
// simplex_num_verts = simplex.number_of_vertices();
// state_iter.reinitialize_with_simplex( simplex );
// let mut vec = Vec::with_capacity( simplex_num_verts ); // num_vertices = NUMBER OF FACETS
// for i in 0 .. simplex_num_verts {
// state_iter.next();
// println!("{:?}", &state_iter);
// println!("{:?}", &simplex_bimap);
// global_int_index = simplex_bimap.ordinal_for_element( & Simplex::from_vec( state_iter.facet.clone() ) ).unwrap();
// vec.push(
// (
// global_int_index.clone(),
// ring_operator.minus_one_to_power( simplex_dim - i )
// )
// )
// }
// boundary.push( vec );
// }
// boundary
// }
// ===========================================================================
// ===========================================================================
// TESTS
// ===========================================================================
// ===========================================================================