Export a matrix in C form
- To: mathgroup at smc.vnet.net
- Subject: [mg89819] Export a matrix in C form
- From: Pavel Balaz <pavel.balaz at gmail.com>
- Date: Sat, 21 Jun 2008 05:32:03 -0400 (EDT)
Hi, I have a big matrix in Mathematica with elements given as function of several parameters. I would like to export this matrix to C/C++ in this general form. However, if I use CForm[], I obtain something like List(List(cos(x),sin(y), ...), List(exp(x*y), ...), ...) I have never seen such C/C++ code :-( It is possible to save the matrix element to a single file containing definitions all matrix elements in the form double M[16][16]; M[0][0]=cos(x); M[0][1]=sin(x); ... Thank you very much.