projects
/
iramuteq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new find clusters + spirale
[iramuteq]
/
Rscripts
/
mysvd.R
diff --git
a/Rscripts/mysvd.R
b/Rscripts/mysvd.R
index
d936196
..
596e55b
100644
(file)
--- a/
Rscripts/mysvd.R
+++ b/
Rscripts/mysvd.R
@@
-21,13
+21,24
@@
write.sparse <- function (m, to) {
}
}
}
}
}
}
+
+write.sparse2 <- function(m, to) {
+ stopifnot(inherits(m, "dgCMatrix"))
+ fh <- file(to, open="w")
+
+ wl <- function(...) cat(..., "\n", file=fh)
+ wl(dim(m), length(m@x))
+
+}
+
+print('FIXME : svdpath hardcoded !!')
my.svd <- function(x, nu, nv) {
stopifnot(nu==nv)
rc <- system(paste("/usr/bin/svd -o /tmp/sout -d", nu, "/tmp/sparse.m"))
if (rc != 0)
stop("Couldn't run external svd code")
d <- scan("/tmp/sout-S", skip=1)
my.svd <- function(x, nu, nv) {
stopifnot(nu==nv)
rc <- system(paste("/usr/bin/svd -o /tmp/sout -d", nu, "/tmp/sparse.m"))
if (rc != 0)
stop("Couldn't run external svd code")
d <- scan("/tmp/sout-S", skip=1)
-#FIXME : sometimes,
libsvd
c doesn't find solution with 2 dimensions, but does with 3
+#FIXME : sometimes,
svdlib
c doesn't find solution with 2 dimensions, but does with 3
if (length(d)==1) {
nu <- nu + 1
rc <- system(paste("/usr/bin/svd -o /tmp/sout -d", nu, "/tmp/sparse.m"))
if (length(d)==1) {
nu <- nu + 1
rc <- system(paste("/usr/bin/svd -o /tmp/sout -d", nu, "/tmp/sparse.m"))