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

« back to all changes in this revision

Viewing changes to src/bin/transqt2/transone.c

  • 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
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
#include <libciomr/libciomr.h>
 
4
#include <libqt/qt.h>
 
5
 
 
6
/*
 
7
** transone(): Transform a packed symmetric matrix.
 
8
**
 
9
** int m: input matrix row dimension
 
10
** int n: output matrix row dimension
 
11
** double *input: pointer to input integrals (the lower-triange of a symmetric matrix)
 
12
** double *output: pointer to output integrals (the lower-triange of a symmetric matrix)
 
13
** double **C: transformation matrix (rectangular)
 
14
** int nc: column dimension of C
 
15
** int *order: reordering array for transformed indices
 
16
**
 
17
** Written for new transqt module
 
18
** TDC, 7/06
 
19
*/
 
20
 
 
21
#define INDEX(i,j) ((i>j) ? (ioff[(i)]+(j)) : (ioff[(j)]+(i)))
 
22
 
 
23
void transone(int m, int n, double *input, double *output, double **C, int nc, int *order, int *ioff)
 
24
{
 
25
  int p, q, pq;
 
26
  double **TMP0, **TMP1;
 
27
 
 
28
  TMP0 = block_matrix(m,m);
 
29
  TMP1 = block_matrix(m,m);
 
30
 
 
31
  for(p=0,pq=0; p < m; p++)
 
32
    for(q=0; q <= p; q++,pq++) 
 
33
      TMP0[p][q] = TMP0[q][p] = input[pq];
 
34
 
 
35
  if(m && n) {
 
36
    C_DGEMM('n','n',m,n,m,1.0,TMP0[0],m,C[0],nc,0.0,TMP1[0],m);
 
37
    C_DGEMM('t','n',n,n,m,1.0,C[0],nc,TMP1[0],m,0.0,TMP0[0],m);
 
38
  }
 
39
 
 
40
  for(p=0; p < n; p++)
 
41
    for(q=0; q <= p; q++) {
 
42
      pq = INDEX(order[p],order[q]);
 
43
      output[pq] = TMP0[p][q];
 
44
    }
 
45
 
 
46
  free_block(TMP0);
 
47
  free_block(TMP1);
 
48
}