Matrix multiplication compile error


#1

Operating System: windows 7
Python Version: 3.6
Interface Version: pystan 2.15.0
Compiler/Toolkit: spyder

I got an error and could not figure out what is wrong. Can you guys help me what is wrong in the line I added with the comment ?

pystan_code3 = “”"
data {
int<lower=0> Nx;
int<lower=0> Ny;
matrix[Ny,Nx] A;
//vector[Ny] A[Nx];
vector[Ny] s;
}
transformed data {
}
parameters {
// simplex[Nx] m;
vector[Nx] m;
}
transformed parameters {
}
model {
vector[3] y;

y[1] = 0.5;
y[2] = 0.4;
y[3] = 0.1;

//y ~ normal( m , 0.01);  // This line works
s ~ normal( A*m , 0.01);  // This line causes compile errors

}
generated quantities {
}
"""


#2

I think I can guess what hte error looks like but I’d rather not. Could you post the entire error message?


#3

Here it is::

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_b08a5711672c38a96d4882e840aa9f58 NOW.
Traceback (most recent call last):

File “”, line 46, in
data=stan_dat, iter=2000, chains=1)

File “”, line 11, in stan_cache
sm = pystan.StanModel(model_code=model_code)

File “C:\Anaconda2\envs\myVirPython361\lib\site-packages\pystan\model.py”, line 311, in init
build_extension.run()

File “C:\Anaconda2\envs\myVirPython361\lib\distutils\command\build_ext.py”, line 339, in run
self.build_extensions()

File “C:\Anaconda2\envs\myVirPython361\lib\distutils\command\build_ext.py”, line 448, in build_extensions
self._build_extensions_serial()

File “C:\Anaconda2\envs\myVirPython361\lib\distutils\command\build_ext.py”, line 473, in _build_extensions_serial
self.build_extension(ext)

File “C:\Anaconda2\envs\myVirPython361\lib\distutils\command\build_ext.py”, line 533, in build_extension
depends=ext.depends)

File “C:\Anaconda2\envs\myVirPython361\lib\distutils_msvccompiler.py”, line 384, in compile
raise CompileError(msg)

CompileError: command ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe’ failed with exit status 2


#4

I tested with Nx = 3, Ny = 5 and the code is not compiled. Please let me know what I am missing here! Thank you very much :)


#5

This is probably due to bug in MSVC. Matrix and vector operations do not work on windows. I do not know if we have any solution to this problem other than virtual machine / docker.

see


and


#6

I see. good to know this. Hope it is fixed soon. Thank you


#7

I don’t think anyone on our side is actively working to improve MSVC support, so I wouldn’t expect patches any time soon.