Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Dot.hh
Go to the documentation of this file.
1 ///
2 /// @file Dot.hh
3 /// @brief Tensor dot product algorithm
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
12 #ifndef HAMMER_MATH_MULTIDIM_OPS_DOT
13 #define HAMMER_MATH_MULTIDIM_OPS_DOT
14 
17 
18 namespace Hammer {
19 
20 
21  namespace MultiDimensional {
22 
23  class IContainer;
24  class VectorContainer;
25  class SparseContainer;
26  class OuterContainer;
27 
28  namespace Ops {
29 
30  class Dot final {
31  public:
32  Dot(const IndexPairList& indices, std::pair<bool, bool> shouldHC = {false, false});
33 
34  IContainer* operator()(VectorContainer& first, const VectorContainer& second);
35  IContainer* operator()(SparseContainer& first, const SparseContainer& second);
36 
37  IContainer* operator()(SparseContainer& first, const VectorContainer& second);
38 
39  IContainer* operator()(OuterContainer& first, const OuterContainer& second);
40  IContainer* operator()(OuterContainer& first, const SparseContainer& second);
41  IContainer* operator()(SparseContainer& first, const OuterContainer& second);
42  IContainer* operator()(OuterContainer& first, const IContainer& second);
43 
44  IContainer* operator()(IContainer& first, const IContainer& second);
45 
47 
48  private:
49  std::pair<IndexList, LabelsList> getNewIndexLabels(const IContainer& first,
50  const IContainer& second) const;
51  std::pair<IndexList, LabelsList> getNewIndexLabels(const BlockIndexing& lhs, const BlockIndexing& rhs,
52  const DotGroupType& chunk) const;
53  std::pair<IndexList, LabelsList> getNewIndexLabels(const LabeledIndexing<AlignedIndexing>& lhs, const BlockIndexing& rhs,
54  const DotGroupType& chunk) const;
55  std::pair<IndexList, LabelsList> getNewIndexLabels(const BlockIndexing& lhs,
57  const DotGroupType& chunk) const;
58 
59  IndexList combineIndex(const IndexList& a, const IndexList& b) const;
60 
62  const IndexPairList& indices, std::pair<bool, bool> shouldHC = {false, false});
63 
64  unsigned long long dotSignature(const IContainer& a, const IContainer& b,
65  const std::string& type) const;
66 
67  public:
68  DotGroupList partitionContractions(const BlockIndexing& lhs, const BlockIndexing& rhs) const;
71 
73  std::pair<bool, bool> _hc;
76 
77  };
78 
79  } // namespace Ops
80 
81  } // namespace MultiDimensional
82 
83 } // namespace Hammer
84 
85 
86 #endif
std::tuple< IndexList, IndexList, IndexPairList > DotGroupType
std::vector< IndexPair > IndexPairList
IContainer * operator()(VectorContainer &first, const VectorContainer &second)
Definition: Dot.cc:59
UniqueIndexList _idxLeft
Definition: Dot.hh:74
Dot(const IndexPairList &indices, std::pair< bool, bool > shouldHC={false, false})
Definition: Dot.cc:49
Forward declarations of types used in the tensor classes.
std::shared_ptr< IContainer > SharedTensorData
std::pair< bool, bool > _hc
Definition: Dot.hh:73
std::vector< DotGroupType > DotGroupList
std::pair< IndexList, LabelsList > getNewIndexLabels(const IContainer &first, const IContainer &second) const
Definition: Dot.cc:843
std::vector< IndexType > IndexList
IndexList combineIndex(const IndexList &a, const IndexList &b) const
Definition: Dot.cc:830
Outer product tensor indexer.
IContainer * error(IContainer &, const IContainer &)
Definition: Dot.cc:826
std::set< IndexType > UniqueIndexList
UniqueIndexList _idxRight
Definition: Dot.hh:75
SharedTensorData calcSharedDot(SharedTensorData origin, const IContainer &other, const IndexPairList &indices, std::pair< bool, bool > shouldHC={false, false})
Definition: Dot.cc:862
DotGroupList partitionContractions(const BlockIndexing &lhs, const BlockIndexing &rhs) const
Definition: Dot.cc:897
unsigned long long dotSignature(const IContainer &a, const IContainer &b, const std::string &type) const
Definition: Dot.cc:868