TiledArray  0.7.0
dense_shape.h
Go to the documentation of this file.
1 /*
2  * This file is a part of TiledArray.
3  * Copyright (C) 2013 Virginia Tech
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Justus Calvin
19  * Department of Chemistry, Virginia Tech
20  *
21  * dense_shape.h
22  * Jul 9, 2013
23  *
24  */
25 
26 #ifndef TILEDARRAY_DENSE_SHAPE_H__INCLUDED
27 #define TILEDARRAY_DENSE_SHAPE_H__INCLUDED
28 
29 #include <TiledArray/type_traits.h>
30 
31 namespace madness {
32  class World;
33 } // namespace
34 
35 namespace TiledArray {
36 
37  // Forward declarations
38  namespace expressions {
39  class VariableList;
40  } // namespace expressions
41  namespace math {
42  class GemmHelper;
43  } // namespace math
44  class Range;
45  class Permutation;
46  using madness::World;
47 
48 
50 
54  class DenseShape {
55  public:
56  // There is no data in DenseShape so the compiler generated constructors,
57  // assignment operator, and destructor are OK.
58 
59 
61 
63  static void collective_init(World&) { }
64 
66 
68  static constexpr bool validate(const Range&) { return true; }
69 
71 
74  template <typename Index>
75  static constexpr bool is_zero(const Index&) { return false; }
76 
78 
80  static constexpr bool is_dense() { return true; }
81 
82 
84 
86  static constexpr float sparsity() { return 0.0f; }
87 
88 
90 
92  static constexpr bool empty() { return false; }
93 
94  DenseShape mask(const DenseShape &) const {
95  return DenseShape{};
96  };
97 
98  template <typename Index>
99  static DenseShape update_block(const Index&, const Index&, const DenseShape&)
100  { return DenseShape(); }
101 
102  template <typename Index>
103  static DenseShape block(const Index&, const Index&) { return DenseShape(); }
104 
105  template <typename Index, typename Scalar,
106  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
107  static DenseShape block(const Index&, const Index&, const Scalar)
108  { return DenseShape(); }
109 
110  template <typename Index>
111  static DenseShape block(const Index&, const Index&, const Permutation&)
112  { return DenseShape(); }
113 
114  template <typename Index, typename Scalar>
115  static DenseShape block(const Index&, const Index&, const Scalar, const Permutation&)
116  { return DenseShape(); }
117 
118  static DenseShape perm(const Permutation&) { return DenseShape(); }
119 
120  template <typename Scalar>
121  static DenseShape scale(const Scalar) { return DenseShape(); }
122 
123  template <typename Scalar>
124  static DenseShape scale(const Scalar, const Permutation&) { return DenseShape(); }
125 
126  static DenseShape add(const DenseShape&) { return DenseShape(); }
127 
128  static DenseShape add(const DenseShape&, const Permutation&) { return DenseShape(); }
129 
130  template <typename Scalar>
131  static DenseShape add(const DenseShape&, const Scalar) { return DenseShape(); }
132 
133  template <typename Scalar>
134  static DenseShape add(const DenseShape&, const Scalar, const Permutation&) { return DenseShape(); }
135 
136  template <typename Scalar>
137  static DenseShape add(const Scalar) { return DenseShape(); }
138 
139  template <typename Scalar>
140  static DenseShape add(const Scalar, const Permutation&) { return DenseShape(); }
141 
142  static DenseShape subt(const DenseShape&) { return DenseShape(); }
143 
144  static DenseShape subt(const DenseShape&, const Permutation&) { return DenseShape(); }
145 
146  template <typename Scalar>
147  static DenseShape subt(const DenseShape&, const Scalar) { return DenseShape(); }
148 
149  template <typename Scalar>
150  static DenseShape subt(const DenseShape&, const Scalar, const Permutation&) { return DenseShape(); }
151 
152  template <typename Scalar>
153  static DenseShape subt(const Scalar) { return DenseShape(); }
154 
155  template <typename Scalar>
156  static DenseShape subt(const Scalar, const Permutation&) { return DenseShape(); }
157 
158  static DenseShape mult(const DenseShape&) { return DenseShape(); }
159 
160  static DenseShape mult(const DenseShape&, const Permutation&) { return DenseShape(); }
161 
162  template <typename Scalar>
163  static DenseShape mult(const DenseShape&, const Scalar) { return DenseShape(); }
164 
165  template <typename Scalar>
166  static DenseShape mult(const DenseShape&, const Scalar, const Permutation&) { return DenseShape(); }
167 
168  template <typename Scalar>
169  static DenseShape gemm(const DenseShape&, const Scalar, const math::GemmHelper&)
170  { return DenseShape(); }
171 
172  template <typename Scalar>
173  static DenseShape gemm(const DenseShape&, const Scalar, const math::GemmHelper&, const Permutation&)
174  { return DenseShape(); }
175 
176  }; // class DenseShape
177 
178  constexpr inline bool operator==(const DenseShape& a, const DenseShape& b) { return true; }
179  constexpr inline bool operator!=(const DenseShape& a, const DenseShape& b) { return !(a==b); }
180 
181 } // namespace TiledArray
182 
183 #endif // TILEDARRAY_DENSE_SHAPE_H__INCLUDED
static DenseShape block(const Index &, const Index &, const Scalar)
Definition: dense_shape.h:107
static DenseShape block(const Index &, const Index &, const Scalar, const Permutation &)
Definition: dense_shape.h:115
static DenseShape add(const DenseShape &, const Scalar)
Definition: dense_shape.h:131
constexpr bool operator==(const DenseShape &a, const DenseShape &b)
Definition: dense_shape.h:178
A (hyperrectangular) interval on , space of integer n-indices.
Definition: range.h:39
static DenseShape subt(const Scalar, const Permutation &)
Definition: dense_shape.h:156
static constexpr float sparsity()
Sparsity fraction.
Definition: dense_shape.h:86
static DenseShape mult(const DenseShape &)
Definition: dense_shape.h:158
static DenseShape subt(const Scalar)
Definition: dense_shape.h:153
static DenseShape mult(const DenseShape &, const Permutation &)
Definition: dense_shape.h:160
static DenseShape add(const Scalar)
Definition: dense_shape.h:137
static DenseShape update_block(const Index &, const Index &, const DenseShape &)
Definition: dense_shape.h:99
static DenseShape subt(const DenseShape &)
Definition: dense_shape.h:142
static DenseShape gemm(const DenseShape &, const Scalar, const math::GemmHelper &)
Definition: dense_shape.h:169
static DenseShape mult(const DenseShape &, const Scalar, const Permutation &)
Definition: dense_shape.h:166
static DenseShape subt(const DenseShape &, const Scalar)
Definition: dense_shape.h:147
constexpr bool operator!=(const DenseShape &a, const DenseShape &b)
Definition: dense_shape.h:179
static DenseShape block(const Index &, const Index &)
Definition: dense_shape.h:103
DenseShape mask(const DenseShape &) const
Definition: dense_shape.h:94
Dense shape of an array.
Definition: dense_shape.h:54
static DenseShape subt(const DenseShape &, const Scalar, const Permutation &)
Definition: dense_shape.h:150
static DenseShape add(const DenseShape &, const Scalar, const Permutation &)
Definition: dense_shape.h:134
static DenseShape perm(const Permutation &)
Definition: dense_shape.h:118
static constexpr bool is_dense()
Check density.
Definition: dense_shape.h:80
static DenseShape scale(const Scalar, const Permutation &)
Definition: dense_shape.h:124
Variable list manages a list variable strings.
static DenseShape add(const Scalar, const Permutation &)
Definition: dense_shape.h:140
static DenseShape mult(const DenseShape &, const Scalar)
Definition: dense_shape.h:163
static DenseShape subt(const DenseShape &, const Permutation &)
Definition: dense_shape.h:144
static constexpr bool validate(const Range &)
Validate shape range.
Definition: dense_shape.h:68
Contraction to *GEMM helper.
Definition: gemm_helper.h:39
Permutation of a sequence of objects indexed by base-0 indices.
Definition: permutation.h:119
static void collective_init(World &)
Collective initialization of a shape.
Definition: dense_shape.h:63
static constexpr bool empty()
Check if the shape is empty (uninitialized)
Definition: dense_shape.h:92
static DenseShape gemm(const DenseShape &, const Scalar, const math::GemmHelper &, const Permutation &)
Definition: dense_shape.h:173
static DenseShape add(const DenseShape &, const Permutation &)
Definition: dense_shape.h:128
static constexpr bool is_zero(const Index &)
Check that a tile is zero.
Definition: dense_shape.h:75
static DenseShape add(const DenseShape &)
Definition: dense_shape.h:126
static DenseShape block(const Index &, const Index &, const Permutation &)
Definition: dense_shape.h:111
static DenseShape scale(const Scalar)
Definition: dense_shape.h:121