<commit_before>// ---------------------------------------------------------------------
//
// Copyright (C) 2002 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------

#ifndef __deal2__block_sparse_matrix_ez_h
#define __deal2__block_sparse_matrix_ez_h


//TODO: Derive BlockSparseMatrixEZ from BlockMatrixBase, like all the other block matrices as well; this would allow to instantiate a few functions with this template argument as well (in particular ConstraintMatrix::distribute_local_to_global)

#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/table.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/lac/block_indices.h>
#include <deal.II/lac/sparse_matrix_ez.h>

DEAL_II_NAMESPACE_OPEN

template <typename Number> class BlockVector;

/*! @addtogroup Matrix1
 *@{
 */


/**
 * A block matrix consisting of blocks of type SparseMatrixEZ.
 *
 * Like the other Block-objects, this matrix can be used like a
 * SparseMatrixEZ, when it comes to access to entries. Then, there are
 * functions for the multiplication with BlockVector and access to the
 * individual blocks.
 *
 * @see
 * @ref GlossBlockLA "Block (linear algebra)"
 * @author <NAME>, 2002, 2003
 */
template<typename Number>
class BlockSparseMatrixEZ : public Subscriptor
{
public:
  /**
   * Declare type for container size.
   */
  typedef types::global_dof_index size_type;

  /**
   * Default constructor. The result is an empty object with zero dimensions.
   */
  BlockSparseMatrixEZ ();

  /**
   * Constructor setting up an object with given unmber of block rows and
   * columns. The blocks themselves still have zero dimension.
   */
  BlockSparseMatrixEZ (const unsigned int block_rows,
                       const unsigned int block_cols);

  /**
   * Copy constructor. This is needed for some container classes. It creates
   * an object of the same number of block rows and columns. Since it calls
   * the copy constructor of SparseMatrixEZ, the block s must be empty.
   */
  BlockSparseMatrixEZ (const BlockSparseMatrixEZ<Number> &);

  /**
   * Copy operator. Like the copy constructor, this may be called for objects
   * with empty blocks only.
   */
  BlockSparseMatrixEZ &operator = (const BlockSparseMatrixEZ<Number> &);

  /**
   * This operator assigns a scalar to a matrix. Since this does usually not
   * make much sense (should we set all matrix entries to this value? Only the
   * nonzero entries of the sparsity pattern?), this operation is only allowed
   * if the actual value to be assigned is zero. This operator only exists to
   * allow for the obvious notation <tt>matrix=0</tt>, which sets all elements
   * of the matrix to zero, but keep the sparsity pattern previously used.
   */
  BlockSparseMatrixEZ &operator = (const double d);


  /**
   * Set matrix to zero dimensions and release memory.
   */
  void clear ();

  /**
   * Initialize to given block numbers.  After this operation, the matrix will
   * have the block dimensions provided. Each block will have zero dimensions
   * and must be initialized subsequently. After setting the sizes of the
   * blocks, collect_sizes() must be called to update internal data
   * structures.
   */
  void reinit (const unsigned int n_block_rows,
               const unsigned int n_block_cols);
  /**
   * This function collects the sizes of the sub-objects and stores them in
   * internal arrays, in order to be able to relay global indices into the
   * matrix to indices into the subobjects. You *must* call this function each
   * time after you have changed the size of the sub-objects.
   */
  void collect_sizes ();

  /**
   * Access the block with the given coordinates.
   */
  SparseMatrixEZ<Number> &
  block (const unsigned int row,
         const unsigned int column);


  /**
   * Access the block with the given coordinates. Version for constant
   * objects.
   */
  const SparseMatrixEZ<Number> &
  block (const unsigned int row,
         const unsigned int column) const;

  /**
   * Return the number of blocks in a column.
   */
  unsigned int n_block_rows () const;

  /**
   * Return the number of blocks in a row.
   */
  unsigned int n_block_cols () const;

  /**
   * Return whether the object is empty. It is empty if no memory is
   * allocated, which is the same as that both dimensions are zero. This
   * function is just the concatenation of the respective call to all sub-
   * matrices.
   */
  bool empty () const;

  /**
   * Return number of rows of this matrix, which equals the dimension of
   * the codomain (or range) space. It is the sum of the number of rows over the
   * sub-matrix blocks of this matrix.
   */
  size_type n_rows () const;

  /**
   * Return number of columns of this matrix, which equals the dimension of
   * the domain space. It is the sum of the number of columns over the
   * sub-matrix blocks of this matrix.
   */
  size_type n_cols () const;

  /**
   * Return the dimension of the codomain (or range) space. To remember:
   * the matrix is of dimension $m \times n$.
   */
  size_type m () const;

  /**
   * Return the dimension of the domain space. To remember: the matrix is of
   * dimension $m \times n$.
   */
  size_type n () const;

  /**
   * Set the element <tt>(i,j)</tt> to @p value.  Throws an error if the entry
   * does not exist or if <tt>value</tt> is not a finite number. Still, it is
   * allowed to store zero values in non-existent fields.
   */
  void set (const size_type i,
            const size_type j,
            const Number value);<commit_msg>Deprecate the n_rows() and n_cols() member functions. The SparseMatrixEZ class is the only matrix class that has these functions, and it has m() and n() like all other matrix classes.<commit_after>// ---------------------------------------------------------------------
//
// Copyright (C) 2002 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------

#ifndef __deal2__block_sparse_matrix_ez_h
#define __deal2__block_sparse_matrix_ez_h


//TODO: Derive BlockSparseMatrixEZ from BlockMatrixBase, like all the other block matrices as well; this would allow to instantiate a few functions with this template argument as well (in particular ConstraintMatrix::distribute_local_to_global)

#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/base/table.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/lac/block_indices.h>
#include <deal.II/lac/sparse_matrix_ez.h>

DEAL_II_NAMESPACE_OPEN

template <typename Number> class BlockVector;

/*! @addtogroup Matrix1
 *@{
 */


/**
 * A block matrix consisting of blocks of type SparseMatrixEZ.
 *
 * Like the other Block-objects, this matrix can be used like a
 * SparseMatrixEZ, when it comes to access to entries. Then, there are
 * functions for the multiplication with BlockVector and access to the
 * individual blocks.
 *
 * @see
 * @ref GlossBlockLA "Block (linear algebra)"
 * @author <NAME>, 2002, 2003
 */
template<typename Number>
class BlockSparseMatrixEZ : public Subscriptor
{
public:
  /**
   * Declare type for container size.
   */
  typedef types::global_dof_index size_type;

  /**
   * Default constructor. The result is an empty object with zero dimensions.
   */
  BlockSparseMatrixEZ ();

  /**
   * Constructor setting up an object with given unmber of block rows and
   * columns. The blocks themselves still have zero dimension.
   */
  BlockSparseMatrixEZ (const unsigned int block_rows,
                       const unsigned int block_cols);

  /**
   * Copy constructor. This is needed for some container classes. It creates
   * an object of the same number of block rows and columns. Since it calls
   * the copy constructor of SparseMatrixEZ, the block s must be empty.
   */
  BlockSparseMatrixEZ (const BlockSparseMatrixEZ<Number> &);

  /**
   * Copy operator. Like the copy constructor, this may be called for objects
   * with empty blocks only.
   */
  BlockSparseMatrixEZ &operator = (const BlockSparseMatrixEZ<Number> &);

  /**
   * This operator assigns a scalar to a matrix. Since this does usually not
   * make much sense (should we set all matrix entries to this value? Only the
   * nonzero entries of the sparsity pattern?), this operation is only allowed
   * if the actual value to be assigned is zero. This operator only exists to
   * allow for the obvious notation <tt>matrix=0</tt>, which sets all elements
   * of the matrix to zero, but keep the sparsity pattern previously used.
   */
  BlockSparseMatrixEZ &operator = (const double d);


  /**
   * Set matrix to zero dimensions and release memory.
   */
  void clear ();

  /**
   * Initialize to given block numbers.  After this operation, the matrix will
   * have the block dimensions provided. Each block will have zero dimensions
   * and must be initialized subsequently. After setting the sizes of the
   * blocks, collect_sizes() must be called to update internal data
   * structures.
   */
  void reinit (const unsigned int n_block_rows,
               const unsigned int n_block_cols);
  /**
   * This function collects the sizes of the sub-objects and stores them in
   * internal arrays, in order to be able to relay global indices into the
   * matrix to indices into the subobjects. You *must* call this function each
   * time after you have changed the size of the sub-objects.
   */
  void collect_sizes ();

  /**
   * Access the block with the given coordinates.
   */
  SparseMatrixEZ<Number> &
  block (const unsigned int row,
         const unsigned int column);


  /**
   * Access the block with the given coordinates. Version for constant
   * objects.
   */
  const SparseMatrixEZ<Number> &
  block (const unsigned int row,
         const unsigned int column) const;

  /**
   * Return the number of blocks in a column.
   */
  unsigned int n_block_rows () const;

  /**
   * Return the number of blocks in a row.
   */
  unsigned int n_block_cols () const;

  /**
   * Return whether the object is empty. It is empty if no memory is
   * allocated, which is the same as that both dimensions are zero. This
   * function is just the concatenation of the respective call to all sub-
   * matrices.
   */
  bool empty () const;

  /**
   * Return number of rows of this matrix, which equals the dimension of
   * the codomain (or range) space. It is the sum of the number of rows over the
   * sub-matrix blocks of this matrix.
   *
   * @deprecated Use m() instead.
   */
  size_type n_rows () const DEAL_II_DEPRECATED;

  /**
   * Return number of columns of this matrix, which equals the dimension of
   * the domain space. It is the sum of the number of columns over the
   * sub-matrix blocks of this matrix.
   *
   * @deprecated Use n() instead.
   */
  size_type n_cols () const DEAL_II_DEPRECATED;

  /**
   * Return the dimension of the codomain (or range) space. To remember:
   * the matrix is of dimension $m \times n$.
   */
  size_type m () const;

  /**
   * Return the dimension of the domain space. To remember: the matrix is of
   * dimension $m \times n$.
   */
  size_type n () const;

  /**
   * Set the element <tt>(i,j)</tt> to @p value.  Throws an error if the entry
   * does not exist or if <tt>value</tt> is not a finite number. Still, it is
   * allowed to store zero values in non-existent fields.
   */
  void set (const size_type i,
            const size_type j,
            const Number value);
{'fraction_non_alphanumeric': 0.10080192461908581, 'fraction_numerical': 0.003528468323977546, 'mean_word_length': 2.830159705159705, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '1074705', 'n_tokens_mistral': 3532, 'n_tokens_neox': 3415, 'n_words': 1560}