3
#include <libciomr/libciomr.h>
7
** transone(): Transform a packed symmetric matrix.
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
17
** Written for new transqt module
21
#define INDEX(i,j) ((i>j) ? (ioff[(i)]+(j)) : (ioff[(j)]+(i)))
23
void transone(int m, int n, double *input, double *output, double **C, int nc, int *order, int *ioff)
26
double **TMP0, **TMP1;
28
TMP0 = block_matrix(m,m);
29
TMP1 = block_matrix(m,m);
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];
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);
41
for(q=0; q <= p; q++) {
42
pq = INDEX(order[p],order[q]);
43
output[pq] = TMP0[p][q];