summaryrefslogtreecommitdiff
path: root/examples/devel/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/devel/functions.c')
-rw-r--r--examples/devel/functions.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/examples/devel/functions.c b/examples/devel/functions.c
deleted file mode 100644
index 6885a0e..0000000
--- a/examples/devel/functions.c
+++ /dev/null
@@ -1,34 +0,0 @@
1typedef struct { double r, i; } doublecomplex;
2
3#define DVEC(A) int A##n, double*A##p
4#define CVEC(A) int A##n, doublecomplex*A##p
5#define DMAT(A) int A##r, int A##c, double*A##p
6#define CMAT(A) int A##r, int A##c, doublecomplex*A##p
7
8#define AT(M,r,c) (M##p[(r)*sr+(c)*sc])
9
10/*-----------------------------------------------------*/
11
12int c_scale_vector(double s, DVEC(x), DVEC(y)) {
13 int k;
14 for (k=0; k<=yn; k++) {
15 yp[k] = s*xp[k];
16 }
17 return 0;
18}
19
20/*-----------------------------------------------------*/
21
22int c_diag(int ro, DMAT(m),DVEC(y),DMAT(z)) {
23 int i,j,sr,sc;
24 if (ro==1) { sr = mc; sc = 1;} else { sr = 1; sc = mr;}
25 for (j=0; j<yn; j++) {
26 yp[j] = AT(m,j,j);
27 }
28 for (i=0; i<mr; i++) {
29 for (j=0; j<mc; j++) {
30 AT(z,i,j) = i==j?yp[i]:0;
31 }
32 }
33 return 0;
34}