📄 y2x.cpp
字号:
#include <stdio.h>
#include "..\defs.h"
void y2x(
double **xvecs, /* pointer to list of x-vectors */
int ndims, /* number of divisions to make (# xvecs) */
int nmyvtxs, /* number of vertices I own (lenght xvecs) */
double *wsqrt /* sqrt of vertex weights */
)
/* Convert from y to x by dividing by wsqrt. */
{
double *wptr; /* loops through wsqrt */
double *xptr; /* loops through elements of a xvec */
int i, j; /* loop counters */
if (wsqrt == NULL)
return;
for (i = 1; i <= ndims; i++) {
xptr = xvecs[i];
wptr = wsqrt;
for (j = nmyvtxs; j; j--) {
*(++xptr) /= *(++wptr);
}
}
}
void x2y(
double **yvecs, /* pointer to list of y-vectors */
int ndims, /* number of divisions to make (# yvecs) */
int nmyvtxs, /* number of vertices I own (lenght yvecs) */
double *wsqrt /* sqrt of vertex weights */
)
/* Convert from x to y by multiplying by wsqrt. */
{
double *wptr; /* loops through wsqrt */
double *yptr; /* loops through elements of a yvec */
int i, j; /* loop counters */
if (wsqrt == NULL)
return;
for (i = 1; i <= ndims; i++) {
yptr = yvecs[i];
wptr = wsqrt;
for (j = nmyvtxs; j; j--) {
*(++yptr) *= *(++wptr);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -