summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/R/pca.R3
-rw-r--r--R/src/wrapper.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/R/R/pca.R b/R/R/pca.R
index 85782e4..7d0d742 100644
--- a/R/R/pca.R
+++ b/R/R/pca.R
@@ -1,4 +1,4 @@
-pca <- function(x, k=1,q=0.5){
+pca <- function(x, k=1, q=0.5, iters=10000){
n <- nrow(x)
d <- ncol(x)
B <- matrix(0, n, k)
@@ -8,6 +8,7 @@ pca <- function(x, k=1,q=0.5){
res <- .C("pca_wrapper",
n=as.integer(n),
d=as.integer(d),
+ iters=as.integer(iters),
q=as.numeric(q),
k=as.integer(k),
X=as.numeric(t(x)),
diff --git a/R/src/wrapper.c b/R/src/wrapper.c
index dd7bce1..52c1192 100644
--- a/R/src/wrapper.c
+++ b/R/src/wrapper.c
@@ -1,7 +1,7 @@
#include "pca.h"
void
-pca_wrapper(int *n, int *d, double *q, int *k, double *X, double *B, double *U, double *l) {
+pca_wrapper(int *n, int *d, int *iters, double *q, int *k, double *X, double *B, double *U, double *l) {
struct futhark_context_config *cfg = futhark_context_config_new();
struct futhark_context *ctx = futhark_context_new(cfg);
@@ -11,7 +11,7 @@ pca_wrapper(int *n, int *d, double *q, int *k, double *X, double *B, double *U,
struct futhark_f64_2d *Bf;
struct futhark_f64_2d *Uf;
- futhark_entry_pcaWithQuantile(ctx, &Bf, &Uf, &Yf, l, *q, *k, Xf);
+ futhark_entry_pcaWithQuantile(ctx, &Bf, &Uf, &Yf, l, *iters, *q, *k, Xf);
futhark_context_sync(ctx);
futhark_values_f64_2d(ctx, Bf, B);
futhark_values_f64_2d(ctx, Uf, U);