getspams / spams-R

R interface for SPAMS (SPArse Modeling Software)
https://thoth.inrialpes.fr/people/mairal/spams/
GNU General Public License v3.0
1 stars 1 forks source link

Error in dims - 1L : non-numeric argument to binary operator: omp() #3

Open hansk0812 opened 11 months ago

hansk0812 commented 11 months ago

I'm trying to run the example from the documentation: https://thoth.inrialpes.fr/people/mairal/spams/doc-R/html/index.html and I'm running into the following error.

X = matrix(rnorm(64 * 100000),nrow = 64,ncol = 100000,byrow = FALSE)
D = matrix(rnorm(64 * 200),nrow = 64,ncol = 200,byrow = FALSE)
D = D / matrix(rep(sqrt(colSums(D*D)),nrow(D)),nrow(D),ncol(D),byrow=T)
L = 10
eps =0.1
numThreads = -1

tic = proc.time()
alpha = spams.omp(X,D,L=L,eps=eps,return_reg_path = FALSE,numThreads = numThreads)
tac = proc.time()
t = (tac - tic)[['elapsed']]
print("%f signals processed per second\n",as.double(ncol(X)) / t)

########################################
# Regularization path of a single signal
########################################
X = matrix(rnorm(64 * 1),nrow = 64,ncol = 1,byrow = FALSE)
D = matrix(rnorm(64 * 10),nrow = 64,ncol = 10,byrow = FALSE)
D = D / matrix(rep(sqrt(colSums(D*D)),nrow(D)),nrow(D),ncol(D),byrow=T)
L = 5
res = spams.omp(X,D,L = L,eps = eps,return_reg_path = TRUE,numThreads = numThreads)
Error in dims - 1L : non-numeric argument to binary operator

I've checked the input types like so:

> class(X); class(D); class(L); class(eps); class(numThreads)
[1] "matrix"
[1] "matrix"
[1] "numeric"
[1] "numeric"
[1] "numeric"
gdurif commented 11 months ago

Hi @hansk0812 , thanks for the report, we will investigate the issue and get back to you ASAP. Best