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