Message Boards Message Boards

0
|
1034 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

CCodeGenerator error with Subscript

Posted 1 year ago

I am suffering from a CCodeGenerate error when a variable is defined using subscripts.

A simplified reproduction code is shown below.

<< CCodeGenerator`

(* good *)
f = x^2+y^2
CCodeStringGenerate[Compile[{x, y}, Evaluate @ f], "test"]

(* bad *)
x0 = Subscript[x,0]
x1 = Subscript[x,1]
f = x0^2+x1^2
CCodeStringGenerate[Compile[{x0, x1}, Evaluate @ f], "test"]

The errors that occur are as follows.

    CCodeGenerate::wmreq: The expression Function[{x0, x1}, x ] requires Mathematica to be evaluated.   The function will be generated but can be expected to fail with a nonzero error code when executed.
                                                             0

Is there a mistake in my use of subscript?

POSTED BY: A Kim
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract