%% Mathieu Moonshine - Vietoris-Rips complex
%% Section 9 of the paper barcodes&walls

clc; 
clear; 
%close all;
%% Mathieu Moonshine - TEMPLATE FOR ALL CONJUGACY CLASSES

%% set the parameters

max_dimension=2
max_filtration_value=6
num_divisions=100
over_integers=2

% create the set of points
% insert filename MoonshineZgLog.mat
load ('MoonshineZ23ABLog.mat')
point_cloud = MoonshineZ23ABLog;
size(point_cloud)

% create a Vietoris-Rips stream
stream=api.Plex4.createVietorisRipsStream(point_cloud,max_dimension,max_filtration_value,num_divisions);
num_simplices = stream.getSize()

% get persistence algorithm over Z/2Z
persistence = api.Plex4.getModularSimplicialAlgorithm(max_dimension, over_integers);

% compute the intervals
intervals= persistence.computeIntervals(stream);

% create the barcode plots
% use filename MoonshineZgLog
options.filename = 'MoonshineZ23ABLog';
options.max_filtration_value = max_filtration_value;
options.max_dimension = max_dimension - 1;
options.side_by_side = true;
% put in the caption the conjugacy class g
options.caption='23AB';
plot_barcodes(intervals, options);

% get the infinite barcodes
infinite_barcodes = intervals.getInfiniteIntervals();

% print out betti numbers array
betti_numbers_array = infinite_barcodes.getBettiSequence()