~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/dboc/stringblocks.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifndef _psi3_dboc_stringblocks_h_
 
3
#define _psi3_dboc_stringblocks_h_
 
4
 
 
5
#include <string>
 
6
extern "C" {
 
7
#include <psifiles.h>
 
8
}
 
9
#include "float.h"
 
10
 
 
11
/// Manages logic of arranging strings into blocks of manageble size
 
12
class StringBlocks {
 
13
 public:
 
14
  StringBlocks(int nstr, int nstr_per_block);
 
15
  ~StringBlocks();
 
16
 
 
17
  /// How many strings per block?
 
18
  int nstr_per_block() const;
 
19
  /// How many blocks?
 
20
  int nblocks() const;
 
21
  /// Size of the block
 
22
  int size(int block) const;
 
23
  /// To which block does this string belong?
 
24
  int block(int str) const;
 
25
  /// Index within the block
 
26
  int rel_to_block_begin(int str) const;
 
27
  /// First string in this block
 
28
  int begin(int block) const;
 
29
  /// Last string in this block
 
30
  int end(int block) const;
 
31
 
 
32
 private:
 
33
  int nstr_;
 
34
  int nblocks_;
 
35
  int nstr_per_block_;
 
36
};
 
37
 
 
38
/// Manages matrices in the basis of blocked strings
 
39
class StringBlockedMatrix {
 
40
 public:
 
41
  StringBlockedMatrix(const StringBlocks* strblk_bra, const StringBlocks* strblk_ket, const std::string& prefix);
 
42
  /// Makes a copy of A, including deep copy of the buffer
 
43
  StringBlockedMatrix(const StringBlockedMatrix& A);
 
44
  ~StringBlockedMatrix();
 
45
 
 
46
  StringBlocks* strblk_bra() const { return strblk_bra_; }
 
47
  StringBlocks* strblk_ket() const { return strblk_ket_; }
 
48
 
 
49
  FLOAT** buffer();
 
50
  void read(int brablk, int ketblk);
 
51
  void write(int brablk, int ketblk);
 
52
 
 
53
 private:
 
54
  std::string prefix_;
 
55
  FLOAT** buffer_;
 
56
  StringBlocks* strblk_bra_;
 
57
  StringBlocks* strblk_ket_;
 
58
  /// block size in bytes
 
59
  size_t blksize_;
 
60
  int current_brablk_, current_ketblk_;
 
61
 
 
62
  // PSIO status
 
63
  static const unsigned int psio_unit_ = PSIF_DBOC;
 
64
  int need_to_init_psio_;
 
65
  int unit_opened_;
 
66
 
 
67
  std::string key(int brablk, int ketblk);
 
68
};
 
69
 
 
70
#endif