%% BPS quintic - rips
%% Section      of the paper

clc; 
clear; 
%close all;
%% BPS quintic - RIPS SEEMS ENOUGH?

%% set the parameters

max_dimension=2
max_filtration_value=7
num_divisions=100
over_integers=2

% create the set of points
load ('DTQuinticLog.mat')
point_cloud = DTQuinticLog;
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
options.filename = 'QuinticRipsBarcodes';
options.max_filtration_value = max_filtration_value;
options.max_dimension = max_dimension - 1;
options.side_by_side = true;
options.caption='quintic';
plot_barcodes(intervals, options);

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

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