<?xml version="1.0" standalone="no"?>
<grammar name="C++" apsversion="3.0" ext="hpp">
   <!--List of all the functions supported by APS 3.0. All functions must be completely defined.-->
   <!--To generate Carriage Return Line Feeds (CrLf) use the token {CRLF} (curly braces included).-->
   <!--To generate Tabs use the token {TAB} (curly braces included).-->
   <!--To generate Spaces use the token {SPACE} (curly braces included).-->
   <!--The symbol ~ is an escape for the x in the definition of the functions.-->
   <!--The symbol @ is an escape for the y in the definition of the functions.-->
   <functions count="70">
      <function idx="0" symbol="+" terminals="2" uniontype="{tempvarname} {symbol}=">(x0+x1)</function>
      <function idx="1" symbol="-" terminals="2" uniontype="{tempvarname} {symbol}=">(x0-x1)</function>
      <function idx="2" symbol="*" terminals="2" uniontype="{tempvarname} {symbol}=">(x0*x1)</function>     
      <function idx="3" symbol="/" terminals="2" uniontype="{tempvarname} {symbol}=">(x0/x1)</function>
      <function idx="4" symbol="Mod" terminals="2" uniontype="">fmod(x0,x1)</function>
      <function idx="5" symbol="Pow" terminals="2" uniontype="">pow(x0,x1)</function>
      <function idx="6" symbol="Sqrt" terminals="1" uniontype="">sqrt(x0)</function>
      <function idx="7" symbol="Exp" terminals="1" uniontype="">e~p(x0)</function>
      <function idx="8" symbol="Pow10" terminals="1" uniontype="">pow(10,x0)</function>
      <function idx="9" symbol="Ln" terminals="1" uniontype="">log(x0)</function>
      <function idx="10" symbol="Log" terminals="1" uniontype="">log10(x0)</function>
      <function idx="11" symbol="Sig" terminals="1" uniontype="">apsLogi(x0)</function>
      <function idx="12" symbol="Floor" terminals="1" uniontype="">floor(x0)</function>
      <function idx="13" symbol="Ceil" terminals="1" uniontype="">ceil(x0)</function>
      <function idx="14" symbol="Abs" terminals="1" uniontype="">fabs(x0)</function>
      <function idx="15" symbol="Inv" terminals="1" uniontype="">(1/(x0))</function>
      <function idx="16" symbol="Nop" terminals="1" uniontype="">apsNop(x0)</function>
      <function idx="17" symbol="Neg" terminals="1" uniontype="">(-(x0))</function>
      <function idx="18" symbol="Sin" terminals="1" uniontype="">sin(x0)</function>
      <function idx="19" symbol="Cos" terminals="1" uniontype="">cos(x0)</function>
      <function idx="20" symbol="Tan" terminals="1" uniontype="">tan(x0)</function>
      <function idx="21" symbol="Csc" terminals="1" uniontype="">(1/sin(x0))</function>
      <function idx="22" symbol="Sec" terminals="1" uniontype="">(1/cos(x0))</function>
      <function idx="23" symbol="Cot" terminals="1" uniontype="">(1/tan(x0))</function>
      <function idx="24" symbol="Asin" terminals="1" uniontype="">asin(x0)</function>
      <function idx="25" symbol="Acos" terminals="1" uniontype="">acos(x0)</function>
      <function idx="26" symbol="Atan" terminals="1" uniontype="">atan(x0)</function>
      <function idx="27" symbol="Acsc" terminals="1" uniontype="">apsAcsc(x0)</function>
      <function idx="28" symbol="Asec" terminals="1" uniontype="">apsAsec(x0)</function>
      <function idx="29" symbol="Acot" terminals="1" uniontype="">apsAcot(x0)</function>
      <function idx="30" symbol="Sinh" terminals="1" uniontype="">sinh(x0)</function>
      <function idx="31" symbol="Cosh" terminals="1" uniontype="">cosh(x0)</function>
      <function idx="32" symbol="Tanh" terminals="1" uniontype="">tanh(x0)</function>
      <function idx="33" symbol="Csch" terminals="1" uniontype="">apsCsch(x0)</function>
      <function idx="34" symbol="Sech" terminals="1" uniontype="">apsSech(x0)</function>
      <function idx="35" symbol="Coth" terminals="1" uniontype="">apsCoth(x0)</function>
      <function idx="36" symbol="Asinh" terminals="1" uniontype="">apsAsinh(x0)</function>
      <function idx="37" symbol="Acosh" terminals="1" uniontype="">apsAcosh(x0)</function>
      <function idx="38" symbol="Atanh" terminals="1" uniontype="">apsAtanh(x0)</function>
      <function idx="39" symbol="Acsch" terminals="1" uniontype="">apsAcsch(x0)</function>
      <function idx="40" symbol="Asech" terminals="1" uniontype="">apsAsech(x0)</function>
      <function idx="41" symbol="Acoth" terminals="1" uniontype="">apsAcoth(x0)</function>
      <function idx="42" symbol="OR1" terminals="2" uniontype="">((x0&lt;0{SPACE}||{SPACE}x1&lt;0)?1:0)</function>
      <function idx="43" symbol="OR2" terminals="2" uniontype="">((x0>=0{SPACE}||{SPACE}x1>=0)?1:0)</function>
      <function idx="44" symbol="AND1" terminals="2" uniontype="">((x0&lt;0{SPACE}&amp;&amp;{SPACE}x1&lt;0)?1:0)</function>
      <function idx="45" symbol="AND2" terminals="2" uniontype="">((x0>=0{SPACE}&amp;&amp;{SPACE}x1>=0)?1:0)</function>
      <function idx="46" symbol="IFA1" terminals="2" uniontype="">(x0&lt;x1?x0:x1)</function>
      <function idx="47" symbol="IFA2" terminals="2" uniontype="">(x0>x1?x0:x1)</function>
      <function idx="48" symbol="IFA3" terminals="2" uniontype="">(x0&lt;=x1?x0:x1)</function>
      <function idx="49" symbol="IFA4" terminals="2" uniontype="">(x0>=x1?x0:x1)</function>
      <function idx="50" symbol="IFA5" terminals="2" uniontype="">(x0==x1?x0:x1)</function>
      <function idx="51" symbol="IFA6" terminals="2" uniontype="">(x0!=x1?x0:x1)</function>
      <function idx="52" symbol="IFB1" terminals="2" uniontype="">(x0&lt;x1?1:0)</function>
      <function idx="53" symbol="IFB2" terminals="2" uniontype="">(x0>x1?1:0)</function>
      <function idx="54" symbol="IFB3" terminals="2" uniontype="">(x0&lt;=x1?1:0)</function>
      <function idx="55" symbol="IFB4" terminals="2" uniontype="">(x0>=x1?1:0)</function>
      <function idx="56" symbol="IFB5" terminals="2" uniontype="">(x0==x1?1:0)</function>
      <function idx="57" symbol="IFB6" terminals="2" uniontype="">(x0!=x1?1:0)</function>
      <function idx="58" symbol="IFC1" terminals="3" uniontype="">(x0&lt;0?x1:x2)</function>
      <function idx="59" symbol="IFC2" terminals="3" uniontype="">(x0>0?x1:x2)</function>
      <function idx="60" symbol="IFC3" terminals="3" uniontype="">(x0&lt;=0?x1:x2)</function>
      <function idx="61" symbol="IFC4" terminals="3" uniontype="">(x0>=0?x1:x2)</function>
      <function idx="62" symbol="IFC5" terminals="3" uniontype="">(x0==0?x1:x2)</function>
      <function idx="63" symbol="IFC6" terminals="3" uniontype="">(x0!=0?x1:x2)</function>
      <function idx="64" symbol="IFD1" terminals="4" uniontype="">(x0&lt;x1?x2:x3)</function>
      <function idx="65" symbol="IFD2" terminals="4" uniontype="">(x0>x1?x2:x3)</function>
      <function idx="66" symbol="IFD3" terminals="4" uniontype="">(x0&lt;=x1?x2:x3)</function>
      <function idx="67" symbol="IFD4" terminals="4" uniontype="">(x0>=x1?x2:x3)</function>
      <function idx="68" symbol="IFD5" terminals="4" uniontype="">(x0==x1?x2:x3)</function>
      <function idx="69" symbol="IFD6" terminals="4" uniontype="">(x0!=x1?x2:x3)</function>   
</functions>
   
   <!-- Opening and Closing Statements -->
   <open></open>
   <close></close>
   
   <!-- The default header is applied to all non specified cases. -->
   <headers>
      <header type="default" replace="no">double apsModel(double d[]){CRLF}{</header>
      <header type="CL" replace="yes">int apsModel(double d[]){CRLF}{{CRLF}{TAB}const double ROUNDING_THRESHOLD = {set_ff#Threshold};{CRLF}</header>
   </headers>
   <constants>
      <constant type="default" replace="no">{TAB}const double {labelname} = {labelindex};{CRLF}</constant>
   </constants>
   <!-- The default temporary variable name is applied to all non specified cases. -->
   <tempvars>
      <tempvar type="default" typename="double" varname="dblTemp">double dblTemp = 0.0;</tempvar>
   </tempvars>
   <endline>;{CRLF}</endline>
   <!-- Number of TABs to add to each line in the code block -->
   <indent>1</indent>
   <!-- parenstype can be either 0->() or 1->[]. Defines the parenthesis used in arrays-->
   <parenstype>1</parenstype>
   <footers>
      <footer type="default" replace="no">return {tempvarname};{CRLF}}</footer>
      <footer type="CL" replace="no">return ({tempvarname} >= ROUNDING_THRESHOLD ? 1:0);{CRLF}}</footer>
   </footers>
   <helpers count="14">
<helper replaces="Logi">double apsLogi(double x) {CRLF}{{CRLF}{TAB}return 1/(1+exp(-x));{CRLF}}{CRLF}</helper>

<helper replaces="Nop">double apsNop(double x) {CRLF}{{CRLF}{TAB}return x;{CRLF}}{CRLF}</helper>

<helper replaces="Acsc">double apsAcsc(double x) {CRLF}{{CRLF}{TAB}int varSign = 0;{CRLF}{TAB}if (x &lt; 0) {CRLF}{TAB}{TAB}varSign = -1;{CRLF}{TAB}else{CRLF}{TAB}{{CRLF}{TAB}{TAB}if (x > 0){CRLF}{TAB}{TAB}{TAB}varSign = 1;{CRLF}{TAB}{TAB}else{CRLF}{TAB}{TAB}{TAB}varSign = 0;{CRLF}{TAB}}{CRLF}{TAB}return atan(x/sqrt(x*x-1))+(varSign-1)*(2*atan(1));{CRLF}}{CRLF}</helper>
	  
<helper replaces="Asec">double apsAsec(double x) {CRLF}{{CRLF}{TAB}int varSign = 0;{CRLF}{TAB}if (x &lt; 0) {CRLF}{TAB}{TAB}varSign = -1;{CRLF}{TAB}else{CRLF}{TAB}{{CRLF}{TAB}{TAB}if (x > 0){CRLF}{TAB}{TAB}{TAB}varSign = 1;{CRLF}{TAB}{TAB}else{CRLF}{TAB}{TAB}{TAB}varSign = 0;{CRLF}{TAB}}{CRLF}{TAB}return atan(x/sqrt(x*x-1))+varSign*(2*atan(1));{CRLF}}{CRLF}</helper>
	  
<helper replaces="Acot">double apsAcot(double x) {CRLF}{{CRLF}{TAB}return atan(x)+2*atan(1);{CRLF}}{CRLF}</helper>
	  
<helper replaces="Csch">double apsCsch(double x) {CRLF}{{CRLF}{TAB}return 2/(exp(x)-exp(-x));{CRLF}}{CRLF}</helper>
	  
<helper replaces="Sech">double apsSech(double x) {CRLF}{{CRLF}{TAB}return 2/(exp(x)+exp(-x));{CRLF}}{CRLF}</helper>
	  
<helper replaces="Coth">double apsCoth(double x) {CRLF}{{CRLF}{TAB}return (exp(x)+exp(-x))/(exp(x)-exp(-x));{CRLF}}{CRLF}</helper>
	  
<helper replaces="Asinh">double apsAsinh(double x) {CRLF}{{CRLF}{TAB}return log(x+sqrt(x*x+1));{CRLF}}{CRLF}</helper>
	  
<helper replaces="Acosh">double apsAcosh(double x) {CRLF}{{CRLF}{TAB}return log(x+sqrt(x*x-1));{CRLF}}{CRLF}</helper>
	  
<helper replaces="Atanh">double apsAtanh(double x) {CRLF}{{CRLF}{TAB}return log((1+x)/(1-x))/2;{CRLF}}{CRLF}</helper>
	  
<helper replaces="Acsch">double apsAcsch(double x) {CRLF}{{CRLF}{TAB}int varSign = 0;{CRLF}{TAB}if (x &lt; 0) {CRLF}{TAB}{TAB}varSign = -1;{CRLF}{TAB}else{CRLF}{TAB}{{CRLF}{TAB}{TAB}if (x > 0){CRLF}{TAB}{TAB}{TAB}varSign = 1;{CRLF}{TAB}{TAB}else{CRLF}{TAB}{TAB}{TAB}varSign = 0;{CRLF}{TAB}}{CRLF}{TAB}return log((varSign*sqrt(x*x+1)+1)/x);{CRLF}}{CRLF}</helper>

<helper replaces="Asech">double apsAsech(double x) {CRLF}{{CRLF}{TAB}return log((sqrt(-x*x+1)+1)/x);{CRLF}}{CRLF}</helper>
	  
<helper replaces="Acoth">double apsAcoth(double x) {CRLF}{{CRLF}{TAB}return log((x+1)/(x-1))/2;{CRLF}}{CRLF}</helper>
	  

   </helpers>
   <keywords>
      <keyword>function</keyword>
      <keyword>double</keyword>
      <keyword>int</keyword>
      <keyword>if</keyword>
      <keyword>else</keyword>
      <keyword>const</keyword>
      <keyword>return</keyword>
   </keywords>
   <commentmark>//</commentmark>
</grammar>
