<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Error, (in printtab[CodeGeneration</title>
    <link>http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Fri, 12 Jun 2026 21:39:27 GMT</lastBuildDate>
    <pubDate>Fri, 12 Jun 2026 21:39:27 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Error, (in printtab[CodeGeneration</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Error, (in printtab[CodeGeneration</title>
      <link>http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration</link>
    </image>
    <item>
      <title>local variables cannot have Array types</title>
      <link>http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration?ref=Feed:MaplePrimes:Error, (in printtab[CodeGeneration:Comments#answer129336</link>
      <itunes:summary>&lt;p&gt;The Compiler demands that&amp;nbsp;local variables cannot have Array types, but your procedure references the entries of the locals E, V, and s as if they were 1-dimensional Arrays. Hence the procedure is doing something that the Compiler does not support.&lt;/p&gt;
&lt;p&gt;Another way to say it is that&amp;nbsp;local variables cannot be Arrays or Vector or Matrices, for the Compiler to accept the procedure. (And lists and sets and tables are not allowed, since Arrays, Vectors, and Matrices of hardware datatype are the indexable structures that the Compiler admits.)&lt;/p&gt;
&lt;p&gt;If you read the help page &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=Compiler"&gt;Compiler&lt;/a&gt;&amp;nbsp;you can see early on where it says, "Procedures that return arrays or allocate new arrays cannot be translated." That means that local variables cannot get new Array/Vector/Matrix assigned to them, inside the procedure.&lt;/p&gt;
&lt;p&gt;The correct way to do what you are trying is to create all the Arrays outside of the procedure, and then to pass them in as arguments. This means locals V, E, s, and also your current global u.&lt;/p&gt;
&lt;p&gt;It's then your choice whether to have the procedure continue to return s[Nr-1], or to just return NULL (since outside of procedure X you have access to the Array you pass in for argument s, and it gets updated in-place).&lt;/p&gt;
&lt;p&gt;You should consider making the other globals into arguments too. Using globals when not necessary just leads to sloppy code with problems, IMNSHO. But also, for the Compiler it means callbacks to main Maple and conversions from software to hardware scalar types, and if that occurs inside a loop (not your situation here...) that can be costly (relative to compiled operations).&lt;/p&gt;
&lt;p&gt;Also, if you are going to use the Compiler than give your procedure's arguments and locals the type information (using :: double-colon) the makes things unambiguous. Don't rely on the Compiler to magically guess that you intend on using this as a float and that as an integer, etc, because if deduced wrongly the code may compute wrongly through no fault of its own.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;The Compiler demands that&amp;nbsp;local variables cannot have Array types, but your procedure references the entries of the locals E, V, and s as if they were 1-dimensional Arrays. Hence the procedure is doing something that the Compiler does not support.&lt;/p&gt;
&lt;p&gt;Another way to say it is that&amp;nbsp;local variables cannot be Arrays or Vector or Matrices, for the Compiler to accept the procedure. (And lists and sets and tables are not allowed, since Arrays, Vectors, and Matrices of hardware datatype are the indexable structures that the Compiler admits.)&lt;/p&gt;
&lt;p&gt;If you read the help page &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=Compiler"&gt;Compiler&lt;/a&gt;&amp;nbsp;you can see early on where it says, "Procedures that return arrays or allocate new arrays cannot be translated." That means that local variables cannot get new Array/Vector/Matrix assigned to them, inside the procedure.&lt;/p&gt;
&lt;p&gt;The correct way to do what you are trying is to create all the Arrays outside of the procedure, and then to pass them in as arguments. This means locals V, E, s, and also your current global u.&lt;/p&gt;
&lt;p&gt;It's then your choice whether to have the procedure continue to return s[Nr-1], or to just return NULL (since outside of procedure X you have access to the Array you pass in for argument s, and it gets updated in-place).&lt;/p&gt;
&lt;p&gt;You should consider making the other globals into arguments too. Using globals when not necessary just leads to sloppy code with problems, IMNSHO. But also, for the Compiler it means callbacks to main Maple and conversions from software to hardware scalar types, and if that occurs inside a loop (not your situation here...) that can be costly (relative to compiled operations).&lt;/p&gt;
&lt;p&gt;Also, if you are going to use the Compiler than give your procedure's arguments and locals the type information (using :: double-colon) the makes things unambiguous. Don't rely on the Compiler to magically guess that you intend on using this as a float and that as an integer, etc, because if deduced wrongly the code may compute wrongly through no fault of its own.&lt;/p&gt;</description>
      <guid>129336</guid>
      <pubDate>Thu, 05 Jan 2012 06:29:49 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
    <item>
      <title>hm ...</title>
      <link>http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration?ref=Feed:MaplePrimes:Error, (in printtab[CodeGeneration:Comments#answer129355</link>
      <itunes:summary>&lt;p&gt;Have not worked it out, but I neither would use indexed variables nor arrays for&lt;br&gt;storage and also think, that 1 loop is enough, like this&lt;br&gt;&lt;br&gt;for ...&lt;br&gt;&lt;br&gt;&amp;nbsp; v_new = ...&lt;br&gt;&amp;nbsp; E_new = ...&lt;br&gt;&amp;nbsp; s_new = ...&lt;br&gt;&lt;br&gt;&amp;nbsp; s_old = s_new, E_old = E_ new, ...&lt;br&gt;&lt;br&gt;end for&lt;br&gt;&lt;br&gt;Also you do not use previous values of your u, no updates while looping ?&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Have not worked it out, but I neither would use indexed variables nor arrays for&lt;br&gt;storage and also think, that 1 loop is enough, like this&lt;br&gt;&lt;br&gt;for ...&lt;br&gt;&lt;br&gt;&amp;nbsp; v_new = ...&lt;br&gt;&amp;nbsp; E_new = ...&lt;br&gt;&amp;nbsp; s_new = ...&lt;br&gt;&lt;br&gt;&amp;nbsp; s_old = s_new, E_old = E_ new, ...&lt;br&gt;&lt;br&gt;end for&lt;br&gt;&lt;br&gt;Also you do not use previous values of your u, no updates while looping ?&lt;/p&gt;</description>
      <guid>129355</guid>
      <pubDate>Thu, 05 Jan 2012 20:31:11 Z</pubDate>
      <itunes:author>Axel Vogt</itunes:author>
      <author>Axel Vogt</author>
    </item>
    <item>
      <title>So Pagan, could you please have a look at</title>
      <link>http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration?ref=Feed:MaplePrimes:Error, (in printtab[CodeGeneration:Comments#comment129346</link>
      <itunes:summary>&lt;p&gt;So Pagan, could you please have a look at the two attached file.&lt;br&gt;The data is in the first file and the Maple caluclations in the second.&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=129346/428117/GARCH_Estimation_(Hu.xls"&gt;GARCH_Estimation_(Hu.xls&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href="/view.aspx?sf=129346/428117/pagan.mw"&gt;pagan.mw&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I tried to do as you said but I still get an error message. How would you solve that? &lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;So Pagan, could you please have a look at the two attached file.&lt;br&gt;The data is in the first file and the Maple caluclations in the second.&lt;/p&gt;
&lt;p&gt;&lt;a href="/view.aspx?sf=129346/428117/GARCH_Estimation_(Hu.xls"&gt;GARCH_Estimation_(Hu.xls&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href="/view.aspx?sf=129346/428117/pagan.mw"&gt;pagan.mw&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I tried to do as you said but I still get an error message. How would you solve that? &lt;/p&gt;</description>
      <guid>129346</guid>
      <pubDate>Thu, 05 Jan 2012 16:51:38 Z</pubDate>
      <itunes:author>alex_01</itunes:author>
      <author>alex_01</author>
    </item>
    <item>
      <title>global u</title>
      <link>http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration?ref=Feed:MaplePrimes:Error, (in printtab[CodeGeneration:Comments#comment129348</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration#comment129346"&gt;@alex_01&lt;/a&gt; You need to add one more argument to `f`, for u::Array(datatype=float[8]) which was previously declared as a global.&lt;/p&gt;
&lt;p&gt;If I add that, then `f` itself Compiles.&lt;/p&gt;
&lt;p&gt;But GRADIENT(f) produces an error about array bounds, which you'd have to fix before you could Compile that.&lt;/p&gt;
&lt;p&gt;The code of `f` looks logically wrong in some other respects. How can the entries of V be used if you haven't given them any values? At one point, you divide by V[i] which is going to return undefined if V[i] is zero.&lt;/p&gt;
&lt;p&gt;I am not sure that `kuk` is going to have the correct form for the (commented out) style of call to NLPSolve.&lt;/p&gt;
&lt;p&gt;I would try getting the Optimization call to work first (prefereably under evalhf mode as indicated by Optimization's userinfo, but in any event get it working in some usual way) and think about compiling it only later.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/129335-Error-in-PrinttabCodeGeneration#comment129346"&gt;@alex_01&lt;/a&gt; You need to add one more argument to `f`, for u::Array(datatype=float[8]) which was previously declared as a global.&lt;/p&gt;
&lt;p&gt;If I add that, then `f` itself Compiles.&lt;/p&gt;
&lt;p&gt;But GRADIENT(f) produces an error about array bounds, which you'd have to fix before you could Compile that.&lt;/p&gt;
&lt;p&gt;The code of `f` looks logically wrong in some other respects. How can the entries of V be used if you haven't given them any values? At one point, you divide by V[i] which is going to return undefined if V[i] is zero.&lt;/p&gt;
&lt;p&gt;I am not sure that `kuk` is going to have the correct form for the (commented out) style of call to NLPSolve.&lt;/p&gt;
&lt;p&gt;I would try getting the Optimization call to work first (prefereably under evalhf mode as indicated by Optimization's userinfo, but in any event get it working in some usual way) and think about compiling it only later.&lt;/p&gt;</description>
      <guid>129348</guid>
      <pubDate>Thu, 05 Jan 2012 18:55:27 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
  </channel>
</rss>