MADNESS  0.10.1
vector_factory.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 
31 
32  $Id$
33 */
34 
35 
36 #ifndef MADNESS_TENSOR_VECTOR_FACTORY_H__INCLUDED
37 #define MADNESS_TENSOR_VECTOR_FACTORY_H__INCLUDED
38 
39 #include <vector>
40 
41 /// \file vector_factory.h
42 /// \brief Declares and implements factories for short vectors
43 
44 /// \ingroup tensor
45 
46 namespace madness {
47 
48  /// Returns a std::vector<T> initialized from the arguments
49  template <typename T>
50  inline std::vector<T> vector_factory(const T& v0) {
51  std::vector<T> v(1);
52  v[0] = v0;
53  return v;
54  }
55 
56  /// Returns a std::vector<T> initialized from the arguments
57  template <typename T>
58  inline std::vector<T> vector_factory(const T& v0, const T& v1) {
59  std::vector<T> v(2);
60  v[0] = v0;
61  v[1] = v1;
62  return v;
63  }
64 
65  /// Returns a std::vector<T> initialized from the arguments
66  template <typename T>
67  inline std::vector<T> vector_factory(const T& v0, const T& v1,
68  const T& v2) {
69  std::vector<T> v(3);
70  v[0] = v0;
71  v[1] = v1;
72  v[2] = v2;
73  return v;
74  }
75 
76  /// Returns a std::vector<T> initialized from the arguments
77  template <typename T>
78  inline std::vector<T> vector_factory(const T& v0, const T& v1,
79  const T& v2, const T& v3) {
80  std::vector<T> v(4);
81  v[0] = v0;
82  v[1] = v1;
83  v[2] = v2;
84  v[3] = v3;
85  return v;
86  }
87 
88  /// Returns a std::vector<T> initialized from the arguments
89  template <typename T>
90  inline std::vector<T> vector_factory(const T& v0, const T& v1,
91  const T& v2, const T& v3,
92  const T& v4) {
93  std::vector<T> v(5);
94  v[0] = v0;
95  v[1] = v1;
96  v[2] = v2;
97  v[3] = v3;
98  v[4] = v4;
99  return v;
100  }
101 
102  /// Returns a std::vector<T> initialized from the arguments
103  template <typename T>
104  inline std::vector<T> vector_factory(const T& v0, const T& v1,
105  const T& v2, const T& v3,
106  const T& v4, const T& v5) {
107  std::vector<T> v(6);
108  v[0] = v0;
109  v[1] = v1;
110  v[2] = v2;
111  v[3] = v3;
112  v[4] = v4;
113  v[5] = v5;
114  return v;
115  }
116 
117  /// Returns a std::vector<T> initialized from the arguments
118  template <typename T>
119  inline std::vector<T> vector_factory(const T& v0, const T& v1,
120  const T& v2, const T& v3,
121  const T& v4, const T& v5,
122  const T& v6) {
123  std::vector<T> v(7);
124  v[0] = v0;
125  v[1] = v1;
126  v[2] = v2;
127  v[3] = v3;
128  v[4] = v4;
129  v[5] = v5;
130  v[6] = v6;
131  return v;
132  }
133 
134  /// Returns a std::vector<T> initialized from the arguments
135  template <typename T>
136  inline std::vector<T> vector_factory(const T& v0, const T& v1,
137  const T& v2, const T& v3,
138  const T& v4, const T& v5,
139  const T& v6, const T& v7) {
140  std::vector<T> v(8);
141  v[0] = v0;
142  v[1] = v1;
143  v[2] = v2;
144  v[3] = v3;
145  v[4] = v4;
146  v[5] = v5;
147  v[6] = v6;
148  v[7] = v7;
149  return v;
150  }
151 
152 
153 }
154 
155 #endif // MADNESS_TENSOR_VECTOR_FACTORY_H__INCLUDED
auto T(World &world, response_space &f) -> response_space
Definition: global_functions.cc:34
static const double v
Definition: hatom_sf_dirac.cc:20
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
std::vector< T > vector_factory(const T &v0)
Returns a std::vector<T> initialized from the arguments.
Definition: vector_factory.h:50