1 #ifndef MPQC_CI_VECTOR_HPP
2 #define MPQC_CI_VECTOR_HPP
4 #include "mpqc/ci/subspace.hpp"
5 #include "mpqc/math/matrix.hpp"
6 #include "mpqc/array.hpp"
7 #include "mpqc/mpi.hpp"
9 #include "mpqc/utility/profile.hpp"
26 blocks_.resize(G.
alpha().size(), G.
beta().size());
28 for (
size_t j = 0; j < G.
beta().size(); ++j) {
29 for (
size_t i = 0; i < G.
alpha().size(); ++i) {
31 b.rows = G.
alpha().at(i).size();
32 b.cols = G.
beta().at(j).size();
36 dets += b.rows*b.cols;
41 MPQC_CHECK(dets == G.
dets());
42 BOOST_FOREACH (
const auto &s, G.
alpha())
43 this->alpha_.push_back(s);
44 BOOST_FOREACH (
const auto &s, G.
beta())
45 this->beta_.push_back(s);
46 std::vector<size_t> extents;
47 extents.push_back(dets);
48 this->array_ = (incore)
68 return Block1d(this->array_(r));
76 MPQC_CHECK(m.rows() == this->rows_);
77 MPQC_CHECK(m.cols() == this->cols_);
82 m.resize(this->rows_, this->cols_);
88 : array_(array), rows_(rows), cols_(cols) {}
96 Block b = this->block(A,B);
97 return Block2d(this->array_(b.range()), b.rows, b.cols);
115 std::vector<mpqc::range> alpha_;
116 std::vector<mpqc::range> beta_;
124 size_t i = range_to_block(A, this->alpha_);
125 size_t j = range_to_block(B, this->beta_);
126 Block b = this->blocks_(i,j);
128 throw MPQC_EXCEPTION(
"ci::Vector: block (%s,%s) is not allowed\n",
135 static size_t range_to_block(
mpqc::range r,
const std::vector<mpqc::range> &R) {
136 auto it = std::find(R.begin(), R.end(), r);
138 throw MPQC_EXCEPTION(
"ci::Vector: range r=(%s) does not map an exact block",
161 const std::vector<mpqc::range> &local,
164 BOOST_FOREACH (
auto r, local) {
181 const std::vector<mpqc::range> &local,
186 #pragma omp parallel for reduction(+:db)
187 for (
int j = 0; j < local.size(); ++j) {
198 #pragma omp parallel for reduction(+:dd)
199 for (
int j = 0; j < local.size(); ++j) {
212 #pragma omp parallel for
213 for (
int j = 0; j < local.size(); ++j) {
Grid of subspaces, represented as blocks of determinants defined by alpha/beta pair,...
Definition: subspace.hpp:103
void orthonormalize(matrix< T > &d, const matrix< T > &b)
orthormalize matrix d wrt to normalized matrix b d = normalize(d - (<d|b>*b))
Definition: matrix.hpp:224
friend void operator>>(Vector::Block1d block, mpqc::Vector &v)
Get vector block into v.
Definition: vector.hpp:152
Contains new MPQC code since version 3.
Definition: integralenginepool.hpp:37
friend void operator<<(Vector::Block1d block, const mpqc::Vector &v)
Set vector block to v.
Definition: vector.hpp:147
void operator>>(Array< T > A, V &v)
Read from Array to a generic vector V.
Definition: array.hpp:204
Matrix class derived from Eigen::Matrix with additional MPQC integration.
Definition: matrix.hpp:21
Block CI Vector, with 1-d (vector) and 2-d (matrix) access.
Definition: vector.hpp:18
2-d vector sub-block
Definition: vector.hpp:73
An interface to enable matrix assignment from other containers.
Definition: matrix.hpp:54
size_t dets() const
Returns number of determinants in the grid.
Definition: subspace.hpp:164
1-d vector sub-block
Definition: vector.hpp:55
#define MPQC_EXCEPTION(...)
Definition: exception.hpp:51
Vector(std::string name, const SubspaceGrid &G, MPI::Comm comm, bool incore)
Construct vector.
Definition: vector.hpp:25
bool allowed(int a, int b) const
Returns whenever a subspace alpha/beta block is allowed.
Definition: subspace.hpp:139
void assign_to(mpqc::Matrix &m) const
mpqc::Matrix::Assignable::assign_to implementation
Definition: vector.hpp:81
std::string string_cast(const T &value)
cast type T to string
Definition: string.hpp:14
Block2d operator()(mpqc::range A, mpqc::range B)
Returns 2-d sub-block of vector.
Definition: vector.hpp:95
const std::vector< Subspace< Beta > > & beta() const
Returns all beta subspaces.
Definition: subspace.hpp:149
const std::vector< Subspace< Alpha > > & alpha() const
Returns all alpha subspaces.
Definition: subspace.hpp:144
T norm(const matrix< T > &a)
Matrix norm.
Definition: matrix.hpp:209
void operator<<(Array< T > A, const V &v)
Write to Array from a generic vector V.
Definition: array.hpp:191
MPI_Comm object wrapper/stub.
Definition: comm.hpp:14
Vector class derived from Eigen::Matrix with additional MPQC integration.
Definition: matrix.hpp:133
void operator=(const mpqc::Matrix &m) const
Assign matrix to this sub-block.
Definition: vector.hpp:75
Block1d operator()(range r)
Returns 1-d sub-block of vector.
Definition: vector.hpp:67
Generated at Sun Jan 26 2020 23:24:01 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.