-
Notifications
You must be signed in to change notification settings - Fork 0
Class Hierarchy Plan
Mikael Vejdemo-Johansson edited this page Feb 25, 2024
·
5 revisions
Here, we will plan out the class hierarchy intended for porting JavaPlex to TDA4j.
We will consistently use the following choices of type parameters:
-
VertexT
is the type of the vertices of a simplex. TypicallyInt
, but does not need to be. Should be totally ordered. -
FiltrationT
is the type of the filtration value of a filtered simplex. TypicallyDouble
orReal
, but does not need to be. Should be totally ordered. -
CoefficientT
is the type of the field coefficients of the chain modules. Typically some sort of finite field, or maybeDouble
. We may need to fiddle around with good (fast) implementations of finite field arithmetic here.
classDiagram
%% AbstractSimplex and Simplex implement (and type alias) a basic Simplex type
Simplex --|> AbstractSimplex~VertexT~ : VertexT=Int
AbstractSimplex~VertexT~ ..|> Cell~VertexT~
AbstractSimplex~VertexT~ ..|> SortedSet~VertexT~
Cell : +Chain~VertexT,FieldT~ boundary()
%% FilteredSimplex adds support for a filtration value and an ordering based on it
FilteredSimplex~VertexT,FiltrationT~ --|> AbstractSimplex~VertexT~
FilteredSimplex : +FiltrationT filterValue F
VietorisRips~VertexT,FiltrationT~ ..|> Stream~FilteredSimplex[VertexT,FiltrationT]~
AlphaComplex~VertexT,FiltrationT~ ..|> Stream~FilteredSimplex[VertexT,FiltrationT]~
%% Chain represents a linear combination of cells of some kind
%% QUESTION: Do we want a Cell interface that AbstractSimplex implements?
Chain~Cell[VertexT],FieldT <: Rational~ ..|> Map~Cell[VertexT],FieldT~
Chain~Cell[VertexT],FieldT <: Rational~ ..|> Integral
FieldT ..|> Rational
Some Scala-notes on the class hierarchy that are difficult to represent in the Mermaid diagram DSL:
-
VertexT : Ordering
-VertexT
needs to have an associated (implicit)Ordering[V]
. -
FieldT <: Field
-FieldT
takes things that look like a field (as defined by theField
trait) -
ExplicitStream
in JavaPlex can probably be dropped, with instructions for a user to simply write their own instance ofStream[FilteredSimplex[VertexT,FiltrationT]]
to take its place.
Recall that:
- A ring is an algebraic structure that admits
+
,-
,*
(and has a0
and a1
) - A field is a ring that also admits
/
(except for the operationx/0
which is still forbidden) - A module is an abelian group (ie admits
+
and-
and has a0
) that also has a scalar multiplication wrt some specific ring. - A vector space is a module where the scalars form a field.
We expect our coefficients FieldT
to come from a field (ring is not enough), and we will produce a module as our persistence space (strictly speaking over the polynomial ring K[t]
, or one of several almost equivalent formalisms in common use).
classDiagram
%% Persistence holds methods for running the computation
class Persistence~VertexT,FiltrationT,FieldT~
<<Interface>> Persistence
Persistence : +Barcode[FiltrationT] computeBarcode(Stream[FilteredSimplex[VertexT,FiltrationT]])
Persistence : +RepresentativeBarcode[VertexT,FiltrationT,FieldT] computeRepresentativeBarcode(Stream[FilteredSimplex[VertexT,FiltrationT]])
class AbsolutePersistence~VertexT,FiltrationT,FieldT~
class RelativePersistence~VertexT,FiltrationT,FieldT~
AbsolutePersistence ..|> Persistence
RelativePersistence ..|> Persistence
classDiagram
class API
API : +Stream[FilteredSimplex[Int,Double]] VietorisRips(double[][] pointcloud)
API : +Stream[FilteredSimplex[Int,Double]] AlphaComplex(double[][] pointcloud)
API : +Stream[FilteredSimplex[Int,Double]] createEmptyStream()
API : +Stream[FilteredSimplex[Int,Double]] addSimplexToStream(stream, int[] vertices, double filtrationValue)
API : +AbsolutePersistence[Int,Double,Field2] AbsoluteBooleanPersistence
API : +RelativePersistence[Int,Double,Field2] RelativeBooleanPersistence
API : +AbsolutePersistence[Int,Double,Fieldp] AbsoluteModularPersistence(Int prime)
API : +RelativePersistence[Int,Double,Fieldp] RelativeModularPersistence(Int prime)