summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-06-13 12:05:43 +0200
committerAnton Khirnov <anton@khirnov.net>2019-06-14 16:10:14 +0200
commitebf0e97dbfe895c66226ae264930a6e556f1768b (patch)
tree68a8a87974d478248d3ca8122b73d21af7e1947c
parent3d02e1b61d6aa3e2c4c9be4e0f55dd7d2046dabb (diff)
hackswip
-rw-r--r--ell_grid_solve.c2
-rw-r--r--mg2d.c2
-rw-r--r--ndarray.c4
-rw-r--r--transfer.c4
4 files changed, 8 insertions, 4 deletions
diff --git a/ell_grid_solve.c b/ell_grid_solve.c
index 57f6340..735f849 100644
--- a/ell_grid_solve.c
+++ b/ell_grid_solve.c
@@ -446,7 +446,7 @@ static int exact_arrays_alloc(EGSContext *ctx)
goto fail;
}
- ret = mg2di_bicgstab_context_alloc(&e->bicgstab, e->N, 64);
+ ret = mg2di_bicgstab_context_alloc(&e->bicgstab, e->N, 4);
if (ret < 0)
goto fail;
diff --git a/mg2d.c b/mg2d.c
index 9775c16..ad3e1e6 100644
--- a/mg2d.c
+++ b/mg2d.c
@@ -899,7 +899,7 @@ static int mg_levels_init(MG2DContext *ctx)
if (ctx->fd_stencil == 1)
op_restrict = GRID_TRANSFER_FW_2;
else
- op_restrict = GRID_TRANSFER_FW_3;
+ op_restrict = GRID_TRANSFER_FW_1;
} else {
op_restrict = op_interp;
}
diff --git a/ndarray.c b/ndarray.c
index dee985c..614e3fe 100644
--- a/ndarray.c
+++ b/ndarray.c
@@ -78,6 +78,10 @@ int mg2di_ndarray_alloc(NDArray **result, unsigned int dims,
if (flags & NDARRAY_ALLOC_ZERO)
memset(a->priv->data, 0, a->priv->alloc_size);
+ for (int i = 0; i < dims; i++)
+ if (size[i] == 1)
+ a->priv->stride[i] = 0;
+
a->dims = dims;
a->data = a->priv->data;
diff --git a/transfer.c b/transfer.c
index 9c5e125..0ea9413 100644
--- a/transfer.c
+++ b/transfer.c
@@ -422,7 +422,7 @@ int mg2di_gt_init(GridTransferContext *ctx)
double src_start, src_end, dst_start, dst_end;
if (ctx->src.step[i] <= 0.0 || ctx->dst.step[i] <= 0.0 ||
- ctx->src.size[i] < 2 || ctx->dst.size[i] < 1)
+ ctx->src.size[i] < 1 || ctx->dst.size[i] < 1)
return -EINVAL;
src_start = ctx->src.start[i] * ctx->src.step[i] - ctx->extrapolate_distance;
@@ -430,7 +430,7 @@ int mg2di_gt_init(GridTransferContext *ctx)
dst_start = ctx->dst.start[i] * ctx->dst.step[i];
dst_end = (ctx->dst.start[i] + ctx->dst.size[i] - 1) * ctx->dst.step[i];
- if (src_start >= src_end || dst_start < src_start || dst_end > src_end)
+ if (src_start > src_end || dst_start < src_start || dst_end > src_end)
return -EINVAL;
}