%% Heterotic with Line Bundles compactification- general list -  vietoris-rips complex
%% Section  5 of the paper TDAvacua
%% uses javaplex

clc; 
clear; 
%close all;
%% Heterotic Line Bundles List - Vietoris-Rips complex 

%% set the parameters

max_dimension=4
max_filtration_value=15
num_divisions=120
over_integers=2

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

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

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