/*    This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
 *    See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
 *    Author(s):       Hannah Schreiber
 *
 *    Copyright (C) 2024 Inria
 *
 *    Modification(s):
 *      - 2025/08 Jānis Lazovskis: BIRS workshop presentation
 */

#include <iostream>

#include <gudhi/Matrix.h>
#include <gudhi/persistence_matrix_options.h>

using Gudhi::persistence_matrix::Default_options;
using Gudhi::persistence_matrix::Column_types;

struct RU_rep_cycles_options : Default_options<Column_types::INTRUSIVE_LIST, true> 
{ static const bool can_retrieve_representative_cycles = true; };

struct Chain_rep_cycles_options : Default_options<Column_types::INTRUSIVE_LIST, true> 
{ static const bool can_retrieve_representative_cycles = true;
  static const bool is_of_boundary_type = false; };

using RU_matrix = Gudhi::persistence_matrix::Matrix<RU_rep_cycles_options>;
using Chain_matrix = Gudhi::persistence_matrix::Matrix<Chain_rep_cycles_options>;

template <class Matrix>
void print_representative_cycles_example()
{
  Matrix mp({ { },
              { },
              { },
              { 0, 1 },
              { 1, 2 },
              { 0, 2 },
              { 0, 1, 2 }
            });

  auto bc = mp.get_current_barcode();
  for (auto bar : bc) {
    std::cout << bar.dim << "-bar: (" << bar.birth << "," << bar.death << ")" << std::endl;
  }

  auto rc = mp.get_representative_cycles();
  for (auto cycle : rc) {
    std::cout << mp.get_column_dimension(cycle[0]);
    std::cout << "-cycle: ";
    for (auto index : cycle) {
      std::cout << index << ", ";
    }
    std::cout << "\n";
  }
}

int main() {
  std::cout << "RU_matrix:\n";
  print_representative_cycles_example<RU_matrix>();
}
