MIDAPACK - MIcrowave Data Analysis PACKage  1.1b
Parallel software tools for high performance CMB DA analysis
 All Data Structures Files Functions Variables Typedefs Groups Pages
toeplitz_devtools.c
Go to the documentation of this file.
1 
43 #include <stdlib.h>
44 #include <stdio.h>
45 #include <math.h>
46 #include "toeplitz.h"
47 #include <cblas.h>
48 #include <time.h>
49 
50 //
51 //dev tools for cblas and print - fd@apc
52 
53 int stmm_cblas(int n_loc, int m_loc, double *T2_loc, double *V, double *TV2) {
54 
55  cblas_dgemm (CblasColMajor, CblasNoTrans,CblasNoTrans, n_loc, m_loc, n_loc, 1, T2_loc, n_loc, (V), n_loc, 1, TV2, n_loc);
56 
57  return 0;
58 }
59 
60 
61 
62 // Build full Toeplitz matrix needed for cblas computation
63 int build_full_Toeplitz(int n_loc, double *T_loc, int lambda_loc, double *T2_loc) {
64 
65  int i,j;
66 
67  for (j=0;j<n_loc;j++) { //reset all the matrix to zeros
68  for(i=0;i<n_loc;i++) {
69  T2_loc[j*n_loc+i] = 0;
70  }}
71 
72  for (j=0;j<n_loc;j++){ // Full Toeplitz matrix needed for cblas computation
73  for (i=0;i<lambda_loc;i++){
74  if (j-i>=0)
75  T2_loc[j*n_loc+j-i] = T_loc[i];
76  if (j+i<n_loc)
77  T2_loc[j*n_loc+j+i] = T_loc[i]; }}
78 
79 
80  return 0;
81 }
82 
83 
84 
85 int print_full_Toeplitz(int n_loc, double *T2_loc) {
86 
87  int i,j;
88 
89  FILE *file;
90  file = stdout;
91 
92  for(i=0;i<n_loc;i++) {
93  for(j=0;j<n_loc;j++) {
94  fprintf(file, "%.1f\t", T2_loc[i+j*n_loc]);
95  }
96  fprintf(file, "\n");
97  }
98 
99 
100  return 0;
101 }
102 
103 
104 
105 int print_full_matrix(int n_loc, int m_loc, double *Mat) {
106 
107  int i,j;
108 
109  FILE *file;
110  file = stdout;
111 
112  for(i=0;i<n_loc;i++) {
113  for(j=0;j<m_loc;j++) {
114  fprintf(file, "%.1f\t", Mat[i+j*n_loc]);
115  }
116  fprintf(file, "\n");
117  }
118 
119 
120  return 0;
121 }
122 
123