[arrayfire] 13/75: Bugfixes, code clean up of plot
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:01:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.
commit ff275362b8c80b9352b5766c547bde0416a51ecb
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Tue Feb 9 16:19:38 2016 -0500
Bugfixes, code clean up of plot
- Fixes issues where X and Y indices are non column vectors
- Avoids reorder by using row vectors
---
src/api/c/plot.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/api/c/plot.cpp b/src/api/c/plot.cpp
index 273d922..a812947 100644
--- a/src/api/c/plot.cpp
+++ b/src/api/c/plot.cpp
@@ -39,14 +39,19 @@ fg::Plot* setup_plot(const af_array X, const af_array Y, fg::PlotType type, fg::
dim4 rdims(1, 0, 2, 3);
- Array<T> Z = join(1, xIn, yIn);
- Array<T> P = reorder(Z, rdims);
+ dim_t elements = xIn.elements();
+ dim4 rowDims = dim4(1, elements, 1, 1);
- ArrayInfo Xinfo = getInfo(X);
- af::dim4 X_dims = Xinfo.dims();
+ // Force the vectors to be row vectors
+ // This ensures we can use join(0,..) and skip reorder
+ xIn.modDims(rowDims);
+ yIn.modDims(rowDims);
+
+ // join along first dimension, skip reorder
+ Array<T> P = join(0, xIn, yIn);
ForgeManager& fgMngr = ForgeManager::getInstance();
- fg::Plot* plot = fgMngr.getPlot(X_dims.elements(), getGLType<T>(), type, marker);
+ fg::Plot* plot = fgMngr.getPlot(elements, getGLType<T>(), type, marker);
plot->setColor(1.0, 0.0, 0.0);
plot->setAxesLimits(xmax, xmin, ymax, ymin);
plot->setAxesTitles("X Axis", "Y Axis");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list