hennequin-lab / optimal-preparation

Optimal anticipatory controlas a theory of motor preparation: a thalamo-cortical circuit model
0 stars 0 forks source link

Singular matrix problem in 63th line of optimal-preparation/construct/setup.ml #1

Closed soychae93 closed 3 years ago

soychae93 commented 3 years ago

Hi, first of all, thank you for sharing your amazing work! I saw Ocaml for the first time, and I'm converting your code to python because it is familiar to me. I met a problem so I want to ask you that I understood your code correctly. The problem is python could not find inverse matrix of (xstars_motor_t @ xstars_motor) in 63rd line of optimal-preparation/construct/setup.ml. As I understand, the 63rd line is for finding h that transforming x_stars to the identity matrix (xh = I) so that whatever multiplying to new c, the result will be 0 (no muscle activities). I guess the singular matrix problem comes because half of the columns in xstars_motor are spontaneous activities, which follows the same Gaussian distribution (most of the elements of xstars_motor_t *@ xstars_motor is constant). Do I understand your code correctly? If I do, this problem would be precision or other difference between Ocaml and Python so I need to find another approximation method. Thanks.

soychae93 commented 3 years ago

OMG.. I've been thinking about it for days, but I knew the problem as soon as I wrote. The xstars_motor should be a matrix size 160 by 9 (8 movements + just a single spontaneous activity vector). sorry for taking your time

tachukao commented 3 years ago

Hi @soychae93, I'm really glad you are reproducing the code in python. If you have any other questions or if I can be of assistance in anyway, please don't hesitate to reach out.

soychae93 commented 3 years ago

Thank you for saying that. I will contact you if I meet another problem. I will close this comment. Thank you!