<commit_before>/************************************************************//**
  hypersector.h

  Enumeration of sectors for multiple operators.

  Language: C++11

  <NAME>
  University of Notre Dame

  + 4/4/17 (mac): Created, building on code from basis.h.
  + 4/11/17 (mac): Add basic hyperoperator support --
    OperatorHypersectors and SetHyperoperatorToZero.

****************************************************************/

#ifndef HYPERSECTOR_H_
#define HYPERSECTOR_H_

#include "basis/basis.h"
#include "basis/operator.h"

namespace basis {

  ////////////////////////////////////////////////////////////////
  // hypersector indexing
  ////////////////////////////////////////////////////////////////

  // Note: A "hypersector" represents a triplet consisting of a pair
  // of "state" subspaces (which thus define a "sector" or block in
  // the matrix representation of an operator on the space) and an
  // "operator" subspace.  The hypersector may also be labeled with an
  // optional multiplicity index.

  template <typename tSubspaceType, typename tOperatorSubspaceType>
    class BaseHypersector
    // Store indexing and subspace reference information for a
    // hypersector.
    //
    // Allows for multiplicity index on sector, for symmetry sectors
    // of groups with outer multiplicities.
    {

      ////////////////////////////////////////////////////////////////
      // typedefs
      ////////////////////////////////////////////////////////////////

      public:
      typedef tSubspaceType SubspaceType;
      typedef tOperatorSubspaceType OperatorSubspaceType;
      typedef std::tuple<int,int,int,int> KeyType;

      ////////////////////////////////////////////////////////////////
      // constructors
      ////////////////////////////////////////////////////////////////

      BaseHypersector(
          int bra_subspace_index, int ket_subspace_index, int operator_subspace_index,
          const SubspaceType& bra_subspace, const SubspaceType& ket_subspace, const OperatorSubspaceType& operator_subspace,
          int multiplicity_index=1
        )
        : bra_subspace_index_(bra_subspace_index), ket_subspace_index_(ket_subspace_index),
        operator_subspace_index_(ket_subspace_index), multiplicity_index_(multiplicity_index)
      {
        bra_subspace_ptr_ = &bra_subspace;
        ket_subspace_ptr_ = &ket_subspace;
        operator_subspace_ptr_ = &operator_subspace;
      }

      ////////////////////////////////////////////////////////////////
      // accessors
      ////////////////////////////////////////////////////////////////

      inline KeyType Key() const
      // Return tuple key identifying sector for sorting/lookup
      // purposes.
      {
        return KeyType(bra_subspace_index(),ket_subspace_index(),operator_subspace_index(),multiplicity_index());
      }

      int bra_subspace_index() const {return bra_subspace_index_;}
      int ket_subspace_index() const {return ket_subspace_index_;}
      int operator_subspace_index() const {return operator_subspace_index_;}
      // Return integer index of bra/ket subspace.
<commit_msg>Fix error in hypersector constructor<commit_after>/************************************************************//**
  hypersector.h

  Enumeration of sectors for multiple operators.

  Language: C++11

  <NAME>
  University of Notre Dame

  + 4/4/17 (mac): Created, building on code from basis.h.
  + 4/11/17 (mac): Add basic hyperoperator support --
    OperatorHypersectors and SetHyperoperatorToZero.
  + 4/22/17 (aem): Fix error in hypersector constructor.
****************************************************************/

#ifndef HYPERSECTOR_H_
#define HYPERSECTOR_H_

#include "basis/basis.h"
#include "basis/operator.h"

namespace basis {

  ////////////////////////////////////////////////////////////////
  // hypersector indexing
  ////////////////////////////////////////////////////////////////

  // Note: A "hypersector" represents a triplet consisting of a pair
  // of "state" subspaces (which thus define a "sector" or block in
  // the matrix representation of an operator on the space) and an
  // "operator" subspace.  The hypersector may also be labeled with an
  // optional multiplicity index.

  template <typename tSubspaceType, typename tOperatorSubspaceType>
    class BaseHypersector
    // Store indexing and subspace reference information for a
    // hypersector.
    //
    // Allows for multiplicity index on sector, for symmetry sectors
    // of groups with outer multiplicities.
    {

      ////////////////////////////////////////////////////////////////
      // typedefs
      ////////////////////////////////////////////////////////////////

      public:
      typedef tSubspaceType SubspaceType;
      typedef tOperatorSubspaceType OperatorSubspaceType;
      typedef std::tuple<int,int,int,int> KeyType;

      ////////////////////////////////////////////////////////////////
      // constructors
      ////////////////////////////////////////////////////////////////

      BaseHypersector(
          int bra_subspace_index, int ket_subspace_index, int operator_subspace_index,
          const SubspaceType& bra_subspace, const SubspaceType& ket_subspace, const OperatorSubspaceType& operator_subspace,
          int multiplicity_index=1
        )
        : bra_subspace_index_(bra_subspace_index), ket_subspace_index_(ket_subspace_index),
        operator_subspace_index_(operator_subspace_index), multiplicity_index_(multiplicity_index)
      {
        bra_subspace_ptr_ = &bra_subspace;
        ket_subspace_ptr_ = &ket_subspace;
        operator_subspace_ptr_ = &operator_subspace;
      }

      ////////////////////////////////////////////////////////////////
      // accessors
      ////////////////////////////////////////////////////////////////

      inline KeyType Key() const
      // Return tuple key identifying sector for sorting/lookup
      // purposes.
      {
        return KeyType(bra_subspace_index(),ket_subspace_index(),operator_subspace_index(),multiplicity_index());
      }

      int bra_subspace_index() const {return bra_subspace_index_;}
      int ket_subspace_index() const {return ket_subspace_index_;}
      int operator_subspace_index() const {return operator_subspace_index_;}
      // Return integer index of bra/ket subspace.

{'fraction_non_alphanumeric': 0.2596972563859981, 'fraction_numerical': 0.00457269000315358, 'mean_word_length': 1.7930427124614707, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3043709', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1447, 'n_words': 401}