[arrayfire] 347/408: Fixing svd example to reflect the change in API
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.
commit 25975bbb2e323b92c8b927fa632e8b16a7f8aeba
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Tue Aug 25 08:47:23 2015 -0400
Fixing svd example to reflect the change in API
---
examples/lin_algebra/svd.cpp | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/examples/lin_algebra/svd.cpp b/examples/lin_algebra/svd.cpp
index 070d74b..964bee7 100644
--- a/examples/lin_algebra/svd.cpp
+++ b/examples/lin_algebra/svd.cpp
@@ -23,17 +23,21 @@ int main(int argc, char* argv[])
float h_buffer[] = {1, 4, 2, 5, 3, 6 }; // host array
array in(2, 3, h_buffer); // copy host data to device
- print("in", in);
- array s;
array u;
+ array s_vec;
array vt;
- printf("Running svd");
- svd(s, u, vt, in);
- print("in", in);
- print("s", s);
- print("u", u);
- print("vt", vt);
+ svd(u, s_vec, vt, in);
+
+ array s_mat = diag(s_vec, 0, false);
+ array in_recon = matmul(u, s_mat, vt(seq(2), span));
+
+ af_print(in);
+ af_print(s_vec);
+ af_print(u);
+ af_print(s_mat);
+ af_print(vt);
+ af_print(in_recon);
} catch (af::exception& e) {
fprintf(stderr, "%s\n", e.what());
--
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