46 #define __FUNC__ "matvec_euclid_seq"
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"
109 for (i = 0; i < n; ++i)
116 #define __FUNC__ "InnerProd"
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;
141 #define __FUNC__ "Norm2"
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);
double Norm2(int n, double *x)
double InnerProd(int n, double *x, double *y)
#define END_FUNC_VAL(retval)
void Axpy(int n, double alpha, double *x, double *y)
void ScaleVec(int n, double alpha, double *x)
void matvec_euclid_seq(int n, int *rp, int *cval, double *aval, double *x, double *y)
void CopyVec(int n, double *xIN, double *yOUT)