Hello! Hoping that Maple 16 is now better with function compilation, I have compiled the rather simple function that returns the complex value. As I understand from the code below, Maple automatically assumes the arguments to be complex. That's fine.

The compiler gcc gives some errors:

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c: In function ‘_c71f6dec6b3c75a742676f2dcb3fa1864’:

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:40:1: error: incompatible type for argument 1 of ‘mrt_znew’

/home/sergey/maple16/extern/include/mrt.h:720:34: note: expected ‘double’ but argument is of type ‘complex_t’

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:41:1: error: aggregate value used where a float was expected

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:42:1: error: aggregate value used where a float was expected

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:42:1: error: aggregate value used where a float was expected

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:43:1: error: aggregate value used where a float was expected

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:43:1: error: aggregate value used where a float was expected

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:45:1: error: aggregate value used where a float was expected

/var/tmp/sergey-2181/_m71f6dec6b3c75a742676f2dcb3fa1864.c:45:40: error: invalid operands to binary * (have ‘complex_t’ and ‘double’)

I attach the produced c file below:

bold lines produce errors:

#include <mrt.h>

#include <mrt.h>

/* THIS FILE AUTOMATICALLY GENERATED BY THE MAPLE COMPILER -- DO NOT EDIT */

/* Translation of "iang1":

proc (m1, vF1, omega, q) local t1, t29, t30, t38, t40, t41, t44, t45, t46, t47, t48, t49, t50, t51, t52, t53, t54; t44 := q^2; t41 := t44/m1; t51 := t44*vF1; t38 := -t51+t41; t40 := -2*I*omega; t52 := vF1^2*t44; t47 := (4*t52-4*(t40+t51)*t38)^(1/2); t49 := vF1*q*t47; t50 := 2*t38*(t41+t40)-4*t52; t46 := (-2*t49+t50)^(1/2); t30 := 1/t46; t48 := 2*(q+t44)*vF1-2*t41; t54 := (t47+t48)*t30; t45 := (2*t49+t50)^(1/2); t29 := 1/t45; t53 := (-t47+t48)*t29; t1 := 4*q*2^(1/2)*t38*(t46*(ln(t53)-ln(-t53))+(ln(-t54)-ln(t54))*t45)/t47*t30*t29 end proc

*/

#include <mrt.h>

/* Constants table */

static const complex_t ___mrt_zcons1 = { 0, -2 };

/* C-callable entry point */

complex_t

_c71f6dec6b3c75a742676f2dcb3fa1864( const MKernelVector ___k___, double m1, complex_t vF1, complex_t omega, complex_t q )

{

complex_t t1 = { 0.0, 0.0 };

complex_t t29 = { 0.0, 0.0 };

complex_t t30 = { 0.0, 0.0 };

complex_t t38 = { 0.0, 0.0 };

complex_t t40 = { 0.0, 0.0 };

complex_t t41 = { 0.0, 0.0 };

complex_t t44 = { 0.0, 0.0 };

complex_t t45 = { 0.0, 0.0 };

complex_t t46 = { 0.0, 0.0 };

complex_t t47 = { 0.0, 0.0 };

complex_t t48 = { 0.0, 0.0 };

complex_t t49 = { 0.0, 0.0 };

complex_t t50 = { 0.0, 0.0 };

complex_t t51 = { 0.0, 0.0 };

M_INT t52 = 0;

complex_t t53 = { 0.0, 0.0 };

complex_t t54 = { 0.0, 0.0 };

**t44 = mrt_znew( (mrt_zmul( q, q )), 0.0 );**

**t41 = mrt_znew( ((double) t44 * 0.1e1 / m1), 0.0 );**

**t51 = mrt_znew( ((double) t44 * (double) vF1), 0.0 );**

**t38 = mrt_znew( (-(double) t51 + (double) t41), 0.0 );**

**t40 = (mrt_zmul( ___mrt_zcons1, omega ));**

**t52 = (M_INT) (((mrt_zmul( vF1, vF1 )) * (double) t44));**

**t47 = mrt_zsqrt( mrt_zsub( mrt_znew( mrt_imul( ___k___, 4, t52 ), 0.0 ), (mrt_zmul( mrt_znew( ((double)(4)), 0.0 ), mrt_zmul( (mrt_zadd( t40, t51 )), t38))) ) ) ;**

t49 = (mrt_zmul( vF1, mrt_zmul( q, t47)));

t50 = mrt_zsub( (mrt_zmul( mrt_znew( ((double)(2)), 0.0 ), mrt_zmul( t38, (mrt_zadd( t41, t40 ))))), mrt_znew( mrt_imul( ___k___, 4, t52 ), 0.0 ) );

t46 = mrt_zsqrt( (mrt_zadd( mrt_zneg( (mrt_zmul( mrt_znew( ((double)(2)), 0.0 ), t49 )) ), t50 )) ) ;

t30 = mrt_zinv( t46 );

t48 = mrt_zsub( (mrt_zmul( mrt_znew( ((double)(2)), 0.0 ), mrt_zmul( (mrt_zadd( q, t44 )), vF1))), (mrt_zmul( mrt_znew( ((double)(2)), 0.0 ), t41 )) );

t54 = (mrt_zmul( (mrt_zadd( t47, t48 )), t30 ));

t45 = mrt_zsqrt( (mrt_zadd( (mrt_zmul( mrt_znew( ((double)(2)), 0.0 ), t49 )), t50 )) ) ;

t29 = mrt_zinv( t45 );

t53 = (mrt_zmul( (mrt_zadd( mrt_zneg( t47 ), t48 )), t29 ));

t1 = (mrt_zmul( mrt_znew( ((double)(4)), 0.0 ), mrt_zmul( q, mrt_zmul( mrt_znew( mrt_sqrt( 0.2e1 ) , 0.0 ), mrt_zmul( t38, mrt_zmul( (mrt_zadd( (mrt_zmul( t46, mrt_zsub( mrt_zln( t53 ) , mrt_zln( mrt_zneg( t53 ) ) ) )), (mrt_zmul( mrt_zsub( mrt_zln( mrt_zneg( t54 ) ) , mrt_zln( t54 ) ), t45 )) )), mrt_zmul( mrt_zinv( t47 ), mrt_zmul( t30, t29))))))));

return t1;

}

/* Maple-callable entry point */

ALGEB M_DECL

_m71f6dec6b3c75a742676f2dcb3fa1864(const MKernelVector ___k___, const ALGEB ___args___ )

{

const M_INT ___nargs___ = ___k___->numArgs( ___args___ );

double m1;

complex_t vF1;

complex_t omega;

complex_t q;

complex_t t1 = { 0.0, 0.0 };

complex_t t29 = { 0.0, 0.0 };

complex_t t30 = { 0.0, 0.0 };

complex_t t38 = { 0.0, 0.0 };

complex_t t40 = { 0.0, 0.0 };

complex_t t41 = { 0.0, 0.0 };

complex_t t44 = { 0.0, 0.0 };

complex_t t45 = { 0.0, 0.0 };

complex_t t46 = { 0.0, 0.0 };

complex_t t47 = { 0.0, 0.0 };

complex_t t48 = { 0.0, 0.0 };

complex_t t49 = { 0.0, 0.0 };

complex_t t50 = { 0.0, 0.0 };

complex_t t51 = { 0.0, 0.0 };

M_INT t52 = 0;

complex_t t53 = { 0.0, 0.0 };

complex_t t54 = { 0.0, 0.0 };

mrt_mapleKernel___ = ___k___;

if( ___nargs___ < 4 ) {

___k___->error( "expecting 4 arguments, but received %1", ___k___->toMapleInteger( ___nargs___ ) );

}

m1 = mrt_get_float_arg( ___k___, (MRT_ARG( 1 )), 1, TYPE_NOSUCHTYPE );

vF1 = mrt_get_complex_arg( ___k___, (MRT_ARG( 2 )), 2, TYPE_NOSUCHTYPE );

omega = mrt_get_complex_arg( ___k___, (MRT_ARG( 3 )), 3, TYPE_NOSUCHTYPE );

q = mrt_get_complex_arg( ___k___, (MRT_ARG( 4 )), 4, TYPE_NOSUCHTYPE );

return mrt_z2dag( ___k___, _c71f6dec6b3c75a742676f2dcb3fa1864( ___k___, m1, vF1, omega, q ) );

}