%%  Heterotic Line Bundle Compactification - N5 as a parameter - Vietoris-Rips complex
%% Section 5 of the paper TDAvacua
%% uses javaplex

clc; 
clear; 
%close all;
%% Heterotic Line List - N5 as a parameter - Vietoris-Rips complex 

%% set the parameters

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

% create the set of points (pick n5=1 or n5=3)
%load ('1Higgs1Num5.mat')
%point_cloud = OneNum5;
%size(point_cloud)

load ('1Higgs3Num5.mat')
point_cloud = ThreeNum5;
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 = '1Higgs1Num5';
options.filename = '1Higgs3Num5';
options.max_filtration_value = max_filtration_value;
options.max_dimension = max_dimension - 1;
options.side_by_side = true;
options.caption='Het N5=3';
plot_barcodes(intervals, options);

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

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