46 #define __FUNC__ "matvec_euclid_seq"
48 matvec_euclid_seq (
int n,
int *rp,
int *cval,
double *aval,
double *x,
51 START_FUNC_DH
int i, j;
56 SET_V_ERROR (
"only for sequential case!\n");
59 for (i = 0; i < n; ++i)
64 for (j = from; j < to; ++j)
67 sum += (aval[j] * x[col]);
75 #define __FUNC__ "Axpy"
77 Axpy (
int n,
double alpha,
double *x,
double *y)
81 for (i = 0; i < n; ++i)
83 y[i] = alpha * x[i] + y[i];
89 #define __FUNC__ "CopyVec"
91 CopyVec (
int n,
double *xIN,
double *yOUT)
95 for (i = 0; i < n; ++i)
103 #define __FUNC__ "ScaleVec"
105 ScaleVec (
int n,
double alpha,
double *x)
109 for (i = 0; i < n; ++i)
116 #define __FUNC__ "InnerProd"
118 InnerProd (
int n,
double *x,
double *y)
120 START_FUNC_DH
double result, local_result = 0.0;
124 for (i = 0; i < n; ++i)
126 local_result += x[i] * y[i];
131 MPI_Allreduce (&local_result, &result, 1, MPI_DOUBLE, MPI_SUM, comm_dh);
135 result = local_result;
138 END_FUNC_VAL (result)}
141 #define __FUNC__ "Norm2"
143 Norm2 (
int n,
double *x)
145 START_FUNC_DH
double result, local_result = 0.0;
148 for (i = 0; i < n; ++i)
150 local_result += (x[i] * x[i]);
155 MPI_Allreduce (&local_result, &result, 1, MPI_DOUBLE, MPI_SUM, comm_dh);
159 result = local_result;
161 result = sqrt (result);
162 END_FUNC_VAL (result)}