<commit_before>#include "../sdp_solve.hxx"

void compute_dx_dy(const Block_Info &block_info, const El::Grid &grid,
                   const SDP &sdp, const SDP &d_sdp, const Block_Vector &x,
                   const Block_Vector &y, const Block_Diagonal_Matrix &X,
                   const Block_Diagonal_Matrix &Y,
                   Block_Vector &dx, Block_Vector &dy);

El::BigFloat
compute_approximate_objective(const Block_Info &block_info, const El::Grid &grid,
                              const SDP &sdp, const SDP &d_sdp,
                              const Block_Vector &x, const Block_Vector &y,
                              const Block_Diagonal_Matrix &X,
                              const Block_Diagonal_Matrix &Y)
{
  Block_Vector dx(x), dy(y);
  compute_dx_dy(block_info, grid, sdp, d_sdp, x, y, X, Y, dx, dy);
  
  // b.y
  El::BigFloat objective(El::Dot(sdp.dual_objective_b, y.blocks.at(0))
                         + El::Dot(d_sdp.dual_objective_b, y.blocks.at(0)));

  std::cout << "objective: "
            << El::Dot(sdp.dual_objective_b, y.blocks.at(0)) << "\n "
            << El::Dot(d_sdp.dual_objective_b, y.blocks.at(0));

  // ydy = y + dy/2
  El::DistMatrix<El::BigFloat> ydy(y.blocks.at(0));
  El::Axpy(El::BigFloat(0.5), dy.blocks.at(0), ydy);

  // db.(y + dy/2)
  objective+=El::Dot(d_sdp.dual_objective_b, ydy);
  
        <commit_msg>Fix a term that was added twice<commit_after>#include "../sdp_solve.hxx"

void compute_dx_dy(const Block_Info &block_info, const El::Grid &grid,
                   const SDP &sdp, const SDP &d_sdp, const Block_Vector &x,
                   const Block_Vector &y, const Block_Diagonal_Matrix &X,
                   const Block_Diagonal_Matrix &Y,
                   Block_Vector &dx, Block_Vector &dy);

El::BigFloat
compute_approximate_objective(const Block_Info &block_info, const El::Grid &grid,
                              const SDP &sdp, const SDP &d_sdp,
                              const Block_Vector &x, const Block_Vector &y,
                              const Block_Diagonal_Matrix &X,
                              const Block_Diagonal_Matrix &Y)
{
  Block_Vector dx(x), dy(y);
  compute_dx_dy(block_info, grid, sdp, d_sdp, x, y, X, Y, dx, dy);
  
  // b.y
  El::BigFloat objective(El::Dot(sdp.dual_objective_b, y.blocks.at(0)));

  std::cout << "objective: "
            << El::Dot(sdp.dual_objective_b, y.blocks.at(0)) << "\n "
            << El::Dot(d_sdp.dual_objective_b, y.blocks.at(0));

  // ydy = y + dy/2
  El::DistMatrix<El::BigFloat> ydy(y.blocks.at(0));
  El::Axpy(El::BigFloat(0.5), dy.blocks.at(0), ydy);

  // db.(y + dy/2)
  objective+=El::Dot(d_sdp.dual_objective_b, ydy);
        
{'fraction_non_alphanumeric': 0.13727678571428573, 'fraction_numerical': 0.007068452380952381, 'mean_word_length': 2.267314702308627, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7054444', 'n_tokens_mistral': 980, 'n_tokens_neox': 955, 'n_words': 192}