Psi4
vector_base.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2018 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _psi_src_lib_libmemtrix_vector_base_h_
30 #define _psi_src_lib_libmemtrix_vector_base_h_
31 
33 #include <cstring> // for size_t
34 
35 namespace psi {
36 namespace mcscf {
37 
38 class VectorBase {
39  public:
40  VectorBase();
41  VectorBase(int rows);
42  ~VectorBase();
43 
44  // Inlines
45  int get_elements() { return (elements_); }
46  void set(int i, double value) { vector_[i] = value; }
47  void add(int i, double value) { vector_[i] += value; }
48  double get(int i) { return (vector_[i]); }
49  double* get_vector() { return (vector_); }
50 
51  void print();
52  void copy(VectorBase& source);
53 
54  private:
55  // Vector size
56  size_t elements_;
57 
58  // Vector data
59  double* vector_;
60 };
61 
62 } // namespace mcscf
63 } // namespace psi
64 
65 #endif // _psi_src_lib_libmemtrix_vector_base_h_
size_t elements_
Definition: vector_base.h:56
double * get_vector()
Definition: vector_base.h:49
Definition: pointgrp.h:104
void copy(VectorBase &source)
Definition: vector_base.cc:57
SharedWavefunction mcscf(SharedWavefunction, Options &)
Definition: mcscf.cc:69
double * vector_
Definition: vector_base.h:59
void print()
Definition: vector_base.cc:50
void add(int i, double value)
Definition: vector_base.h:47
Definition: vector_base.h:38
int get_elements()
Definition: vector_base.h:45
void set(int i, double value)
Definition: vector_base.h:46
~VectorBase()
Definition: vector_base.cc:48