<commit_before>#include "../../../../Block_Diagonal_Matrix.hxx"
#include "../../../../../Block_Info.hxx"
#include "../../../../../../Timers.hxx"

// Compute the SchurComplement matrix using BilinearPairingsXInv and
// BilinearPairingsY and the formula
//
//   S_{(j,r1,s1,k1), (j,r2,s2,k2)} = \sum_{b \in blocks[j]}
//          (1/4) (BilinearPairingsXInv_{ej s1 + k1, ej r2 + k2}*
//                 BilinearPairingsY_{ej s2 + k2, ej r1 + k1} +
//                 swaps (r1 <-> s1) and (r2 <-> s2))
//
// where ej = d_j + 1.

namespace
{
  // Elementwise multiplication of two submatrices.
  //
  // result(i,j)=bilinear_X_inv(column_offset_X+i,row_offset_X+j)
  //             + bilinear_Y_inv(column_offset_Y+i,row_offset_Y+j)

  void
  multiply_submatrices(const El::DistMatrix<El::BigFloat> &bilinear_X_inv,
                       const El::DistMatrix<El::BigFloat> &bilinear_Y,
                       const size_t &block_size, const size_t &column_offset_X,
                       const size_t &row_offset_X,
                       const size_t &column_offset_Y,
                       const size_t &row_offset_Y,
                       El::DistMatrix<El::BigFloat> &temp,
                       El::DistMatrix<El::BigFloat> &result_submatrix)
  {
    El::DistMatrix<El::BigFloat> X_submatrix(El::LockedView(
      bilinear_X_inv, column_offset_X, row_offset_X, block_size, block_size)),
      Y_submatrix(El::LockedView(bilinear_Y, column_offset_Y, row_offset_Y,
                                 block_size, block_size)),
      Y_transpose(block_size, block_size, bilinear_Y.Grid());

    // The overall result is symmetric, but this particular block may
    // not be because it is offset from the diagonal.

    // It does not help to use TransposeAxpy().  Hadamard() sets the
    // result, it does not add it in.
    El::Transpose(Y_submatrix, Y_transpose);
    if(X_submatrix.ColAlign() == Y_transpose.ColAlign()
       && X_submatrix.RowAlign() == Y_transpose.RowAlign())
      {
        El::Hadamard(X_submatrix, Y_transpose, temp);
      }
    else<commit_msg>Fix a comment<commit_after>#include "../../../../Block_Diagonal_Matrix.hxx"
#include "../../../../../Block_Info.hxx"
#include "../../../../../../Timers.hxx"

// Compute the SchurComplement matrix using BilinearPairingsXInv and
// BilinearPairingsY and the formula
//
//   S_{(j,r1,s1,k1), (j,r2,s2,k2)} = \sum_{b \in blocks[j]}
//          (1/4) (BilinearPairingsXInv_{ej s1 + k1, ej r2 + k2}*
//                 BilinearPairingsY_{ej s2 + k2, ej r1 + k1} +
//                 swaps (r1 <-> s1) and (r2 <-> s2))
//
// where ej = d_j + 1.

namespace
{
  // Elementwise multiplication of two submatrices.
  //
  // result(i,j)=(bilinear_X_inv(column_offset_X+i,row_offset_X+j)
  //              * bilinear_Y_inv(column_offset_Y+i,row_offset_Y+j))/4

  void
  multiply_submatrices(const El::DistMatrix<El::BigFloat> &bilinear_X_inv,
                       const El::DistMatrix<El::BigFloat> &bilinear_Y,
                       const size_t &block_size, const size_t &column_offset_X,
                       const size_t &row_offset_X,
                       const size_t &column_offset_Y,
                       const size_t &row_offset_Y,
                       El::DistMatrix<El::BigFloat> &temp,
                       El::DistMatrix<El::BigFloat> &result_submatrix)
  {
    El::DistMatrix<El::BigFloat> X_submatrix(El::LockedView(
      bilinear_X_inv, column_offset_X, row_offset_X, block_size, block_size)),
      Y_submatrix(El::LockedView(bilinear_Y, column_offset_Y, row_offset_Y,
                                 block_size, block_size)),
      Y_transpose(block_size, block_size, bilinear_Y.Grid());

    // The overall result is symmetric, but this particular block may
    // not be because it is offset from the diagonal.

    // It does not help to use TransposeAxpy().  Hadamard() sets the
    // result, it does not add it in.
    El::Transpose(Y_submatrix, Y_transpose);
    if(X_submatrix.ColAlign() == Y_transpose.ColAlign()
       && X_submatrix.RowAlign() == Y_transpose.RowAlign())
      {
        El::Hadamard(X_submatrix, Y_transpose, temp);
      }
    else
{'fraction_non_alphanumeric': 0.1379061371841155, 'fraction_numerical': 0.010348977135980746, 'mean_word_length': 2.354317998385795, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5568530', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1399, 'n_words': 281}