1 /*  Copyright (C) 2003-2007  CAMP
2  *  Please see the accompanying LICENSE file for further information. */
3 
4 #include <string.h>
5 #include "bmgs.h"
6 
Z(bmgs_cut)7 void Z(bmgs_cut)(const T* a, const int n[3], const int c[3],
8                  T* b, const int m[3])
9 {
10   a += c[2] + (c[1] + c[0] * n[1]) * n[2];
11   for (int i0 = 0; i0 < m[0]; i0++)
12     {
13       for (int i1 = 0; i1 < m[1]; i1++)
14         {
15           memcpy(b, a, m[2] * sizeof(T));
16           a += n[2];
17           b += m[2];
18         }
19       a += n[2] * (n[1] - m[1]);
20     }
21 }
22 
23 #ifdef BMGSCOMPLEX
bmgs_cutmz(const double_complex * a,const int sizea[3],const int start[3],double_complex * b,const int sizeb[3],double_complex p)24 void bmgs_cutmz(const double_complex* a, const int sizea[3],
25 		const int start[3],
26 		double_complex* b, const int sizeb[3], double_complex p)
27 {
28   a += start[2] + (start[1] + start[0] * sizea[1]) * sizea[2];
29   for (int i0 = 0; i0 < sizeb[0]; i0++)
30     {
31       for (int i1 = 0; i1 < sizeb[1]; i1++)
32 	{
33 	  for (int i2 = 0; i2 < sizeb[2]; i2++)
34 	    b[i2] = p * a[i2];
35 	  a += sizea[2];
36 	  b += sizeb[2];
37 	}
38       a += sizea[2] * (sizea[1] - sizeb[1]);
39     }
40 }
41 #endif
42