/* --------------------------------------------------- */
/* Automatically generated by mwrap                    */
/* --------------------------------------------------- */

/* Code generated by mwrap 1.1 */
/*
  Copyright statement for mwrap:

  mwrap -- MEX file generation for MATLAB and Octave
  Copyright (c) 2007-2008 David Bindel

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  You may distribute a work that contains part or all of the source code
  generated by mwrap under the terms of your choice.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

#include <stdio.h>
#include <string.h>
#include <stddef.h>

#include <mex.h>

#if MX_HAS_INTERLEAVED_COMPLEX
#include <matrix.h>
#endif


/*
 * Records for call profile.
 */
int* mexprofrecord_= NULL;


/*
 * Support routines for copying data into and out of the MEX stubs, R2018a
 */

#if MX_HAS_INTERLEAVED_COMPLEX

void* mxWrapGetP(const mxArray* a, const char* fmt, const char** e)
{
    void* p = NULL;
#ifdef R2008OO
    mxArray* ap;
#endif
    if (mxGetClassID(a) == mxDOUBLE_CLASS && mxIsComplex(a) )
    {
        if( mxGetM(a)*mxGetN(a) == 1 && (*mxGetComplexDoubles(a)).real == 0 )
        return NULL;
    }
    if (mxGetClassID(a) == mxDOUBLE_CLASS && !mxIsComplex(a) )
    {
        if( mxGetM(a)*mxGetN(a) == 1 && *mxGetDoubles(a) == 0)
        return NULL;
    }
    if (mxIsChar(a)) {
        char pbuf[128];
        mxGetString(a, pbuf, sizeof(pbuf));
        sscanf(pbuf, fmt, &p);
    } 
#ifdef R2008OO
    else if (ap = mxGetProperty(a, 0, "mwptr")) {
        return mxWrapGetP(ap, fmt, e);
    }
#endif
    if (p == 0)
        *e = "Invalid pointer";
    return p;
}

mxArray* mxWrapCreateP(void* p, const char* fmt)
{
    if (p == 0) {
        mxArray* z = mxCreateDoubleMatrix(1,1, mxREAL);
        *mxGetDoubles(z) = 0;
        return z;
    } else {
        char pbuf[128];
        sprintf(pbuf, fmt, p);
        return mxCreateString(pbuf);
    }
}

mxArray* mxWrapStrncpy(const char* s)
{
    if (s) {
        return mxCreateString(s);
    } else {
        mxArray* z = mxCreateDoubleMatrix(1,1, mxREAL);
        *mxGetDoubles(z) = 0;
        return z;
    }
}

char* mxWrapGetString(const mxArray* a, const char** e)
{
    char* s;
    mwSize slen;
    if (!a || (!mxIsChar(a) && mxGetM(a)*mxGetN(a) > 0)) {
        *e = "Invalid string argument";
        return NULL;
    }
    slen = mxGetM(a)*mxGetN(a) + 1;
    s = (char*) mxMalloc(slen);
    if (mxGetM(a)*mxGetN(a) == 0)
        *s = 0;
    else
        mxGetString(a, s, slen);
    return s;
}


double mxWrapGetScalar(const mxArray* a, const char** e)
{
    if (!a || mxGetClassID(a) != mxDOUBLE_CLASS || mxGetM(a)*mxGetN(a) != 1) {
        *e = "Invalid scalar argument";
        return 0;
    }
    if( mxIsComplex(a) )
      return (double) (*mxGetComplexDoubles(a)).real;
    else
      return (double) (*mxGetDoubles(a));
}

#define mxWrapGetArrayDef(func, T) \
T* func(const mxArray* a, const char** e)     \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    double* q; \
    mxComplexDouble* z; \
    if (!a || mxGetClassID(a) != mxDOUBLE_CLASS) { \
        *e = "Invalid array argument, mxDOUBLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexDoubles(a);	   \
	for (i = 0; i < arraylen; ++i)		\
	  *p++ = (T) (*z++).real;			\
      } \
    else \
      {				   \
	q = mxGetDoubles(a);	   \
	for (i = 0; i < arraylen; ++i)		\
	  *p++ = (T) (*q++);			\
      } \
    return array; \
}


#define mxWrapCopyDef(func, T) \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    double* p;	\
    mxComplexDouble* z; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexDoubles(a);	   \
	for (i = 0; i < n; ++i)		\
	  (*z++).real = (double) *q++;	\
	  (*z++).imag = 0;	\
      } \
    else \
      {				   \
	p = mxGetDoubles(a);	   \
	for (i = 0; i < n; ++i)		\
	  *p++ = (double) *q++;		\
      } \
}


#define mxWrapReturnDef(func, T) \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    double* p; \
    if (!q) { \
        return mxCreateDoubleMatrix(0,0, mxREAL); \
    } else { \
        mxArray* a = mxCreateDoubleMatrix(m,n, mxREAL); \
        p = mxGetDoubles(a); \
        for (i = 0; i < m*n; ++i) \
	  *p++ = (double) *q++;	  \
        return a; \
    } \
}


#define mxWrapGetScalarZDef(func, T, ZT, setz)	\
void func(T* z, const mxArray* a) \
{ \
    if( mxIsComplex(a) ) \
      { \
  setz(z, (ZT) (*mxGetComplexDoubles(a)).real, (ZT) (*mxGetComplexDoubles(a)).imag); \
      } \
    else \
      {				   \
  setz(z, (ZT) (*mxGetComplexDoubles(a)).real, (ZT) 0);	\
      } \
}


#define mxWrapGetArrayZDef(func, T, ZT, setz)      \
T* func(const mxArray* a, const char** e)     \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    double* q; \
    mxComplexDouble* z; \
    if (!a || mxGetClassID(a) != mxDOUBLE_CLASS) { \
        *e = "Invalid array argument, mxDOUBLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexDoubles(a);	   \
	for (i = 0; i < arraylen; ++i) {	\
	  setz(p, (ZT) (*z).real, (ZT) (*z).imag);	\
  	  ++p; ++z; }					\
      } \
    else \
      {				   \
	q = mxGetDoubles(a);	   \
	for (i = 0; i < arraylen; ++i)	{	\
	  setz(p, (ZT) (*q), (ZT) 0 );		\
          ++p; ++q; }			\
      }						\
    return array; \
}


#define mxWrapCopyZDef(func, T, freal, fimag)	    \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    double* p;	\
    mxComplexDouble* z; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexDoubles(a);	   \
	for (i = 0; i < n; ++i)	{		\
          (*z).real = freal(*q);			\
	  (*z).imag = fimag(*q);			\
	  ++z; ++q; 	}			\
      } \
    else \
      {				   \
	p = mxGetDoubles(a);	   \
	for (i = 0; i < n; ++i)		\
	  *p++ = freal(*q++);		\
      } \
}


#define mxWrapReturnZDef(func, T, freal, fimag)	      \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    mxComplexDouble* p; \
    if (!q) { \
        return mxCreateDoubleMatrix(0,0, mxCOMPLEX); \
    } else { \
        mxArray* a = mxCreateDoubleMatrix(m,n, mxCOMPLEX); \
        p = mxGetComplexDoubles(a); \
        for (i = 0; i < m*n; ++i) {	  \
          (*p).real = freal(*q);			\
	  (*p).imag = fimag(*q);			\
	  ++p; ++q; 	}			\
        return a; \
    } \
}






void* mxWrapGetP_single(const mxArray* a, const char* fmt, const char** e)
{
    void* p = NULL;
#ifdef R2008OO
    mxArray* ap;
#endif
    if (mxGetClassID(a) == mxSINGLE_CLASS && mxIsComplex(a) )
    {
        if( mxGetM(a)*mxGetN(a) == 1 && (*mxGetComplexSingles(a)).real == 0 )
        return NULL;
    }
    if (mxGetClassID(a) == mxSINGLE_CLASS && !mxIsComplex(a) )
    {
        if( mxGetM(a)*mxGetN(a) == 1 && *mxGetSingles(a) == 0)
        return NULL;
    }
    if (mxIsChar(a)) {
        char pbuf[128];
        mxGetString(a, pbuf, sizeof(pbuf));
        sscanf(pbuf, fmt, &p);
    } 
#ifdef R2008OO
    else if (ap = mxGetProperty(a, 0, "mwptr")) {
        return mxWrapGetP(ap, fmt, e);
    }
#endif
    if (p == 0)
        *e = "Invalid pointer";
    return p;
}

mxArray* mxWrapCreateP_single(void* p, const char* fmt)
{
    if (p == 0) {
        mxArray* z = mxCreateNumericMatrix(1,1, mxSINGLE_CLASS, mxREAL);
        *mxGetSingles(z) = 0;
        return z;
    } else {
        char pbuf[128];
        sprintf(pbuf, fmt, p);
        return mxCreateString(pbuf);
    }
}

mxArray* mxWrapStrncpy_single(const char* s)
{
    if (s) {
        return mxCreateString(s);
    } else {
        mxArray* z = mxCreateNumericMatrix(1,1, mxSINGLE_CLASS, mxREAL);
        *mxGetSingles(z) = 0;
        return z;
    }
}

char* mxWrapGetString_single(const mxArray* a, const char** e)
{
    char* s;
    mwSize slen;
    if (!a || (!mxIsChar(a) && mxGetM(a)*mxGetN(a) > 0)) {
        *e = "Invalid string argument";
        return NULL;
    }
    slen = mxGetM(a)*mxGetN(a) + 1;
    s = (char*) mxMalloc(slen);
    if (mxGetM(a)*mxGetN(a) == 0)
        *s = 0;
    else
        mxGetString(a, s, slen);
    return s;
}


float mxWrapGetScalar_single(const mxArray* a, const char** e)
{
    if (!a || mxGetClassID(a) != mxSINGLE_CLASS || mxGetM(a)*mxGetN(a) != 1) {
        *e = "Invalid scalar argument";
        return 0;
    }
    if( mxIsComplex(a) )
      return (float) (*mxGetComplexSingles(a)).real;
    else
      return (float) (*mxGetSingles(a));
}

#define mxWrapGetArrayDef_single(func, T) \
T* func(const mxArray* a, const char** e)     \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    float* q; \
    mxComplexSingle* z; \
    if (!a || mxGetClassID(a) != mxSINGLE_CLASS) { \
        *e = "Invalid array argument, mxSINGLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexSingles(a);	   \
	for (i = 0; i < arraylen; ++i)		\
	  *p++ = (T) (*z++).real;			\
      } \
    else \
      {				   \
	q = mxGetSingles(a);	   \
	for (i = 0; i < arraylen; ++i)		\
	  *p++ = (T) (*q++);			\
      } \
    return array; \
}


#define mxWrapCopyDef_single(func, T) \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    float* p;	\
    mxComplexSingle* z; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexSingles(a);	   \
	for (i = 0; i < n; ++i)		\
	  (*z++).real = (float) *q++;	\
	  (*z++).imag = 0;	\
      } \
    else \
      {				   \
	p = mxGetSingles(a);	   \
	for (i = 0; i < n; ++i)		\
	  *p++ = (float) *q++;		\
      } \
}


#define mxWrapReturnDef_single(func, T) \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    float* p; \
    if (!q) { \
        return mxCreateNumericMatrix(0,0, mxSINGLE_CLASS, mxREAL); \
    } else { \
        mxArray* a = mxCreateNumericMatrix(m,n, mxSINGLE_CLASS, mxREAL); \
        p = mxGetSingles(a); \
        for (i = 0; i < m*n; ++i) \
	  *p++ = (float) *q++;	  \
        return a; \
    } \
}


#define mxWrapGetScalarZDef_single(func, T, ZT, setz)	\
void func(T* z, const mxArray* a) \
{ \
    if( mxIsComplex(a) ) \
      { \
  setz(z, (ZT) (*mxGetComplexSingles(a)).real, (ZT) (*mxGetComplexSingles(a)).imag); \
      } \
    else \
      {				   \
  setz(z, (ZT) (*mxGetComplexSingles(a)).real, (ZT) 0);	\
      } \
}


#define mxWrapGetArrayZDef_single(func, T, ZT, setz)      \
T* func(const mxArray* a, const char** e)     \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    float* q; \
    mxComplexSingle* z; \
    if (!a || mxGetClassID(a) != mxSINGLE_CLASS) { \
        *e = "Invalid array argument, mxSINGLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexSingles(a);	   \
	for (i = 0; i < arraylen; ++i) {	\
	  setz(p, (ZT) (*z).real, (ZT) (*z).imag);	\
  	  ++p; ++z; }					\
      } \
    else \
      {				   \
	q = mxGetSingles(a);	   \
	for (i = 0; i < arraylen; ++i)	{	\
	  setz(p, (ZT) (*q), (ZT) 0 );		\
          ++p; ++q; }			\
      }						\
    return array; \
}


#define mxWrapCopyZDef_single(func, T, freal, fimag)	    \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    float* p;	\
    mxComplexSingle* z; \
    if( mxIsComplex(a) ) \
      { \
	z = mxGetComplexSingles(a);	   \
	for (i = 0; i < n; ++i)	{		\
          (*z).real = freal(*q);			\
	  (*z).imag = fimag(*q);			\
	  ++z; ++q; 	}			\
      } \
    else \
      {				   \
	p = mxGetSingles(a);	   \
	for (i = 0; i < n; ++i)		\
	  *p++ = freal(*q++);		\
      } \
}


#define mxWrapReturnZDef_single(func, T, freal, fimag)	      \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    mxComplexSingle* p; \
    if (!q) { \
        return mxCreateNumericMatrix(0,0, mxSINGLE_CLASS, mxCOMPLEX); \
    } else { \
        mxArray* a = mxCreateNumericMatrix(m,n, mxSINGLE_CLASS, mxCOMPLEX); \
        p = mxGetComplexSingles(a); \
        for (i = 0; i < m*n; ++i) {	  \
          (*p).real = freal(*q);			\
	  (*p).imag = fimag(*q);			\
	  ++p; ++q; 	}			\
        return a; \
    } \
}



#else

/*
 * Support routines for copying data into and out of the MEX stubs, -R2017b
 */

void* mxWrapGetP(const mxArray* a, const char* fmt, const char** e)
{
    void* p = 0;
#ifdef R2008OO
    mxArray* ap;
#endif
    if (mxGetClassID(a) == mxDOUBLE_CLASS && 
        mxGetM(a)*mxGetN(a) == 1 && *mxGetPr(a) == 0)
        return p;
    if (mxIsChar(a)) {
        char pbuf[128];
        mxGetString(a, pbuf, sizeof(pbuf));
        sscanf(pbuf, fmt, &p);
    } 
#ifdef R2008OO
    else if (ap = mxGetProperty(a, 0, "mwptr")) {
        return mxWrapGetP(ap, fmt, e);
    }
#endif
    if (p == 0)
        *e = "Invalid pointer";
    return p;
}

mxArray* mxWrapCreateP(void* p, const char* fmt)
{
    if (p == 0) {
        mxArray* z = mxCreateDoubleMatrix(1,1, mxREAL);
        *mxGetPr(z) = 0;
        return z;
    } else {
        char pbuf[128];
        sprintf(pbuf, fmt, p);
        return mxCreateString(pbuf);
    }
}

mxArray* mxWrapStrncpy(const char* s)
{
    if (s) {
        return mxCreateString(s);
    } else {
        mxArray* z = mxCreateDoubleMatrix(1,1, mxREAL);
        *mxGetPr(z) = 0;
        return z;
    }
}

double mxWrapGetScalar(const mxArray* a, const char** e)
{
    if (!a || mxGetClassID(a) != mxDOUBLE_CLASS || mxGetM(a)*mxGetN(a) != 1) {
        *e = "Invalid scalar argument";
        return 0;
    }
    return *mxGetPr(a);
}

char* mxWrapGetString(const mxArray* a, const char** e)
{
    char* s;
    mwSize slen;
    if (!a || (!mxIsChar(a) && mxGetM(a)*mxGetN(a) > 0)) {
        *e = "Invalid string argument";
        return NULL;
    }
    slen = mxGetM(a)*mxGetN(a) + 1;
    s = (char*) mxMalloc(slen);
    if (mxGetM(a)*mxGetN(a) == 0)
        *s = 0;
    else
        mxGetString(a, s, slen);
    return s;
}


#define mxWrapGetArrayDef(func, T) \
T* func(const mxArray* a, const char** e)     \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    double* q; \
    if (!a || mxGetClassID(a) != mxDOUBLE_CLASS) { \
        *e = "Invalid array argument, mxDOUBLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    q = mxGetPr(a); \
    for (i = 0; i < arraylen; ++i) \
        *p++ = (T) (*q++); \
    return array; \
}


#define mxWrapCopyDef(func, T) \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    double* p = mxGetPr(a); \
    for (i = 0; i < n; ++i) \
        *p++ = *q++; \
}


#define mxWrapReturnDef(func, T) \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    double* p; \
    if (!q) { \
        return mxCreateDoubleMatrix(0,0, mxREAL); \
    } else { \
        mxArray* a = mxCreateDoubleMatrix(m,n, mxREAL); \
        p = mxGetPr(a); \
        for (i = 0; i < m*n; ++i) \
            *p++ = *q++; \
        return a; \
    } \
}


#define mxWrapGetScalarZDef(func, T, ZT, setz) \
void func(T* z, const mxArray* a) \
{ \
    double* pr = mxGetPr(a); \
    double* pi = mxGetPi(a); \
    setz(z, (ZT) *pr, (pi ? (ZT) *pi : (ZT) 0)); \
}


#define mxWrapGetArrayZDef(func, T, ZT, setz) \
T* func(const mxArray* a, const char** e) \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    double* qr; \
    double* qi; \
    if (!a || mxGetClassID(a) != mxDOUBLE_CLASS) { \
        *e = "Invalid array argument, mxDOUBLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    qr = mxGetPr(a); \
    qi = mxGetPi(a); \
    for (i = 0; i < arraylen; ++i) { \
        ZT val_qr = *qr++; \
        ZT val_qi = (qi ? (ZT) *qi++ : (ZT) 0); \
        setz(p, val_qr, val_qi); \
        ++p; \
    } \
    return array; \
}


#define mxWrapCopyZDef(func, T, real, imag) \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    double* pr = mxGetPr(a); \
    double* pi = mxGetPi(a); \
    for (i = 0; i < n; ++i) { \
        *pr++ = real(*q); \
        *pi++ = imag(*q); \
        ++q; \
    } \
}


#define mxWrapReturnZDef(func, T, real, imag) \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    double* pr; \
    double* pi; \
    if (!q) { \
        return mxCreateDoubleMatrix(0,0, mxCOMPLEX); \
    } else { \
        mxArray* a = mxCreateDoubleMatrix(m,n, mxCOMPLEX); \
        pr = mxGetPr(a); \
        pi = mxGetPi(a); \
        for (i = 0; i < m*n; ++i) { \
            *pr++ = real(*q); \
            *pi++ = imag(*q); \
            ++q; \
        } \
        return a; \
    } \
}






void* mxWrapGetP_single(const mxArray* a, const char* fmt, const char** e)
{
    void* p = 0;
#ifdef R2008OO
    mxArray* ap;
#endif
    if (mxGetClassID(a) == mxSINGLE_CLASS && 
        mxGetM(a)*mxGetN(a) == 1 && *((float*)mxGetData(a)) == 0)
        return p;
    if (mxIsChar(a)) {
        char pbuf[128];
        mxGetString(a, pbuf, sizeof(pbuf));
        sscanf(pbuf, fmt, &p);
    } 
#ifdef R2008OO
    else if (ap = mxGetProperty(a, 0, "mwptr")) {
        return mxWrapGetP(ap, fmt, e);
    }
#endif
    if (p == 0)
        *e = "Invalid pointer";
    return p;
}

mxArray* mxWrapCreateP_single(void* p, const char* fmt)
{
    if (p == 0) {
        mxArray* z = mxCreateNumericMatrix(1,1, mxSINGLE_CLASS, mxREAL);
        *((float*)mxGetData(z)) = 0;
        return z;
    } else {
        char pbuf[128];
        sprintf(pbuf, fmt, p);
        return mxCreateString(pbuf);
    }
}
mxArray* mxWrapStrncpy_single(const char* s)
{
    if (s) {
        return mxCreateString(s);
    } else {
        mxArray* z = mxCreateNumericMatrix(1,1, mxSINGLE_CLASS, mxREAL);
        *((float*)mxGetData(z)) = 0;
        return z;
    }
}

float mxWrapGetScalar_single(const mxArray* a, const char** e)
{
    if (!a || mxGetClassID(a) != mxSINGLE_CLASS || mxGetM(a)*mxGetN(a) != 1) {
        *e = "Invalid scalar argument";
        return 0;
    }
    return *((float*)mxGetData(a));
}

char* mxWrapGetString_single(const mxArray* a, const char** e)
{
    char* s;
    mwSize slen;
    if (!a || (!mxIsChar(a) && mxGetM(a)*mxGetN(a) > 0)) {
        *e = "Invalid string argument, mxSINGLE_CLASS expected";
        return NULL;
    }
    slen = mxGetM(a)*mxGetN(a) + 1;
    s = (char*) mxMalloc(slen);
    if (mxGetM(a)*mxGetN(a) == 0)
        *s = 0;
    else
        mxGetString(a, s, slen);
    return s;
}


#define mxWrapGetArrayDef_single(func, T) \
T* func(const mxArray* a, const char** e)     \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    float* q; \
    if (!a || mxGetClassID(a) != mxSINGLE_CLASS) { \
        *e = "Invalid array argument, mxSINGLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    q = (float*) mxGetData(a);	   \
    for (i = 0; i < arraylen; ++i) \
        *p++ = (T) (*q++); \
    return array; \
}


#define mxWrapCopyDef_single(func, T) \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    float* p = (float*) mxGetData(a);		\
    for (i = 0; i < n; ++i) \
        *p++ = *q++; \
}


#define mxWrapReturnDef_single(func, T) \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    float* p; \
    if (!q) { \
      return mxCreateNumericMatrix(0,0, mxSINGLE_CLASS, mxREAL); \
    } else { \
        mxArray* a = mxCreateNumericMatrix(m,n, mxSINGLE_CLASS, mxREAL);\
        p = (float*) mxGetData(a);				\
        for (i = 0; i < m*n; ++i) \
            *p++ = *q++; \
        return a; \
    } \
}


#define mxWrapGetScalarZDef_single(func, T, ZT, setz) \
void func(T* z, const mxArray* a) \
{ \
    float* pr = (float*) mxGetData(a);		\
    float* pi = (float*) mxGetImagData(a);		 \
    setz(z, (ZT) *pr, (pi ? (ZT) *pi : (ZT) 0)); \
}


#define mxWrapGetArrayZDef_single(func, T, ZT, setz) \
T* func(const mxArray* a, const char** e) \
{ \
    T* array; \
    mwSize arraylen; \
    mwIndex i; \
    T* p; \
    float* qr; \
    float* qi; \
    if (!a || mxGetClassID(a) != mxSINGLE_CLASS) { \
        *e = "Invalid array argument, mxSINGLE_CLASS expected"; \
        return 0; \
    } \
    arraylen = mxGetM(a)*mxGetN(a); \
    array = (T*) mxMalloc(mxGetM(a)*mxGetN(a) * sizeof(T)); \
    p = array; \
    qr = (float*) mxGetData(a);			\
    qi = (float*) mxGetImagData(a);			\
    for (i = 0; i < arraylen; ++i) { \
        ZT val_qr = *qr++; \
        ZT val_qi = (qi ? (ZT) *qi++ : (ZT) 0); \
        setz(p, val_qr, val_qi); \
        ++p; \
    } \
    return array; \
}


#define mxWrapCopyZDef_single(func, T, real, imag) \
void func(mxArray* a, const T* q, mwSize n) \
{ \
    mwIndex i; \
    float* pr = (float*) mxGetData(a);		\
    float* pi = (float*) mxGetImagData(a);		\
    for (i = 0; i < n; ++i) { \
        *pr++ = real(*q); \
        *pi++ = imag(*q); \
        ++q; \
    } \
}


#define mxWrapReturnZDef_single(func, T, real, imag) \
mxArray* func(const T* q, mwSize m, mwSize n) \
{ \
    mwIndex i; \
    float* pr; \
    float* pi; \
    if (!q) { \
      return mxCreateNumericMatrix(0,0, mxSINGLE_CLASS, mxCOMPLEX); \
    } else { \
        mxArray* a = mxCreateNumericMatrix(m,n, mxSINGLE_CLASS, mxCOMPLEX);\
        pr = (float*) mxGetData(a);					\
        pi = (float*) mxGetImagData(a);					\
        for (i = 0; i < m*n; ++i) { \
            *pr++ = real(*q); \
            *pi++ = imag(*q); \
            ++q; \
        } \
        return a; \
    } \
}





#endif

#include <complex.h>

typedef _Complex double dcomplex;
#define real_dcomplex(z) creal(z)
#define imag_dcomplex(z) cimag(z)
#define setz_dcomplex(z,r,i)  *z = r + i*_Complex_I

typedef _Complex float fcomplex;
#define real_fcomplex(z) crealf(z)
#define imag_fcomplex(z) cimagf(z)
#define setz_fcomplex(z,r,i)  *z = r + i*_Complex_I




/* Array copier definitions */
mxWrapGetArrayDef(mxWrapGetArray_bool, bool)
mxWrapCopyDef    (mxWrapCopy_bool,     bool)
mxWrapReturnDef  (mxWrapReturn_bool,   bool)
mxWrapGetArrayDef_single(mxWrapGetArray_single_bool, bool)
mxWrapCopyDef_single    (mxWrapCopy_single_bool,     bool)
mxWrapReturnDef_single  (mxWrapReturn_single_bool,   bool)
mxWrapGetArrayDef(mxWrapGetArray_char, char)
mxWrapCopyDef    (mxWrapCopy_char,     char)
mxWrapReturnDef  (mxWrapReturn_char,   char)
mxWrapGetArrayDef_single(mxWrapGetArray_single_char, char)
mxWrapCopyDef_single    (mxWrapCopy_single_char,     char)
mxWrapReturnDef_single  (mxWrapReturn_single_char,   char)
mxWrapGetArrayDef(mxWrapGetArray_double, double)
mxWrapCopyDef    (mxWrapCopy_double,     double)
mxWrapReturnDef  (mxWrapReturn_double,   double)
mxWrapGetArrayDef_single(mxWrapGetArray_single_double, double)
mxWrapCopyDef_single    (mxWrapCopy_single_double,     double)
mxWrapReturnDef_single  (mxWrapReturn_single_double,   double)
mxWrapGetArrayDef(mxWrapGetArray_float, float)
mxWrapCopyDef    (mxWrapCopy_float,     float)
mxWrapReturnDef  (mxWrapReturn_float,   float)
mxWrapGetArrayDef_single(mxWrapGetArray_single_float, float)
mxWrapCopyDef_single    (mxWrapCopy_single_float,     float)
mxWrapReturnDef_single  (mxWrapReturn_single_float,   float)
mxWrapGetArrayDef(mxWrapGetArray_int, int)
mxWrapCopyDef    (mxWrapCopy_int,     int)
mxWrapReturnDef  (mxWrapReturn_int,   int)
mxWrapGetArrayDef_single(mxWrapGetArray_single_int, int)
mxWrapCopyDef_single    (mxWrapCopy_single_int,     int)
mxWrapReturnDef_single  (mxWrapReturn_single_int,   int)
mxWrapGetArrayDef(mxWrapGetArray_int64_t, int64_t)
mxWrapCopyDef    (mxWrapCopy_int64_t,     int64_t)
mxWrapReturnDef  (mxWrapReturn_int64_t,   int64_t)
mxWrapGetArrayDef_single(mxWrapGetArray_single_int64_t, int64_t)
mxWrapCopyDef_single    (mxWrapCopy_single_int64_t,     int64_t)
mxWrapReturnDef_single  (mxWrapReturn_single_int64_t,   int64_t)
mxWrapGetArrayDef(mxWrapGetArray_long, long)
mxWrapCopyDef    (mxWrapCopy_long,     long)
mxWrapReturnDef  (mxWrapReturn_long,   long)
mxWrapGetArrayDef_single(mxWrapGetArray_single_long, long)
mxWrapCopyDef_single    (mxWrapCopy_single_long,     long)
mxWrapReturnDef_single  (mxWrapReturn_single_long,   long)
mxWrapGetArrayDef(mxWrapGetArray_ptrdiff_t, ptrdiff_t)
mxWrapCopyDef    (mxWrapCopy_ptrdiff_t,     ptrdiff_t)
mxWrapReturnDef  (mxWrapReturn_ptrdiff_t,   ptrdiff_t)
mxWrapGetArrayDef_single(mxWrapGetArray_single_ptrdiff_t, ptrdiff_t)
mxWrapCopyDef_single    (mxWrapCopy_single_ptrdiff_t,     ptrdiff_t)
mxWrapReturnDef_single  (mxWrapReturn_single_ptrdiff_t,   ptrdiff_t)
mxWrapGetArrayDef(mxWrapGetArray_short, short)
mxWrapCopyDef    (mxWrapCopy_short,     short)
mxWrapReturnDef  (mxWrapReturn_short,   short)
mxWrapGetArrayDef_single(mxWrapGetArray_single_short, short)
mxWrapCopyDef_single    (mxWrapCopy_single_short,     short)
mxWrapReturnDef_single  (mxWrapReturn_single_short,   short)
mxWrapGetArrayDef(mxWrapGetArray_size_t, size_t)
mxWrapCopyDef    (mxWrapCopy_size_t,     size_t)
mxWrapReturnDef  (mxWrapReturn_size_t,   size_t)
mxWrapGetArrayDef_single(mxWrapGetArray_single_size_t, size_t)
mxWrapCopyDef_single    (mxWrapCopy_single_size_t,     size_t)
mxWrapReturnDef_single  (mxWrapReturn_single_size_t,   size_t)
mxWrapGetScalarZDef(mxWrapGetScalar_fcomplex, fcomplex,
                    float, setz_fcomplex)
mxWrapGetArrayZDef (mxWrapGetArray_fcomplex, fcomplex,
                    float, setz_fcomplex)
mxWrapCopyZDef     (mxWrapCopy_fcomplex, fcomplex,
                    real_fcomplex, imag_fcomplex)
mxWrapReturnZDef   (mxWrapReturn_fcomplex, fcomplex,
                    real_fcomplex, imag_fcomplex)
mxWrapGetScalarZDef_single(mxWrapGetScalar_single_fcomplex, fcomplex,
                    float, setz_fcomplex)
mxWrapGetArrayZDef_single (mxWrapGetArray_single_fcomplex, fcomplex,
                    float, setz_fcomplex)
mxWrapCopyZDef_single     (mxWrapCopy_single_fcomplex, fcomplex,
                    real_fcomplex, imag_fcomplex)
mxWrapReturnZDef_single   (mxWrapReturn_single_fcomplex, fcomplex,
                    real_fcomplex, imag_fcomplex)
mxWrapGetScalarZDef(mxWrapGetScalar_dcomplex, dcomplex,
                    double, setz_dcomplex)
mxWrapGetArrayZDef (mxWrapGetArray_dcomplex, dcomplex,
                    double, setz_dcomplex)
mxWrapCopyZDef     (mxWrapCopy_dcomplex, dcomplex,
                    real_dcomplex, imag_dcomplex)
mxWrapReturnZDef   (mxWrapReturn_dcomplex, dcomplex,
                    real_dcomplex, imag_dcomplex)
mxWrapGetScalarZDef_single(mxWrapGetScalar_single_dcomplex, dcomplex,
                    double, setz_dcomplex)
mxWrapGetArrayZDef_single (mxWrapGetArray_single_dcomplex, dcomplex,
                    double, setz_dcomplex)
mxWrapCopyZDef_single     (mxWrapCopy_single_dcomplex, dcomplex,
                    real_dcomplex, imag_dcomplex)
mxWrapReturnZDef_single   (mxWrapReturn_single_dcomplex, dcomplex,
                    real_dcomplex, imag_dcomplex)

#if defined(MWF77_CAPS)
#define MWF77_hndiv HNDIV
#define MWF77_hfmm3d_ndiv HFMM3D_NDIV
#define MWF77_h3ddirectcp H3DDIRECTCP
#define MWF77_h3ddirectdp H3DDIRECTDP
#define MWF77_h3ddirectcdp H3DDIRECTCDP
#define MWF77_h3ddirectcg H3DDIRECTCG
#define MWF77_h3ddirectdg H3DDIRECTDG
#define MWF77_h3ddirectcdg H3DDIRECTCDG
#define MWF77_lndiv LNDIV
#define MWF77_lfmm3d_ndiv LFMM3D_NDIV
#define MWF77_l3ddirectcp L3DDIRECTCP
#define MWF77_l3ddirectdp L3DDIRECTDP
#define MWF77_l3ddirectcdp L3DDIRECTCDP
#define MWF77_l3ddirectcg L3DDIRECTCG
#define MWF77_l3ddirectdg L3DDIRECTDG
#define MWF77_l3ddirectcdg L3DDIRECTCDG
#define MWF77_l3ddirectch L3DDIRECTCH
#define MWF77_l3ddirectdh L3DDIRECTDH
#define MWF77_l3ddirectcdh L3DDIRECTCDH
#define MWF77_emfmm3d EMFMM3D
#define MWF77_em3ddirect EM3DDIRECT
#define MWF77_stfmm3d STFMM3D
#define MWF77_st3ddirectstokstrsrotdoubg ST3DDIRECTSTOKSTRSROTDOUBG
#elif defined(MWF77_UNDERSCORE1)
#define MWF77_hndiv hndiv_
#define MWF77_hfmm3d_ndiv hfmm3d_ndiv_
#define MWF77_h3ddirectcp h3ddirectcp_
#define MWF77_h3ddirectdp h3ddirectdp_
#define MWF77_h3ddirectcdp h3ddirectcdp_
#define MWF77_h3ddirectcg h3ddirectcg_
#define MWF77_h3ddirectdg h3ddirectdg_
#define MWF77_h3ddirectcdg h3ddirectcdg_
#define MWF77_lndiv lndiv_
#define MWF77_lfmm3d_ndiv lfmm3d_ndiv_
#define MWF77_l3ddirectcp l3ddirectcp_
#define MWF77_l3ddirectdp l3ddirectdp_
#define MWF77_l3ddirectcdp l3ddirectcdp_
#define MWF77_l3ddirectcg l3ddirectcg_
#define MWF77_l3ddirectdg l3ddirectdg_
#define MWF77_l3ddirectcdg l3ddirectcdg_
#define MWF77_l3ddirectch l3ddirectch_
#define MWF77_l3ddirectdh l3ddirectdh_
#define MWF77_l3ddirectcdh l3ddirectcdh_
#define MWF77_emfmm3d emfmm3d_
#define MWF77_em3ddirect em3ddirect_
#define MWF77_stfmm3d stfmm3d_
#define MWF77_st3ddirectstokstrsrotdoubg st3ddirectstokstrsrotdoubg_
#elif defined(MWF77_UNDERSCORE0)
#define MWF77_hndiv hndiv
#define MWF77_hfmm3d_ndiv hfmm3d_ndiv
#define MWF77_h3ddirectcp h3ddirectcp
#define MWF77_h3ddirectdp h3ddirectdp
#define MWF77_h3ddirectcdp h3ddirectcdp
#define MWF77_h3ddirectcg h3ddirectcg
#define MWF77_h3ddirectdg h3ddirectdg
#define MWF77_h3ddirectcdg h3ddirectcdg
#define MWF77_lndiv lndiv
#define MWF77_lfmm3d_ndiv lfmm3d_ndiv
#define MWF77_l3ddirectcp l3ddirectcp
#define MWF77_l3ddirectdp l3ddirectdp
#define MWF77_l3ddirectcdp l3ddirectcdp
#define MWF77_l3ddirectcg l3ddirectcg
#define MWF77_l3ddirectdg l3ddirectdg
#define MWF77_l3ddirectcdg l3ddirectcdg
#define MWF77_l3ddirectch l3ddirectch
#define MWF77_l3ddirectdh l3ddirectdh
#define MWF77_l3ddirectcdh l3ddirectcdh
#define MWF77_emfmm3d emfmm3d
#define MWF77_em3ddirect em3ddirect
#define MWF77_stfmm3d stfmm3d
#define MWF77_st3ddirectstokstrsrotdoubg st3ddirectstokstrsrotdoubg
#else /* f2c convention */
#define MWF77_hndiv hndiv_
#define MWF77_hfmm3d_ndiv hfmm3d_ndiv__
#define MWF77_h3ddirectcp h3ddirectcp_
#define MWF77_h3ddirectdp h3ddirectdp_
#define MWF77_h3ddirectcdp h3ddirectcdp_
#define MWF77_h3ddirectcg h3ddirectcg_
#define MWF77_h3ddirectdg h3ddirectdg_
#define MWF77_h3ddirectcdg h3ddirectcdg_
#define MWF77_lndiv lndiv_
#define MWF77_lfmm3d_ndiv lfmm3d_ndiv__
#define MWF77_l3ddirectcp l3ddirectcp_
#define MWF77_l3ddirectdp l3ddirectdp_
#define MWF77_l3ddirectcdp l3ddirectcdp_
#define MWF77_l3ddirectcg l3ddirectcg_
#define MWF77_l3ddirectdg l3ddirectdg_
#define MWF77_l3ddirectcdg l3ddirectcdg_
#define MWF77_l3ddirectch l3ddirectch_
#define MWF77_l3ddirectdh l3ddirectdh_
#define MWF77_l3ddirectcdh l3ddirectcdh_
#define MWF77_emfmm3d emfmm3d_
#define MWF77_em3ddirect em3ddirect_
#define MWF77_stfmm3d stfmm3d_
#define MWF77_st3ddirectstokstrsrotdoubg st3ddirectstokstrsrotdoubg_
#endif

#ifdef __cplusplus
extern "C" { /* Prevent C++ name mangling */
#endif

#ifndef MWF77_RETURN
#define MWF77_RETURN int
#endif

MWF77_RETURN MWF77_hndiv(double*, double*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*);
MWF77_RETURN MWF77_hfmm3d_ndiv(int64_t*, double*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*, int64_t*, dcomplex*, dcomplex*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, dcomplex*, dcomplex*, int64_t*, int64_t*, int64_t*, double*, int64_t*);
MWF77_RETURN MWF77_h3ddirectcp(int64_t*, dcomplex*, double*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, double*);
MWF77_RETURN MWF77_h3ddirectdp(int64_t*, dcomplex*, double*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, double*);
MWF77_RETURN MWF77_h3ddirectcdp(int64_t*, dcomplex*, double*, dcomplex*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, double*);
MWF77_RETURN MWF77_h3ddirectcg(int64_t*, dcomplex*, double*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, dcomplex*, double*);
MWF77_RETURN MWF77_h3ddirectdg(int64_t*, dcomplex*, double*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, dcomplex*, double*);
MWF77_RETURN MWF77_h3ddirectcdg(int64_t*, dcomplex*, double*, dcomplex*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, dcomplex*, double*);
MWF77_RETURN MWF77_lndiv(double*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*, int64_t*);
MWF77_RETURN MWF77_lfmm3d_ndiv(int64_t*, double*, int64_t*, double*, int64_t*, double*, int64_t*, double*, int64_t*, int64_t*, double*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*, int64_t*, int64_t*, int64_t*, double*, int64_t*);
MWF77_RETURN MWF77_l3ddirectcp(int64_t*, double*, double*, int64_t*, double*, int64_t*, double*, double*);
MWF77_RETURN MWF77_l3ddirectdp(int64_t*, double*, double*, int64_t*, double*, int64_t*, double*, double*);
MWF77_RETURN MWF77_l3ddirectcdp(int64_t*, double*, double*, double*, int64_t*, double*, int64_t*, double*, double*);
MWF77_RETURN MWF77_l3ddirectcg(int64_t*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*);
MWF77_RETURN MWF77_l3ddirectdg(int64_t*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*);
MWF77_RETURN MWF77_l3ddirectcdg(int64_t*, double*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*);
MWF77_RETURN MWF77_l3ddirectch(int64_t*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*, double*);
MWF77_RETURN MWF77_l3ddirectdh(int64_t*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*, double*);
MWF77_RETURN MWF77_l3ddirectcdh(int64_t*, double*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*, double*);
MWF77_RETURN MWF77_emfmm3d(int64_t*, double*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*);
MWF77_RETURN MWF77_em3ddirect(int64_t*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*, double*, int64_t*, dcomplex*, int64_t*, dcomplex*, int64_t*, dcomplex*, double*);
MWF77_RETURN MWF77_stfmm3d(int64_t*, double*, int64_t*, double*, int64_t*, double*, int64_t*, double*, double*, int64_t*, double*, double*, int64_t*, double*, double*, int64_t*, double*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*, int64_t*);
MWF77_RETURN MWF77_st3ddirectstokstrsrotdoubg(int64_t*, double*, double*, int64_t*, double*, double*, int64_t*, double*, double*, int64_t*, double*, double*, int64_t*, double*, int64_t*, double*, double*, double*, double*);

#ifdef __cplusplus
} /* end extern C */
#endif

/* ---- fmm3d.mw: 187 ----
 * hndiv(double[1] dbsize, double[1] eps, int64_t[1] ns, int64_t[1] nt, int64_t[1] ifcharge, int64_t[1] ifdipole, int64_t[1] pg, int64_t[1] pgt, inout int64_t[1] ndiv, inout int64_t[1] idivflag);
 */
static const char* stubids1_ = "hndiv(i double[x], i double[x], i int64_t[x], i int64_t[x], i int64_t[x], i int64_t[x], i int64_t[x], i int64_t[x], io int64_t[x], io int64_t[x])";

void mexStub1(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    double*     in0_ =0; /* dbsize     */
    double*     in1_ =0; /* eps        */
    int64_t*    in2_ =0; /* ns         */
    int64_t*    in3_ =0; /* nt         */
    int64_t*    in4_ =0; /* ifcharge   */
    int64_t*    in5_ =0; /* ifdipole   */
    int64_t*    in6_ =0; /* pg         */
    int64_t*    in7_ =0; /* pgt        */
    int64_t*    in8_ =0; /* ndiv       */
    int64_t*    in9_ =0; /* idivflag   */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 1          */
    mwSize      dim12_;   /* 1          */
    mwSize      dim13_;   /* 1          */
    mwSize      dim14_;   /* 1          */
    mwSize      dim15_;   /* 1          */
    mwSize      dim16_;   /* 1          */
    mwSize      dim17_;   /* 1          */
    mwSize      dim18_;   /* 1          */
    mwSize      dim19_;   /* 1          */

    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim10_) {
        mw_err_txt_ = "Bad argument size: dbsize";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim11_) {
        mw_err_txt_ = "Bad argument size: eps";        goto mw_err_label;
    }

    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != dim12_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim13_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim14_) {
        mw_err_txt_ = "Bad argument size: ifcharge";        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim15_) {
        mw_err_txt_ = "Bad argument size: ifdipole";        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim16_) {
        mw_err_txt_ = "Bad argument size: pg";        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim17_) {
        mw_err_txt_ = "Bad argument size: pgt";        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim18_) {
        mw_err_txt_ = "Bad argument size: ndiv";        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim19_) {
        mw_err_txt_ = "Bad argument size: idivflag";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        if( mxGetClassID(prhs[0]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in0_ = mxGetDoubles(prhs[0]);
#else
        in0_ = mxGetPr(prhs[0]);
#endif
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        in2_ = mxWrapGetArray_int64_t(prhs[2], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_int64_t(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_int64_t(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        in9_ = mxWrapGetArray_int64_t(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[1]++;
    MWF77_hndiv(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_);
    plhs[0] = mxCreateDoubleMatrix(dim18_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[0], in8_, dim18_);
    plhs[1] = mxCreateDoubleMatrix(dim19_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[1], in9_, dim19_);

mw_err_label:
    if (in2_)  mxFree(in2_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (in9_)  mxFree(in9_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 202 ----
 * hfmm3d_ndiv(int64_t[1] nd, double[1] eps, dcomplex[1] zk, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifcharge, dcomplex[nd, ns] charges, int64_t[1] ifdipole, dcomplex[nd3, ns] dipoles, int64_t[1] iper, int64_t[1] pg, inout dcomplex[nd, ns] pot, inout dcomplex[nd3, ns] grad, inout dcomplex[nd6, ns] hess, int64_t[1] nt, double[3, ntuse] targ, int64_t[1] pgt, inout dcomplex[nd, ntuse] pottarg, inout dcomplex[nd3, ntuse] gradtarg, inout dcomplex[nd6, ntuse] hesstarg, int64_t[1] ndiv, int64_t[1] idivflag, int64_t[1] ifnear, inout double[6] timeinfo, inout int64_t[1] ier);
 */
static const char* stubids2_ = "hfmm3d_ndiv(i int64_t[x], i double[x], i dcomplex[x], i int64_t[x], i double[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i int64_t[x], io dcomplex[xx], io dcomplex[xx], io dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], io dcomplex[xx], io dcomplex[xx], i int64_t[x], i int64_t[x], i int64_t[x], io double[x], io int64_t[x])";

void mexStub2(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* eps        */
    dcomplex*   in2_ =0; /* zk         */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* sources    */
    int64_t*    in5_ =0; /* ifcharge   */
    dcomplex*   in6_ =0; /* charges    */
    int64_t*    in7_ =0; /* ifdipole   */
    dcomplex*   in8_ =0; /* dipoles    */
    int64_t*    in9_ =0; /* iper       */
    int64_t*    in10_ =0; /* pg         */
    dcomplex*   in11_ =0; /* pot        */
    dcomplex*   in12_ =0; /* grad       */
    dcomplex*   in13_ =0; /* hess       */
    int64_t*    in14_ =0; /* nt         */
    double*     in15_ =0; /* targ       */
    int64_t*    in16_ =0; /* pgt        */
    dcomplex*   in17_ =0; /* pottarg    */
    dcomplex*   in18_ =0; /* gradtarg   */
    dcomplex*   in19_ =0; /* hesstarg   */
    int64_t*    in20_ =0; /* ndiv       */
    int64_t*    in21_ =0; /* idivflag   */
    int64_t*    in22_ =0; /* ifnear     */
    double*     in23_ =0; /* timeinfo   */
    int64_t*    in24_ =0; /* ier        */
    mwSize      dim25_;   /* 1          */
    mwSize      dim26_;   /* 1          */
    mwSize      dim27_;   /* 1          */
    mwSize      dim28_;   /* 1          */
    mwSize      dim29_;   /* 3          */
    mwSize      dim30_;   /* ns         */
    mwSize      dim31_;   /* 1          */
    mwSize      dim32_;   /* nd         */
    mwSize      dim33_;   /* ns         */
    mwSize      dim34_;   /* 1          */
    mwSize      dim35_;   /* nd3        */
    mwSize      dim36_;   /* ns         */
    mwSize      dim37_;   /* 1          */
    mwSize      dim38_;   /* 1          */
    mwSize      dim39_;   /* nd         */
    mwSize      dim40_;   /* ns         */
    mwSize      dim41_;   /* nd3        */
    mwSize      dim42_;   /* ns         */
    mwSize      dim43_;   /* nd6        */
    mwSize      dim44_;   /* ns         */
    mwSize      dim45_;   /* 1          */
    mwSize      dim46_;   /* 3          */
    mwSize      dim47_;   /* ntuse      */
    mwSize      dim48_;   /* 1          */
    mwSize      dim49_;   /* nd         */
    mwSize      dim50_;   /* ntuse      */
    mwSize      dim51_;   /* nd3        */
    mwSize      dim52_;   /* ntuse      */
    mwSize      dim53_;   /* nd6        */
    mwSize      dim54_;   /* ntuse      */
    mwSize      dim55_;   /* 1          */
    mwSize      dim56_;   /* 1          */
    mwSize      dim57_;   /* 1          */
    mwSize      dim58_;   /* 6          */
    mwSize      dim59_;   /* 1          */

    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);
    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);
    dim28_ = (mwSize) mxWrapGetScalar(prhs[28], &mw_err_txt_);
    dim29_ = (mwSize) mxWrapGetScalar(prhs[29], &mw_err_txt_);
    dim30_ = (mwSize) mxWrapGetScalar(prhs[30], &mw_err_txt_);
    dim31_ = (mwSize) mxWrapGetScalar(prhs[31], &mw_err_txt_);
    dim32_ = (mwSize) mxWrapGetScalar(prhs[32], &mw_err_txt_);
    dim33_ = (mwSize) mxWrapGetScalar(prhs[33], &mw_err_txt_);
    dim34_ = (mwSize) mxWrapGetScalar(prhs[34], &mw_err_txt_);
    dim35_ = (mwSize) mxWrapGetScalar(prhs[35], &mw_err_txt_);
    dim36_ = (mwSize) mxWrapGetScalar(prhs[36], &mw_err_txt_);
    dim37_ = (mwSize) mxWrapGetScalar(prhs[37], &mw_err_txt_);
    dim38_ = (mwSize) mxWrapGetScalar(prhs[38], &mw_err_txt_);
    dim39_ = (mwSize) mxWrapGetScalar(prhs[39], &mw_err_txt_);
    dim40_ = (mwSize) mxWrapGetScalar(prhs[40], &mw_err_txt_);
    dim41_ = (mwSize) mxWrapGetScalar(prhs[41], &mw_err_txt_);
    dim42_ = (mwSize) mxWrapGetScalar(prhs[42], &mw_err_txt_);
    dim43_ = (mwSize) mxWrapGetScalar(prhs[43], &mw_err_txt_);
    dim44_ = (mwSize) mxWrapGetScalar(prhs[44], &mw_err_txt_);
    dim45_ = (mwSize) mxWrapGetScalar(prhs[45], &mw_err_txt_);
    dim46_ = (mwSize) mxWrapGetScalar(prhs[46], &mw_err_txt_);
    dim47_ = (mwSize) mxWrapGetScalar(prhs[47], &mw_err_txt_);
    dim48_ = (mwSize) mxWrapGetScalar(prhs[48], &mw_err_txt_);
    dim49_ = (mwSize) mxWrapGetScalar(prhs[49], &mw_err_txt_);
    dim50_ = (mwSize) mxWrapGetScalar(prhs[50], &mw_err_txt_);
    dim51_ = (mwSize) mxWrapGetScalar(prhs[51], &mw_err_txt_);
    dim52_ = (mwSize) mxWrapGetScalar(prhs[52], &mw_err_txt_);
    dim53_ = (mwSize) mxWrapGetScalar(prhs[53], &mw_err_txt_);
    dim54_ = (mwSize) mxWrapGetScalar(prhs[54], &mw_err_txt_);
    dim55_ = (mwSize) mxWrapGetScalar(prhs[55], &mw_err_txt_);
    dim56_ = (mwSize) mxWrapGetScalar(prhs[56], &mw_err_txt_);
    dim57_ = (mwSize) mxWrapGetScalar(prhs[57], &mw_err_txt_);
    dim58_ = (mwSize) mxWrapGetScalar(prhs[58], &mw_err_txt_);
    dim59_ = (mwSize) mxWrapGetScalar(prhs[59], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim25_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim26_) {
        mw_err_txt_ = "Bad argument size: eps";        goto mw_err_label;
    }

    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != dim27_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim28_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim29_ ||
        mxGetN(prhs[4]) != dim30_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim31_) {
        mw_err_txt_ = "Bad argument size: ifcharge";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim32_ ||
        mxGetN(prhs[6]) != dim33_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim34_) {
        mw_err_txt_ = "Bad argument size: ifdipole";        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim35_ ||
        mxGetN(prhs[8]) != dim36_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim37_) {
        mw_err_txt_ = "Bad argument size: iper";        goto mw_err_label;
    }

    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != dim38_) {
        mw_err_txt_ = "Bad argument size: pg";        goto mw_err_label;
    }

    if (mxGetM(prhs[11]) != dim39_ ||
        mxGetN(prhs[11]) != dim40_) {
        mw_err_txt_ = "Bad argument size: pot";
        goto mw_err_label;
    }

    if (mxGetM(prhs[12]) != dim41_ ||
        mxGetN(prhs[12]) != dim42_) {
        mw_err_txt_ = "Bad argument size: grad";
        goto mw_err_label;
    }

    if (mxGetM(prhs[13]) != dim43_ ||
        mxGetN(prhs[13]) != dim44_) {
        mw_err_txt_ = "Bad argument size: hess";
        goto mw_err_label;
    }

    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != dim45_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[15]) != dim46_ ||
        mxGetN(prhs[15]) != dim47_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != dim48_) {
        mw_err_txt_ = "Bad argument size: pgt";        goto mw_err_label;
    }

    if (mxGetM(prhs[17]) != dim49_ ||
        mxGetN(prhs[17]) != dim50_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[18]) != dim51_ ||
        mxGetN(prhs[18]) != dim52_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[19]) != dim53_ ||
        mxGetN(prhs[19]) != dim54_) {
        mw_err_txt_ = "Bad argument size: hesstarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[20])*mxGetN(prhs[20]) != dim55_) {
        mw_err_txt_ = "Bad argument size: ndiv";        goto mw_err_label;
    }

    if (mxGetM(prhs[21])*mxGetN(prhs[21]) != dim56_) {
        mw_err_txt_ = "Bad argument size: idivflag";        goto mw_err_label;
    }

    if (mxGetM(prhs[22])*mxGetN(prhs[22]) != dim57_) {
        mw_err_txt_ = "Bad argument size: ifnear";        goto mw_err_label;
    }

    if (mxGetM(prhs[23])*mxGetN(prhs[23]) != dim58_) {
        mw_err_txt_ = "Bad argument size: timeinfo";        goto mw_err_label;
    }

    if (mxGetM(prhs[24])*mxGetN(prhs[24]) != dim59_) {
        mw_err_txt_ = "Bad argument size: ier";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in2_ = mxWrapGetArray_dcomplex(prhs[2], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        if( mxGetClassID(prhs[6]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in6_ = mxWrapGetArray_dcomplex(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_int64_t(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in8_ = mxWrapGetArray_dcomplex(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        in9_ = mxWrapGetArray_int64_t(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        in10_ = mxWrapGetArray_int64_t(prhs[10], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in10_ = NULL;
    if (mxGetM(prhs[11])*mxGetN(prhs[11]) != 0) {
        if( mxGetClassID(prhs[11]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in11_ = mxWrapGetArray_dcomplex(prhs[11], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in11_ = NULL;
    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != 0) {
        if( mxGetClassID(prhs[12]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in12_ = mxWrapGetArray_dcomplex(prhs[12], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in12_ = NULL;
    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != 0) {
        if( mxGetClassID(prhs[13]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in13_ = mxWrapGetArray_dcomplex(prhs[13], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in13_ = NULL;
    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != 0) {
        in14_ = mxWrapGetArray_int64_t(prhs[14], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in14_ = NULL;
    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != 0) {
        if( mxGetClassID(prhs[15]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in15_ = mxGetDoubles(prhs[15]);
#else
        in15_ = mxGetPr(prhs[15]);
#endif
    } else
        in15_ = NULL;
    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != 0) {
        in16_ = mxWrapGetArray_int64_t(prhs[16], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in16_ = NULL;
    if (mxGetM(prhs[17])*mxGetN(prhs[17]) != 0) {
        if( mxGetClassID(prhs[17]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in17_ = mxWrapGetArray_dcomplex(prhs[17], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in17_ = NULL;
    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != 0) {
        if( mxGetClassID(prhs[18]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in18_ = mxWrapGetArray_dcomplex(prhs[18], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in18_ = NULL;
    if (mxGetM(prhs[19])*mxGetN(prhs[19]) != 0) {
        if( mxGetClassID(prhs[19]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in19_ = mxWrapGetArray_dcomplex(prhs[19], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in19_ = NULL;
    if (mxGetM(prhs[20])*mxGetN(prhs[20]) != 0) {
        in20_ = mxWrapGetArray_int64_t(prhs[20], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in20_ = NULL;
    if (mxGetM(prhs[21])*mxGetN(prhs[21]) != 0) {
        in21_ = mxWrapGetArray_int64_t(prhs[21], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in21_ = NULL;
    if (mxGetM(prhs[22])*mxGetN(prhs[22]) != 0) {
        in22_ = mxWrapGetArray_int64_t(prhs[22], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in22_ = NULL;
    if (mxGetM(prhs[23])*mxGetN(prhs[23]) != 0) {
        in23_ = mxWrapGetArray_double(prhs[23], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in23_ = NULL;
    if (mxGetM(prhs[24])*mxGetN(prhs[24]) != 0) {
        in24_ = mxWrapGetArray_int64_t(prhs[24], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in24_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[2]++;
    MWF77_hfmm3d_ndiv(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_, in11_, in12_, in13_, in14_, in15_, in16_, in17_, in18_, in19_, in20_, in21_, in22_, in23_, in24_);
    plhs[0] = mxCreateDoubleMatrix(dim39_, dim40_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in11_, dim39_*dim40_);
    plhs[1] = mxCreateDoubleMatrix(dim41_, dim42_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[1], in12_, dim41_*dim42_);
    plhs[2] = mxCreateDoubleMatrix(dim43_, dim44_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[2], in13_, dim43_*dim44_);
    plhs[3] = mxCreateDoubleMatrix(dim49_, dim50_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[3], in17_, dim49_*dim50_);
    plhs[4] = mxCreateDoubleMatrix(dim51_, dim52_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[4], in18_, dim51_*dim52_);
    plhs[5] = mxCreateDoubleMatrix(dim53_, dim54_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[5], in19_, dim53_*dim54_);
    plhs[6] = mxCreateDoubleMatrix(dim58_, 1, mxREAL);
    mxWrapCopy_double(plhs[6], in23_, dim58_);
    plhs[7] = mxCreateDoubleMatrix(dim59_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[7], in24_, dim59_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in2_)  mxFree(in2_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (in9_)  mxFree(in9_);
    if (in10_)  mxFree(in10_);
    if (in11_)  mxFree(in11_);
    if (in12_)  mxFree(in12_);
    if (in13_)  mxFree(in13_);
    if (in14_)  mxFree(in14_);
    if (in16_)  mxFree(in16_);
    if (in17_)  mxFree(in17_);
    if (in18_)  mxFree(in18_);
    if (in19_)  mxFree(in19_);
    if (in20_)  mxFree(in20_);
    if (in21_)  mxFree(in21_);
    if (in22_)  mxFree(in22_);
    if (in23_)  mxFree(in23_);
    if (in24_)  mxFree(in24_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 284 ----
 * h3ddirectcp(int64_t[1] nd, dcomplex[1] zk, double[3, ns] sources, dcomplex[nd, ns] charges, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout dcomplex[nd, nt] pottarg, double[1] thresh);
 */
static const char* stubids3_ = "h3ddirectcp(i int64_t[x], i dcomplex[x], i double[xx], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], i double[x])";

void mexStub3(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    dcomplex*   in1_ =0; /* zk         */
    double*     in2_ =0; /* sources    */
    dcomplex*   in3_ =0; /* charges    */
    int64_t*    in4_ =0; /* ns         */
    double*     in5_ =0; /* targ       */
    int64_t*    in6_ =0; /* nt         */
    dcomplex*   in7_ =0; /* pottarg    */
    double*     in8_ =0; /* thresh     */
    mwSize      dim9_;   /* 1          */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 3          */
    mwSize      dim12_;   /* ns         */
    mwSize      dim13_;   /* nd         */
    mwSize      dim14_;   /* ns         */
    mwSize      dim15_;   /* 1          */
    mwSize      dim16_;   /* 3          */
    mwSize      dim17_;   /* nt         */
    mwSize      dim18_;   /* 1          */
    mwSize      dim19_;   /* nd         */
    mwSize      dim20_;   /* nt         */
    mwSize      dim21_;   /* 1          */

    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim9_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim10_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim11_ ||
        mxGetN(prhs[2]) != dim12_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim13_ ||
        mxGetN(prhs[3]) != dim14_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim15_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim16_ ||
        mxGetN(prhs[5]) != dim17_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim18_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim19_ ||
        mxGetN(prhs[7]) != dim20_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim21_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in1_ = mxWrapGetArray_dcomplex(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in3_ = mxWrapGetArray_dcomplex(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in7_ = mxWrapGetArray_dcomplex(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in8_ = mxGetDoubles(prhs[8]);
#else
        in8_ = mxGetPr(prhs[8]);
#endif
    } else
        in8_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[3]++;
    MWF77_h3ddirectcp(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_);
    plhs[0] = mxCreateDoubleMatrix(dim19_, dim20_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in7_, dim19_*dim20_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in1_)  mxFree(in1_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 287 ----
 * h3ddirectdp(int64_t[1] nd, dcomplex[1] zk, double[3, ns] sources, dcomplex[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout dcomplex[nd, nt] pottarg, double[1] thresh);
 */
static const char* stubids4_ = "h3ddirectdp(i int64_t[x], i dcomplex[x], i double[xx], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], i double[x])";

void mexStub4(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    dcomplex*   in1_ =0; /* zk         */
    double*     in2_ =0; /* sources    */
    dcomplex*   in3_ =0; /* dipoles    */
    int64_t*    in4_ =0; /* ns         */
    double*     in5_ =0; /* targ       */
    int64_t*    in6_ =0; /* nt         */
    dcomplex*   in7_ =0; /* pottarg    */
    double*     in8_ =0; /* thresh     */
    mwSize      dim9_;   /* 1          */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 3          */
    mwSize      dim12_;   /* ns         */
    mwSize      dim13_;   /* nd3        */
    mwSize      dim14_;   /* ns         */
    mwSize      dim15_;   /* 1          */
    mwSize      dim16_;   /* 3          */
    mwSize      dim17_;   /* nt         */
    mwSize      dim18_;   /* 1          */
    mwSize      dim19_;   /* nd         */
    mwSize      dim20_;   /* nt         */
    mwSize      dim21_;   /* 1          */

    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim9_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim10_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim11_ ||
        mxGetN(prhs[2]) != dim12_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim13_ ||
        mxGetN(prhs[3]) != dim14_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim15_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim16_ ||
        mxGetN(prhs[5]) != dim17_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim18_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim19_ ||
        mxGetN(prhs[7]) != dim20_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim21_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in1_ = mxWrapGetArray_dcomplex(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in3_ = mxWrapGetArray_dcomplex(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in7_ = mxWrapGetArray_dcomplex(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in8_ = mxGetDoubles(prhs[8]);
#else
        in8_ = mxGetPr(prhs[8]);
#endif
    } else
        in8_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[4]++;
    MWF77_h3ddirectdp(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_);
    plhs[0] = mxCreateDoubleMatrix(dim19_, dim20_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in7_, dim19_*dim20_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in1_)  mxFree(in1_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 290 ----
 * h3ddirectcdp(int64_t[1] nd, dcomplex[1] zk, double[3, ns] sources, dcomplex[nd, ns] charges, dcomplex[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout dcomplex[nd, nt] pottarg, double[1] thresh);
 */
static const char* stubids5_ = "h3ddirectcdp(i int64_t[x], i dcomplex[x], i double[xx], i dcomplex[xx], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], i double[x])";

void mexStub5(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    dcomplex*   in1_ =0; /* zk         */
    double*     in2_ =0; /* sources    */
    dcomplex*   in3_ =0; /* charges    */
    dcomplex*   in4_ =0; /* dipoles    */
    int64_t*    in5_ =0; /* ns         */
    double*     in6_ =0; /* targ       */
    int64_t*    in7_ =0; /* nt         */
    dcomplex*   in8_ =0; /* pottarg    */
    double*     in9_ =0; /* thresh     */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 1          */
    mwSize      dim12_;   /* 3          */
    mwSize      dim13_;   /* ns         */
    mwSize      dim14_;   /* nd         */
    mwSize      dim15_;   /* ns         */
    mwSize      dim16_;   /* nd3        */
    mwSize      dim17_;   /* ns         */
    mwSize      dim18_;   /* 1          */
    mwSize      dim19_;   /* 3          */
    mwSize      dim20_;   /* nt         */
    mwSize      dim21_;   /* 1          */
    mwSize      dim22_;   /* nd         */
    mwSize      dim23_;   /* nt         */
    mwSize      dim24_;   /* 1          */

    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim10_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim11_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim12_ ||
        mxGetN(prhs[2]) != dim13_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim14_ ||
        mxGetN(prhs[3]) != dim15_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim16_ ||
        mxGetN(prhs[4]) != dim17_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim18_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim19_ ||
        mxGetN(prhs[6]) != dim20_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim21_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim22_ ||
        mxGetN(prhs[8]) != dim23_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim24_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in1_ = mxWrapGetArray_dcomplex(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in3_ = mxWrapGetArray_dcomplex(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in4_ = mxWrapGetArray_dcomplex(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        if( mxGetClassID(prhs[6]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in6_ = mxGetDoubles(prhs[6]);
#else
        in6_ = mxGetPr(prhs[6]);
#endif
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_int64_t(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in8_ = mxWrapGetArray_dcomplex(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in9_ = mxGetDoubles(prhs[9]);
#else
        in9_ = mxGetPr(prhs[9]);
#endif
    } else
        in9_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[5]++;
    MWF77_h3ddirectcdp(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_);
    plhs[0] = mxCreateDoubleMatrix(dim22_, dim23_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in8_, dim22_*dim23_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in1_)  mxFree(in1_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in5_)  mxFree(in5_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 296 ----
 * h3ddirectcg(int64_t[1] nd, dcomplex[1] zk, double[3, ns] sources, dcomplex[nd, ns] charges, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout dcomplex[nd, nt] pottarg, inout dcomplex[nd3, nt] gradtarg, double[1] thresh);
 */
static const char* stubids6_ = "h3ddirectcg(i int64_t[x], i dcomplex[x], i double[xx], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], io dcomplex[xx], i double[x])";

void mexStub6(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    dcomplex*   in1_ =0; /* zk         */
    double*     in2_ =0; /* sources    */
    dcomplex*   in3_ =0; /* charges    */
    int64_t*    in4_ =0; /* ns         */
    double*     in5_ =0; /* targ       */
    int64_t*    in6_ =0; /* nt         */
    dcomplex*   in7_ =0; /* pottarg    */
    dcomplex*   in8_ =0; /* gradtarg   */
    double*     in9_ =0; /* thresh     */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 1          */
    mwSize      dim12_;   /* 3          */
    mwSize      dim13_;   /* ns         */
    mwSize      dim14_;   /* nd         */
    mwSize      dim15_;   /* ns         */
    mwSize      dim16_;   /* 1          */
    mwSize      dim17_;   /* 3          */
    mwSize      dim18_;   /* nt         */
    mwSize      dim19_;   /* 1          */
    mwSize      dim20_;   /* nd         */
    mwSize      dim21_;   /* nt         */
    mwSize      dim22_;   /* nd3        */
    mwSize      dim23_;   /* nt         */
    mwSize      dim24_;   /* 1          */

    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim10_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim11_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim12_ ||
        mxGetN(prhs[2]) != dim13_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim14_ ||
        mxGetN(prhs[3]) != dim15_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim16_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim17_ ||
        mxGetN(prhs[5]) != dim18_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim19_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim20_ ||
        mxGetN(prhs[7]) != dim21_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim22_ ||
        mxGetN(prhs[8]) != dim23_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim24_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in1_ = mxWrapGetArray_dcomplex(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in3_ = mxWrapGetArray_dcomplex(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in7_ = mxWrapGetArray_dcomplex(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in8_ = mxWrapGetArray_dcomplex(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in9_ = mxGetDoubles(prhs[9]);
#else
        in9_ = mxGetPr(prhs[9]);
#endif
    } else
        in9_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[6]++;
    MWF77_h3ddirectcg(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_);
    plhs[0] = mxCreateDoubleMatrix(dim20_, dim21_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in7_, dim20_*dim21_);
    plhs[1] = mxCreateDoubleMatrix(dim22_, dim23_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[1], in8_, dim22_*dim23_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in1_)  mxFree(in1_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 299 ----
 * h3ddirectdg(int64_t[1] nd, dcomplex[1] zk, double[3, ns] sources, dcomplex[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout dcomplex[nd, nt] pottarg, inout dcomplex[nd3, nt] gradtarg, double[1] thresh);
 */
static const char* stubids7_ = "h3ddirectdg(i int64_t[x], i dcomplex[x], i double[xx], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], io dcomplex[xx], i double[x])";

void mexStub7(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    dcomplex*   in1_ =0; /* zk         */
    double*     in2_ =0; /* sources    */
    dcomplex*   in3_ =0; /* dipoles    */
    int64_t*    in4_ =0; /* ns         */
    double*     in5_ =0; /* targ       */
    int64_t*    in6_ =0; /* nt         */
    dcomplex*   in7_ =0; /* pottarg    */
    dcomplex*   in8_ =0; /* gradtarg   */
    double*     in9_ =0; /* thresh     */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 1          */
    mwSize      dim12_;   /* 3          */
    mwSize      dim13_;   /* ns         */
    mwSize      dim14_;   /* nd3        */
    mwSize      dim15_;   /* ns         */
    mwSize      dim16_;   /* 1          */
    mwSize      dim17_;   /* 3          */
    mwSize      dim18_;   /* nt         */
    mwSize      dim19_;   /* 1          */
    mwSize      dim20_;   /* nd         */
    mwSize      dim21_;   /* nt         */
    mwSize      dim22_;   /* nd3        */
    mwSize      dim23_;   /* nt         */
    mwSize      dim24_;   /* 1          */

    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim10_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim11_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim12_ ||
        mxGetN(prhs[2]) != dim13_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim14_ ||
        mxGetN(prhs[3]) != dim15_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim16_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim17_ ||
        mxGetN(prhs[5]) != dim18_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim19_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim20_ ||
        mxGetN(prhs[7]) != dim21_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim22_ ||
        mxGetN(prhs[8]) != dim23_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim24_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in1_ = mxWrapGetArray_dcomplex(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in3_ = mxWrapGetArray_dcomplex(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in7_ = mxWrapGetArray_dcomplex(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in8_ = mxWrapGetArray_dcomplex(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in9_ = mxGetDoubles(prhs[9]);
#else
        in9_ = mxGetPr(prhs[9]);
#endif
    } else
        in9_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[7]++;
    MWF77_h3ddirectdg(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_);
    plhs[0] = mxCreateDoubleMatrix(dim20_, dim21_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in7_, dim20_*dim21_);
    plhs[1] = mxCreateDoubleMatrix(dim22_, dim23_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[1], in8_, dim22_*dim23_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in1_)  mxFree(in1_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 302 ----
 * h3ddirectcdg(int64_t[1] nd, dcomplex[1] zk, double[3, ns] sources, dcomplex[nd, ns] charges, dcomplex[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout dcomplex[nd, nt] pottarg, inout dcomplex[nd3, nt] gradtarg, double[1] thresh);
 */
static const char* stubids8_ = "h3ddirectcdg(i int64_t[x], i dcomplex[x], i double[xx], i dcomplex[xx], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], io dcomplex[xx], i double[x])";

void mexStub8(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    dcomplex*   in1_ =0; /* zk         */
    double*     in2_ =0; /* sources    */
    dcomplex*   in3_ =0; /* charges    */
    dcomplex*   in4_ =0; /* dipoles    */
    int64_t*    in5_ =0; /* ns         */
    double*     in6_ =0; /* targ       */
    int64_t*    in7_ =0; /* nt         */
    dcomplex*   in8_ =0; /* pottarg    */
    dcomplex*   in9_ =0; /* gradtarg   */
    double*     in10_ =0; /* thresh     */
    mwSize      dim11_;   /* 1          */
    mwSize      dim12_;   /* 1          */
    mwSize      dim13_;   /* 3          */
    mwSize      dim14_;   /* ns         */
    mwSize      dim15_;   /* nd         */
    mwSize      dim16_;   /* ns         */
    mwSize      dim17_;   /* nd3        */
    mwSize      dim18_;   /* ns         */
    mwSize      dim19_;   /* 1          */
    mwSize      dim20_;   /* 3          */
    mwSize      dim21_;   /* nt         */
    mwSize      dim22_;   /* 1          */
    mwSize      dim23_;   /* nd         */
    mwSize      dim24_;   /* nt         */
    mwSize      dim25_;   /* nd3        */
    mwSize      dim26_;   /* nt         */
    mwSize      dim27_;   /* 1          */

    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);
    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim11_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim12_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim13_ ||
        mxGetN(prhs[2]) != dim14_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim15_ ||
        mxGetN(prhs[3]) != dim16_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim17_ ||
        mxGetN(prhs[4]) != dim18_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim19_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim20_ ||
        mxGetN(prhs[6]) != dim21_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim22_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim23_ ||
        mxGetN(prhs[8]) != dim24_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9]) != dim25_ ||
        mxGetN(prhs[9]) != dim26_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != dim27_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in1_ = mxWrapGetArray_dcomplex(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in3_ = mxWrapGetArray_dcomplex(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in4_ = mxWrapGetArray_dcomplex(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        if( mxGetClassID(prhs[6]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in6_ = mxGetDoubles(prhs[6]);
#else
        in6_ = mxGetPr(prhs[6]);
#endif
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_int64_t(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in8_ = mxWrapGetArray_dcomplex(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in9_ = mxWrapGetArray_dcomplex(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        if( mxGetClassID(prhs[10]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in10_ = mxGetDoubles(prhs[10]);
#else
        in10_ = mxGetPr(prhs[10]);
#endif
    } else
        in10_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[8]++;
    MWF77_h3ddirectcdg(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_);
    plhs[0] = mxCreateDoubleMatrix(dim23_, dim24_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in8_, dim23_*dim24_);
    plhs[1] = mxCreateDoubleMatrix(dim25_, dim26_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[1], in9_, dim25_*dim26_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in1_)  mxFree(in1_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in5_)  mxFree(in5_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (in9_)  mxFree(in9_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 491 ----
 * lndiv(double[1] eps, int64_t[1] ns, int64_t[1] nt, int64_t[1] ifcharge, int64_t[1] ifdipole, int64_t[1] pg, int64_t[1] pgt, inout int64_t[1] ndiv, inout int64_t[1] idivflag);
 */
static const char* stubids9_ = "lndiv(i double[x], i int64_t[x], i int64_t[x], i int64_t[x], i int64_t[x], i int64_t[x], i int64_t[x], io int64_t[x], io int64_t[x])";

void mexStub9(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    double*     in0_ =0; /* eps        */
    int64_t*    in1_ =0; /* ns         */
    int64_t*    in2_ =0; /* nt         */
    int64_t*    in3_ =0; /* ifcharge   */
    int64_t*    in4_ =0; /* ifdipole   */
    int64_t*    in5_ =0; /* pg         */
    int64_t*    in6_ =0; /* pgt        */
    int64_t*    in7_ =0; /* ndiv       */
    int64_t*    in8_ =0; /* idivflag   */
    mwSize      dim9_;   /* 1          */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 1          */
    mwSize      dim12_;   /* 1          */
    mwSize      dim13_;   /* 1          */
    mwSize      dim14_;   /* 1          */
    mwSize      dim15_;   /* 1          */
    mwSize      dim16_;   /* 1          */
    mwSize      dim17_;   /* 1          */

    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim9_) {
        mw_err_txt_ = "Bad argument size: eps";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim10_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != dim11_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim12_) {
        mw_err_txt_ = "Bad argument size: ifcharge";        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim13_) {
        mw_err_txt_ = "Bad argument size: ifdipole";        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim14_) {
        mw_err_txt_ = "Bad argument size: pg";        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim15_) {
        mw_err_txt_ = "Bad argument size: pgt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim16_) {
        mw_err_txt_ = "Bad argument size: ndiv";        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim17_) {
        mw_err_txt_ = "Bad argument size: idivflag";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        if( mxGetClassID(prhs[0]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in0_ = mxGetDoubles(prhs[0]);
#else
        in0_ = mxGetPr(prhs[0]);
#endif
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        in1_ = mxWrapGetArray_int64_t(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        in2_ = mxWrapGetArray_int64_t(prhs[2], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_int64_t(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_int64_t(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[9]++;
    MWF77_lndiv(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_);
    plhs[0] = mxCreateDoubleMatrix(dim16_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[0], in7_, dim16_);
    plhs[1] = mxCreateDoubleMatrix(dim17_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[1], in8_, dim17_);

mw_err_label:
    if (in1_)  mxFree(in1_);
    if (in2_)  mxFree(in2_);
    if (in3_)  mxFree(in3_);
    if (in4_)  mxFree(in4_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 506 ----
 * lfmm3d_ndiv(int64_t[1] nd, double[1] eps, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifcharge, double[nd, ns] charges, int64_t[1] ifdipole, double[nd3, ns] dipoles, int64_t[1] iper, int64_t[1] pg, inout double[nd, ns] pot, inout double[nd3, ns] grad, inout double[nd6, ns] hess, int64_t[1] nt, double[3, ntuse] targ, int64_t[1] pgt, inout double[nd, ntuse] pottarg, inout double[nd3, ntuse] gradtarg, inout double[nd6, ntuse] hesstarg, int64_t[1] ndiv, int64_t[1] idivflag, int64_t[1] ifnear, inout double[6] timeinfo, inout int64_t[1] ier);
 */
static const char* stubids10_ = "lfmm3d_ndiv(i int64_t[x], i double[x], i int64_t[x], i double[xx], i int64_t[x], i double[xx], i int64_t[x], i double[xx], i int64_t[x], i int64_t[x], io double[xx], io double[xx], io double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i int64_t[x], i int64_t[x], i int64_t[x], io double[x], io int64_t[x])";

void mexStub10(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* eps        */
    int64_t*    in2_ =0; /* ns         */
    double*     in3_ =0; /* sources    */
    int64_t*    in4_ =0; /* ifcharge   */
    double*     in5_ =0; /* charges    */
    int64_t*    in6_ =0; /* ifdipole   */
    double*     in7_ =0; /* dipoles    */
    int64_t*    in8_ =0; /* iper       */
    int64_t*    in9_ =0; /* pg         */
    double*     in10_ =0; /* pot        */
    double*     in11_ =0; /* grad       */
    double*     in12_ =0; /* hess       */
    int64_t*    in13_ =0; /* nt         */
    double*     in14_ =0; /* targ       */
    int64_t*    in15_ =0; /* pgt        */
    double*     in16_ =0; /* pottarg    */
    double*     in17_ =0; /* gradtarg   */
    double*     in18_ =0; /* hesstarg   */
    int64_t*    in19_ =0; /* ndiv       */
    int64_t*    in20_ =0; /* idivflag   */
    int64_t*    in21_ =0; /* ifnear     */
    double*     in22_ =0; /* timeinfo   */
    int64_t*    in23_ =0; /* ier        */
    mwSize      dim24_;   /* 1          */
    mwSize      dim25_;   /* 1          */
    mwSize      dim26_;   /* 1          */
    mwSize      dim27_;   /* 3          */
    mwSize      dim28_;   /* ns         */
    mwSize      dim29_;   /* 1          */
    mwSize      dim30_;   /* nd         */
    mwSize      dim31_;   /* ns         */
    mwSize      dim32_;   /* 1          */
    mwSize      dim33_;   /* nd3        */
    mwSize      dim34_;   /* ns         */
    mwSize      dim35_;   /* 1          */
    mwSize      dim36_;   /* 1          */
    mwSize      dim37_;   /* nd         */
    mwSize      dim38_;   /* ns         */
    mwSize      dim39_;   /* nd3        */
    mwSize      dim40_;   /* ns         */
    mwSize      dim41_;   /* nd6        */
    mwSize      dim42_;   /* ns         */
    mwSize      dim43_;   /* 1          */
    mwSize      dim44_;   /* 3          */
    mwSize      dim45_;   /* ntuse      */
    mwSize      dim46_;   /* 1          */
    mwSize      dim47_;   /* nd         */
    mwSize      dim48_;   /* ntuse      */
    mwSize      dim49_;   /* nd3        */
    mwSize      dim50_;   /* ntuse      */
    mwSize      dim51_;   /* nd6        */
    mwSize      dim52_;   /* ntuse      */
    mwSize      dim53_;   /* 1          */
    mwSize      dim54_;   /* 1          */
    mwSize      dim55_;   /* 1          */
    mwSize      dim56_;   /* 6          */
    mwSize      dim57_;   /* 1          */

    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);
    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);
    dim28_ = (mwSize) mxWrapGetScalar(prhs[28], &mw_err_txt_);
    dim29_ = (mwSize) mxWrapGetScalar(prhs[29], &mw_err_txt_);
    dim30_ = (mwSize) mxWrapGetScalar(prhs[30], &mw_err_txt_);
    dim31_ = (mwSize) mxWrapGetScalar(prhs[31], &mw_err_txt_);
    dim32_ = (mwSize) mxWrapGetScalar(prhs[32], &mw_err_txt_);
    dim33_ = (mwSize) mxWrapGetScalar(prhs[33], &mw_err_txt_);
    dim34_ = (mwSize) mxWrapGetScalar(prhs[34], &mw_err_txt_);
    dim35_ = (mwSize) mxWrapGetScalar(prhs[35], &mw_err_txt_);
    dim36_ = (mwSize) mxWrapGetScalar(prhs[36], &mw_err_txt_);
    dim37_ = (mwSize) mxWrapGetScalar(prhs[37], &mw_err_txt_);
    dim38_ = (mwSize) mxWrapGetScalar(prhs[38], &mw_err_txt_);
    dim39_ = (mwSize) mxWrapGetScalar(prhs[39], &mw_err_txt_);
    dim40_ = (mwSize) mxWrapGetScalar(prhs[40], &mw_err_txt_);
    dim41_ = (mwSize) mxWrapGetScalar(prhs[41], &mw_err_txt_);
    dim42_ = (mwSize) mxWrapGetScalar(prhs[42], &mw_err_txt_);
    dim43_ = (mwSize) mxWrapGetScalar(prhs[43], &mw_err_txt_);
    dim44_ = (mwSize) mxWrapGetScalar(prhs[44], &mw_err_txt_);
    dim45_ = (mwSize) mxWrapGetScalar(prhs[45], &mw_err_txt_);
    dim46_ = (mwSize) mxWrapGetScalar(prhs[46], &mw_err_txt_);
    dim47_ = (mwSize) mxWrapGetScalar(prhs[47], &mw_err_txt_);
    dim48_ = (mwSize) mxWrapGetScalar(prhs[48], &mw_err_txt_);
    dim49_ = (mwSize) mxWrapGetScalar(prhs[49], &mw_err_txt_);
    dim50_ = (mwSize) mxWrapGetScalar(prhs[50], &mw_err_txt_);
    dim51_ = (mwSize) mxWrapGetScalar(prhs[51], &mw_err_txt_);
    dim52_ = (mwSize) mxWrapGetScalar(prhs[52], &mw_err_txt_);
    dim53_ = (mwSize) mxWrapGetScalar(prhs[53], &mw_err_txt_);
    dim54_ = (mwSize) mxWrapGetScalar(prhs[54], &mw_err_txt_);
    dim55_ = (mwSize) mxWrapGetScalar(prhs[55], &mw_err_txt_);
    dim56_ = (mwSize) mxWrapGetScalar(prhs[56], &mw_err_txt_);
    dim57_ = (mwSize) mxWrapGetScalar(prhs[57], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim24_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim25_) {
        mw_err_txt_ = "Bad argument size: eps";        goto mw_err_label;
    }

    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != dim26_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim27_ ||
        mxGetN(prhs[3]) != dim28_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim29_) {
        mw_err_txt_ = "Bad argument size: ifcharge";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim30_ ||
        mxGetN(prhs[5]) != dim31_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim32_) {
        mw_err_txt_ = "Bad argument size: ifdipole";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim33_ ||
        mxGetN(prhs[7]) != dim34_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim35_) {
        mw_err_txt_ = "Bad argument size: iper";        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim36_) {
        mw_err_txt_ = "Bad argument size: pg";        goto mw_err_label;
    }

    if (mxGetM(prhs[10]) != dim37_ ||
        mxGetN(prhs[10]) != dim38_) {
        mw_err_txt_ = "Bad argument size: pot";
        goto mw_err_label;
    }

    if (mxGetM(prhs[11]) != dim39_ ||
        mxGetN(prhs[11]) != dim40_) {
        mw_err_txt_ = "Bad argument size: grad";
        goto mw_err_label;
    }

    if (mxGetM(prhs[12]) != dim41_ ||
        mxGetN(prhs[12]) != dim42_) {
        mw_err_txt_ = "Bad argument size: hess";
        goto mw_err_label;
    }

    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != dim43_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[14]) != dim44_ ||
        mxGetN(prhs[14]) != dim45_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != dim46_) {
        mw_err_txt_ = "Bad argument size: pgt";        goto mw_err_label;
    }

    if (mxGetM(prhs[16]) != dim47_ ||
        mxGetN(prhs[16]) != dim48_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[17]) != dim49_ ||
        mxGetN(prhs[17]) != dim50_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[18]) != dim51_ ||
        mxGetN(prhs[18]) != dim52_) {
        mw_err_txt_ = "Bad argument size: hesstarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[19])*mxGetN(prhs[19]) != dim53_) {
        mw_err_txt_ = "Bad argument size: ndiv";        goto mw_err_label;
    }

    if (mxGetM(prhs[20])*mxGetN(prhs[20]) != dim54_) {
        mw_err_txt_ = "Bad argument size: idivflag";        goto mw_err_label;
    }

    if (mxGetM(prhs[21])*mxGetN(prhs[21]) != dim55_) {
        mw_err_txt_ = "Bad argument size: ifnear";        goto mw_err_label;
    }

    if (mxGetM(prhs[22])*mxGetN(prhs[22]) != dim56_) {
        mw_err_txt_ = "Bad argument size: timeinfo";        goto mw_err_label;
    }

    if (mxGetM(prhs[23])*mxGetN(prhs[23]) != dim57_) {
        mw_err_txt_ = "Bad argument size: ier";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        in2_ = mxWrapGetArray_int64_t(prhs[2], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in3_ = mxGetDoubles(prhs[3]);
#else
        in3_ = mxGetPr(prhs[3]);
#endif
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in7_ = mxGetDoubles(prhs[7]);
#else
        in7_ = mxGetPr(prhs[7]);
#endif
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_int64_t(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        in9_ = mxWrapGetArray_int64_t(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        in10_ = mxWrapGetArray_double(prhs[10], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in10_ = NULL;
    if (mxGetM(prhs[11])*mxGetN(prhs[11]) != 0) {
        in11_ = mxWrapGetArray_double(prhs[11], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in11_ = NULL;
    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != 0) {
        in12_ = mxWrapGetArray_double(prhs[12], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in12_ = NULL;
    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != 0) {
        in13_ = mxWrapGetArray_int64_t(prhs[13], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in13_ = NULL;
    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != 0) {
        if( mxGetClassID(prhs[14]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in14_ = mxGetDoubles(prhs[14]);
#else
        in14_ = mxGetPr(prhs[14]);
#endif
    } else
        in14_ = NULL;
    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != 0) {
        in15_ = mxWrapGetArray_int64_t(prhs[15], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in15_ = NULL;
    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != 0) {
        in16_ = mxWrapGetArray_double(prhs[16], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in16_ = NULL;
    if (mxGetM(prhs[17])*mxGetN(prhs[17]) != 0) {
        in17_ = mxWrapGetArray_double(prhs[17], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in17_ = NULL;
    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != 0) {
        in18_ = mxWrapGetArray_double(prhs[18], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in18_ = NULL;
    if (mxGetM(prhs[19])*mxGetN(prhs[19]) != 0) {
        in19_ = mxWrapGetArray_int64_t(prhs[19], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in19_ = NULL;
    if (mxGetM(prhs[20])*mxGetN(prhs[20]) != 0) {
        in20_ = mxWrapGetArray_int64_t(prhs[20], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in20_ = NULL;
    if (mxGetM(prhs[21])*mxGetN(prhs[21]) != 0) {
        in21_ = mxWrapGetArray_int64_t(prhs[21], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in21_ = NULL;
    if (mxGetM(prhs[22])*mxGetN(prhs[22]) != 0) {
        in22_ = mxWrapGetArray_double(prhs[22], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in22_ = NULL;
    if (mxGetM(prhs[23])*mxGetN(prhs[23]) != 0) {
        in23_ = mxWrapGetArray_int64_t(prhs[23], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in23_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[10]++;
    MWF77_lfmm3d_ndiv(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_, in11_, in12_, in13_, in14_, in15_, in16_, in17_, in18_, in19_, in20_, in21_, in22_, in23_);
    plhs[0] = mxCreateDoubleMatrix(dim37_, dim38_, mxREAL);
    mxWrapCopy_double(plhs[0], in10_, dim37_*dim38_);
    plhs[1] = mxCreateDoubleMatrix(dim39_, dim40_, mxREAL);
    mxWrapCopy_double(plhs[1], in11_, dim39_*dim40_);
    plhs[2] = mxCreateDoubleMatrix(dim41_, dim42_, mxREAL);
    mxWrapCopy_double(plhs[2], in12_, dim41_*dim42_);
    plhs[3] = mxCreateDoubleMatrix(dim47_, dim48_, mxREAL);
    mxWrapCopy_double(plhs[3], in16_, dim47_*dim48_);
    plhs[4] = mxCreateDoubleMatrix(dim49_, dim50_, mxREAL);
    mxWrapCopy_double(plhs[4], in17_, dim49_*dim50_);
    plhs[5] = mxCreateDoubleMatrix(dim51_, dim52_, mxREAL);
    mxWrapCopy_double(plhs[5], in18_, dim51_*dim52_);
    plhs[6] = mxCreateDoubleMatrix(dim56_, 1, mxREAL);
    mxWrapCopy_double(plhs[6], in22_, dim56_);
    plhs[7] = mxCreateDoubleMatrix(dim57_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[7], in23_, dim57_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in2_)  mxFree(in2_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in8_)  mxFree(in8_);
    if (in9_)  mxFree(in9_);
    if (in10_)  mxFree(in10_);
    if (in11_)  mxFree(in11_);
    if (in12_)  mxFree(in12_);
    if (in13_)  mxFree(in13_);
    if (in15_)  mxFree(in15_);
    if (in16_)  mxFree(in16_);
    if (in17_)  mxFree(in17_);
    if (in18_)  mxFree(in18_);
    if (in19_)  mxFree(in19_);
    if (in20_)  mxFree(in20_);
    if (in21_)  mxFree(in21_);
    if (in22_)  mxFree(in22_);
    if (in23_)  mxFree(in23_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 593 ----
 * l3ddirectcp(int64_t[1] nd, double[3, ns] sources, double[nd, ns] charges, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, double[1] thresh);
 */
static const char* stubids11_ = "l3ddirectcp(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], i double[x])";

void mexStub11(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* charges    */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* targ       */
    int64_t*    in5_ =0; /* nt         */
    double*     in6_ =0; /* pottarg    */
    double*     in7_ =0; /* thresh     */
    mwSize      dim8_;   /* 1          */
    mwSize      dim9_;   /* 3          */
    mwSize      dim10_;   /* ns         */
    mwSize      dim11_;   /* nd         */
    mwSize      dim12_;   /* ns         */
    mwSize      dim13_;   /* 1          */
    mwSize      dim14_;   /* 3          */
    mwSize      dim15_;   /* nt         */
    mwSize      dim16_;   /* 1          */
    mwSize      dim17_;   /* nd         */
    mwSize      dim18_;   /* nt         */
    mwSize      dim19_;   /* 1          */

    dim8_ = (mwSize) mxWrapGetScalar(prhs[8], &mw_err_txt_);
    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim8_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim9_ ||
        mxGetN(prhs[1]) != dim10_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim11_ ||
        mxGetN(prhs[2]) != dim12_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim13_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim14_ ||
        mxGetN(prhs[4]) != dim15_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim16_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim17_ ||
        mxGetN(prhs[6]) != dim18_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim19_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_double(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in7_ = mxGetDoubles(prhs[7]);
#else
        in7_ = mxGetPr(prhs[7]);
#endif
    } else
        in7_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[11]++;
    MWF77_l3ddirectcp(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_);
    plhs[0] = mxCreateDoubleMatrix(dim17_, dim18_, mxREAL);
    mxWrapCopy_double(plhs[0], in6_, dim17_*dim18_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 596 ----
 * l3ddirectdp(int64_t[1] nd, double[3, ns] sources, double[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, double[1] thresh);
 */
static const char* stubids12_ = "l3ddirectdp(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], i double[x])";

void mexStub12(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* dipoles    */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* targ       */
    int64_t*    in5_ =0; /* nt         */
    double*     in6_ =0; /* pottarg    */
    double*     in7_ =0; /* thresh     */
    mwSize      dim8_;   /* 1          */
    mwSize      dim9_;   /* 3          */
    mwSize      dim10_;   /* ns         */
    mwSize      dim11_;   /* nd3        */
    mwSize      dim12_;   /* ns         */
    mwSize      dim13_;   /* 1          */
    mwSize      dim14_;   /* 3          */
    mwSize      dim15_;   /* nt         */
    mwSize      dim16_;   /* 1          */
    mwSize      dim17_;   /* nd         */
    mwSize      dim18_;   /* nt         */
    mwSize      dim19_;   /* 1          */

    dim8_ = (mwSize) mxWrapGetScalar(prhs[8], &mw_err_txt_);
    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim8_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim9_ ||
        mxGetN(prhs[1]) != dim10_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim11_ ||
        mxGetN(prhs[2]) != dim12_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim13_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim14_ ||
        mxGetN(prhs[4]) != dim15_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim16_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim17_ ||
        mxGetN(prhs[6]) != dim18_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim19_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_double(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in7_ = mxGetDoubles(prhs[7]);
#else
        in7_ = mxGetPr(prhs[7]);
#endif
    } else
        in7_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[12]++;
    MWF77_l3ddirectdp(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_);
    plhs[0] = mxCreateDoubleMatrix(dim17_, dim18_, mxREAL);
    mxWrapCopy_double(plhs[0], in6_, dim17_*dim18_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 599 ----
 * l3ddirectcdp(int64_t[1] nd, double[3, ns] sources, double[nd, ns] charges, double[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, double[1] thresh);
 */
static const char* stubids13_ = "l3ddirectcdp(i int64_t[x], i double[xx], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], i double[x])";

void mexStub13(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* charges    */
    double*     in3_ =0; /* dipoles    */
    int64_t*    in4_ =0; /* ns         */
    double*     in5_ =0; /* targ       */
    int64_t*    in6_ =0; /* nt         */
    double*     in7_ =0; /* pottarg    */
    double*     in8_ =0; /* thresh     */
    mwSize      dim9_;   /* 1          */
    mwSize      dim10_;   /* 3          */
    mwSize      dim11_;   /* ns         */
    mwSize      dim12_;   /* nd         */
    mwSize      dim13_;   /* ns         */
    mwSize      dim14_;   /* nd3        */
    mwSize      dim15_;   /* ns         */
    mwSize      dim16_;   /* 1          */
    mwSize      dim17_;   /* 3          */
    mwSize      dim18_;   /* nt         */
    mwSize      dim19_;   /* 1          */
    mwSize      dim20_;   /* nd         */
    mwSize      dim21_;   /* nt         */
    mwSize      dim22_;   /* 1          */

    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim9_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim10_ ||
        mxGetN(prhs[1]) != dim11_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim12_ ||
        mxGetN(prhs[2]) != dim13_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim14_ ||
        mxGetN(prhs[3]) != dim15_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim16_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim17_ ||
        mxGetN(prhs[5]) != dim18_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim19_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim20_ ||
        mxGetN(prhs[7]) != dim21_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim22_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in3_ = mxGetDoubles(prhs[3]);
#else
        in3_ = mxGetPr(prhs[3]);
#endif
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_double(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in8_ = mxGetDoubles(prhs[8]);
#else
        in8_ = mxGetPr(prhs[8]);
#endif
    } else
        in8_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[13]++;
    MWF77_l3ddirectcdp(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_);
    plhs[0] = mxCreateDoubleMatrix(dim20_, dim21_, mxREAL);
    mxWrapCopy_double(plhs[0], in7_, dim20_*dim21_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 605 ----
 * l3ddirectcg(int64_t[1] nd, double[3, ns] sources, double[nd, ns] charges, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, inout double[nd3, nt] gradtarg, double[1] thresh);
 */
static const char* stubids14_ = "l3ddirectcg(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], i double[x])";

void mexStub14(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* charges    */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* targ       */
    int64_t*    in5_ =0; /* nt         */
    double*     in6_ =0; /* pottarg    */
    double*     in7_ =0; /* gradtarg   */
    double*     in8_ =0; /* thresh     */
    mwSize      dim9_;   /* 1          */
    mwSize      dim10_;   /* 3          */
    mwSize      dim11_;   /* ns         */
    mwSize      dim12_;   /* nd         */
    mwSize      dim13_;   /* ns         */
    mwSize      dim14_;   /* 1          */
    mwSize      dim15_;   /* 3          */
    mwSize      dim16_;   /* nt         */
    mwSize      dim17_;   /* 1          */
    mwSize      dim18_;   /* nd         */
    mwSize      dim19_;   /* nt         */
    mwSize      dim20_;   /* nd3        */
    mwSize      dim21_;   /* nt         */
    mwSize      dim22_;   /* 1          */

    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim9_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim10_ ||
        mxGetN(prhs[1]) != dim11_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim12_ ||
        mxGetN(prhs[2]) != dim13_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim14_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim15_ ||
        mxGetN(prhs[4]) != dim16_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim17_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim18_ ||
        mxGetN(prhs[6]) != dim19_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim20_ ||
        mxGetN(prhs[7]) != dim21_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim22_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_double(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_double(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in8_ = mxGetDoubles(prhs[8]);
#else
        in8_ = mxGetPr(prhs[8]);
#endif
    } else
        in8_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[14]++;
    MWF77_l3ddirectcg(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_);
    plhs[0] = mxCreateDoubleMatrix(dim18_, dim19_, mxREAL);
    mxWrapCopy_double(plhs[0], in6_, dim18_*dim19_);
    plhs[1] = mxCreateDoubleMatrix(dim20_, dim21_, mxREAL);
    mxWrapCopy_double(plhs[1], in7_, dim20_*dim21_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 608 ----
 * l3ddirectdg(int64_t[1] nd, double[3, ns] sources, double[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, inout double[nd3, nt] gradtarg, double[1] thresh);
 */
static const char* stubids15_ = "l3ddirectdg(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], i double[x])";

void mexStub15(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* dipoles    */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* targ       */
    int64_t*    in5_ =0; /* nt         */
    double*     in6_ =0; /* pottarg    */
    double*     in7_ =0; /* gradtarg   */
    double*     in8_ =0; /* thresh     */
    mwSize      dim9_;   /* 1          */
    mwSize      dim10_;   /* 3          */
    mwSize      dim11_;   /* ns         */
    mwSize      dim12_;   /* nd3        */
    mwSize      dim13_;   /* ns         */
    mwSize      dim14_;   /* 1          */
    mwSize      dim15_;   /* 3          */
    mwSize      dim16_;   /* nt         */
    mwSize      dim17_;   /* 1          */
    mwSize      dim18_;   /* nd         */
    mwSize      dim19_;   /* nt         */
    mwSize      dim20_;   /* nd3        */
    mwSize      dim21_;   /* nt         */
    mwSize      dim22_;   /* 1          */

    dim9_ = (mwSize) mxWrapGetScalar(prhs[9], &mw_err_txt_);
    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim9_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim10_ ||
        mxGetN(prhs[1]) != dim11_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim12_ ||
        mxGetN(prhs[2]) != dim13_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim14_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim15_ ||
        mxGetN(prhs[4]) != dim16_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim17_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim18_ ||
        mxGetN(prhs[6]) != dim19_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim20_ ||
        mxGetN(prhs[7]) != dim21_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim22_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_double(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_double(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in8_ = mxGetDoubles(prhs[8]);
#else
        in8_ = mxGetPr(prhs[8]);
#endif
    } else
        in8_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[15]++;
    MWF77_l3ddirectdg(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_);
    plhs[0] = mxCreateDoubleMatrix(dim18_, dim19_, mxREAL);
    mxWrapCopy_double(plhs[0], in6_, dim18_*dim19_);
    plhs[1] = mxCreateDoubleMatrix(dim20_, dim21_, mxREAL);
    mxWrapCopy_double(plhs[1], in7_, dim20_*dim21_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 611 ----
 * l3ddirectcdg(int64_t[1] nd, double[3, ns] sources, double[nd, ns] charges, double[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, inout double[nd3, nt] gradtarg, double[1] thresh);
 */
static const char* stubids16_ = "l3ddirectcdg(i int64_t[x], i double[xx], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], i double[x])";

void mexStub16(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* charges    */
    double*     in3_ =0; /* dipoles    */
    int64_t*    in4_ =0; /* ns         */
    double*     in5_ =0; /* targ       */
    int64_t*    in6_ =0; /* nt         */
    double*     in7_ =0; /* pottarg    */
    double*     in8_ =0; /* gradtarg   */
    double*     in9_ =0; /* thresh     */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 3          */
    mwSize      dim12_;   /* ns         */
    mwSize      dim13_;   /* nd         */
    mwSize      dim14_;   /* ns         */
    mwSize      dim15_;   /* nd3        */
    mwSize      dim16_;   /* ns         */
    mwSize      dim17_;   /* 1          */
    mwSize      dim18_;   /* 3          */
    mwSize      dim19_;   /* nt         */
    mwSize      dim20_;   /* 1          */
    mwSize      dim21_;   /* nd         */
    mwSize      dim22_;   /* nt         */
    mwSize      dim23_;   /* nd3        */
    mwSize      dim24_;   /* nt         */
    mwSize      dim25_;   /* 1          */

    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim10_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim11_ ||
        mxGetN(prhs[1]) != dim12_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim13_ ||
        mxGetN(prhs[2]) != dim14_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim15_ ||
        mxGetN(prhs[3]) != dim16_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim17_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim18_ ||
        mxGetN(prhs[5]) != dim19_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim20_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim21_ ||
        mxGetN(prhs[7]) != dim22_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim23_ ||
        mxGetN(prhs[8]) != dim24_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim25_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in3_ = mxGetDoubles(prhs[3]);
#else
        in3_ = mxGetPr(prhs[3]);
#endif
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_double(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_double(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in9_ = mxGetDoubles(prhs[9]);
#else
        in9_ = mxGetPr(prhs[9]);
#endif
    } else
        in9_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[16]++;
    MWF77_l3ddirectcdg(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_);
    plhs[0] = mxCreateDoubleMatrix(dim21_, dim22_, mxREAL);
    mxWrapCopy_double(plhs[0], in7_, dim21_*dim22_);
    plhs[1] = mxCreateDoubleMatrix(dim23_, dim24_, mxREAL);
    mxWrapCopy_double(plhs[1], in8_, dim23_*dim24_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 618 ----
 * l3ddirectch(int64_t[1] nd, double[3, ns] sources, double[nd, ns] charges, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, inout double[nd3, nt] gradtarg, inout double[nd6, nt] hesstarg, double[1] thresh);
 */
static const char* stubids17_ = "l3ddirectch(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i double[x])";

void mexStub17(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* charges    */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* targ       */
    int64_t*    in5_ =0; /* nt         */
    double*     in6_ =0; /* pottarg    */
    double*     in7_ =0; /* gradtarg   */
    double*     in8_ =0; /* hesstarg   */
    double*     in9_ =0; /* thresh     */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 3          */
    mwSize      dim12_;   /* ns         */
    mwSize      dim13_;   /* nd         */
    mwSize      dim14_;   /* ns         */
    mwSize      dim15_;   /* 1          */
    mwSize      dim16_;   /* 3          */
    mwSize      dim17_;   /* nt         */
    mwSize      dim18_;   /* 1          */
    mwSize      dim19_;   /* nd         */
    mwSize      dim20_;   /* nt         */
    mwSize      dim21_;   /* nd3        */
    mwSize      dim22_;   /* nt         */
    mwSize      dim23_;   /* nd6        */
    mwSize      dim24_;   /* nt         */
    mwSize      dim25_;   /* 1          */

    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim10_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim11_ ||
        mxGetN(prhs[1]) != dim12_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim13_ ||
        mxGetN(prhs[2]) != dim14_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim15_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim16_ ||
        mxGetN(prhs[4]) != dim17_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim18_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim19_ ||
        mxGetN(prhs[6]) != dim20_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim21_ ||
        mxGetN(prhs[7]) != dim22_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim23_ ||
        mxGetN(prhs[8]) != dim24_) {
        mw_err_txt_ = "Bad argument size: hesstarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim25_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_double(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_double(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_double(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in9_ = mxGetDoubles(prhs[9]);
#else
        in9_ = mxGetPr(prhs[9]);
#endif
    } else
        in9_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[17]++;
    MWF77_l3ddirectch(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_);
    plhs[0] = mxCreateDoubleMatrix(dim19_, dim20_, mxREAL);
    mxWrapCopy_double(plhs[0], in6_, dim19_*dim20_);
    plhs[1] = mxCreateDoubleMatrix(dim21_, dim22_, mxREAL);
    mxWrapCopy_double(plhs[1], in7_, dim21_*dim22_);
    plhs[2] = mxCreateDoubleMatrix(dim23_, dim24_, mxREAL);
    mxWrapCopy_double(plhs[2], in8_, dim23_*dim24_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 621 ----
 * l3ddirectdh(int64_t[1] nd, double[3, ns] sources, double[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, inout double[nd3, nt] gradtarg, inout double[nd6, nt] hesstarg, double[1] thresh);
 */
static const char* stubids18_ = "l3ddirectdh(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i double[x])";

void mexStub18(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* dipoles    */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* targ       */
    int64_t*    in5_ =0; /* nt         */
    double*     in6_ =0; /* pottarg    */
    double*     in7_ =0; /* gradtarg   */
    double*     in8_ =0; /* hesstarg   */
    double*     in9_ =0; /* thresh     */
    mwSize      dim10_;   /* 1          */
    mwSize      dim11_;   /* 3          */
    mwSize      dim12_;   /* ns         */
    mwSize      dim13_;   /* nd3        */
    mwSize      dim14_;   /* ns         */
    mwSize      dim15_;   /* 1          */
    mwSize      dim16_;   /* 3          */
    mwSize      dim17_;   /* nt         */
    mwSize      dim18_;   /* 1          */
    mwSize      dim19_;   /* nd         */
    mwSize      dim20_;   /* nt         */
    mwSize      dim21_;   /* nd3        */
    mwSize      dim22_;   /* nt         */
    mwSize      dim23_;   /* nd6        */
    mwSize      dim24_;   /* nt         */
    mwSize      dim25_;   /* 1          */

    dim10_ = (mwSize) mxWrapGetScalar(prhs[10], &mw_err_txt_);
    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim10_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim11_ ||
        mxGetN(prhs[1]) != dim12_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim13_ ||
        mxGetN(prhs[2]) != dim14_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim15_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim16_ ||
        mxGetN(prhs[4]) != dim17_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim18_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim19_ ||
        mxGetN(prhs[6]) != dim20_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim21_ ||
        mxGetN(prhs[7]) != dim22_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim23_ ||
        mxGetN(prhs[8]) != dim24_) {
        mw_err_txt_ = "Bad argument size: hesstarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim25_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_double(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_double(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_double(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in9_ = mxGetDoubles(prhs[9]);
#else
        in9_ = mxGetPr(prhs[9]);
#endif
    } else
        in9_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[18]++;
    MWF77_l3ddirectdh(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_);
    plhs[0] = mxCreateDoubleMatrix(dim19_, dim20_, mxREAL);
    mxWrapCopy_double(plhs[0], in6_, dim19_*dim20_);
    plhs[1] = mxCreateDoubleMatrix(dim21_, dim22_, mxREAL);
    mxWrapCopy_double(plhs[1], in7_, dim21_*dim22_);
    plhs[2] = mxCreateDoubleMatrix(dim23_, dim24_, mxREAL);
    mxWrapCopy_double(plhs[2], in8_, dim23_*dim24_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 624 ----
 * l3ddirectcdh(int64_t[1] nd, double[3, ns] sources, double[nd, ns] charges, double[nd3, ns] dipoles, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd, nt] pottarg, inout double[nd3, nt] gradtarg, inout double[nd6, nt] hesstarg, double[1] thresh);
 */
static const char* stubids19_ = "l3ddirectcdh(i int64_t[x], i double[xx], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i double[x])";

void mexStub19(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* charges    */
    double*     in3_ =0; /* dipoles    */
    int64_t*    in4_ =0; /* ns         */
    double*     in5_ =0; /* targ       */
    int64_t*    in6_ =0; /* nt         */
    double*     in7_ =0; /* pottarg    */
    double*     in8_ =0; /* gradtarg   */
    double*     in9_ =0; /* hesstarg   */
    double*     in10_ =0; /* thresh     */
    mwSize      dim11_;   /* 1          */
    mwSize      dim12_;   /* 3          */
    mwSize      dim13_;   /* ns         */
    mwSize      dim14_;   /* nd         */
    mwSize      dim15_;   /* ns         */
    mwSize      dim16_;   /* nd3        */
    mwSize      dim17_;   /* ns         */
    mwSize      dim18_;   /* 1          */
    mwSize      dim19_;   /* 3          */
    mwSize      dim20_;   /* nt         */
    mwSize      dim21_;   /* 1          */
    mwSize      dim22_;   /* nd         */
    mwSize      dim23_;   /* nt         */
    mwSize      dim24_;   /* nd3        */
    mwSize      dim25_;   /* nt         */
    mwSize      dim26_;   /* nd6        */
    mwSize      dim27_;   /* nt         */
    mwSize      dim28_;   /* 1          */

    dim11_ = (mwSize) mxWrapGetScalar(prhs[11], &mw_err_txt_);
    dim12_ = (mwSize) mxWrapGetScalar(prhs[12], &mw_err_txt_);
    dim13_ = (mwSize) mxWrapGetScalar(prhs[13], &mw_err_txt_);
    dim14_ = (mwSize) mxWrapGetScalar(prhs[14], &mw_err_txt_);
    dim15_ = (mwSize) mxWrapGetScalar(prhs[15], &mw_err_txt_);
    dim16_ = (mwSize) mxWrapGetScalar(prhs[16], &mw_err_txt_);
    dim17_ = (mwSize) mxWrapGetScalar(prhs[17], &mw_err_txt_);
    dim18_ = (mwSize) mxWrapGetScalar(prhs[18], &mw_err_txt_);
    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);
    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);
    dim28_ = (mwSize) mxWrapGetScalar(prhs[28], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim11_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim12_ ||
        mxGetN(prhs[1]) != dim13_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim14_ ||
        mxGetN(prhs[2]) != dim15_) {
        mw_err_txt_ = "Bad argument size: charges";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim16_ ||
        mxGetN(prhs[3]) != dim17_) {
        mw_err_txt_ = "Bad argument size: dipoles";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim18_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim19_ ||
        mxGetN(prhs[5]) != dim20_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim21_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim22_ ||
        mxGetN(prhs[7]) != dim23_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim24_ ||
        mxGetN(prhs[8]) != dim25_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9]) != dim26_ ||
        mxGetN(prhs[9]) != dim27_) {
        mw_err_txt_ = "Bad argument size: hesstarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != dim28_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in3_ = mxGetDoubles(prhs[3]);
#else
        in3_ = mxGetPr(prhs[3]);
#endif
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_double(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_double(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        in9_ = mxWrapGetArray_double(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        if( mxGetClassID(prhs[10]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in10_ = mxGetDoubles(prhs[10]);
#else
        in10_ = mxGetPr(prhs[10]);
#endif
    } else
        in10_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[19]++;
    MWF77_l3ddirectcdh(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_);
    plhs[0] = mxCreateDoubleMatrix(dim22_, dim23_, mxREAL);
    mxWrapCopy_double(plhs[0], in7_, dim22_*dim23_);
    plhs[1] = mxCreateDoubleMatrix(dim24_, dim25_, mxREAL);
    mxWrapCopy_double(plhs[1], in8_, dim24_*dim25_);
    plhs[2] = mxCreateDoubleMatrix(dim26_, dim27_, mxREAL);
    mxWrapCopy_double(plhs[2], in9_, dim26_*dim27_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (in9_)  mxFree(in9_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 785 ----
 * emfmm3d(int64_t[1] nd, double[1] eps, dcomplex[1] zk, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifh_current, dcomplex[nd3, ns_h_current] h_current, int64_t[1] ife_current, dcomplex[nd3, ns_e_current] e_current, int64_t[1] ife_charge, dcomplex[nd, ns_e_charge] e_charge, int64_t[1] nt, double[3, nt] targ, int64_t[1] ifE, inout dcomplex[nd3, nt_E] E, int64_t[1] ifcurlE, inout dcomplex[nd3, nt_curlE] curlE, int64_t[1] ifdivE, inout dcomplex[nd, nt_divE] divE, inout int64_t[1] ier);
 */
static const char* stubids20_ = "emfmm3d(i int64_t[x], i double[x], i dcomplex[x], i int64_t[x], i double[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], io int64_t[x])";

void mexStub20(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* eps        */
    dcomplex*   in2_ =0; /* zk         */
    int64_t*    in3_ =0; /* ns         */
    double*     in4_ =0; /* sources    */
    int64_t*    in5_ =0; /* ifh_current */
    dcomplex*   in6_ =0; /* h_current  */
    int64_t*    in7_ =0; /* ife_current */
    dcomplex*   in8_ =0; /* e_current  */
    int64_t*    in9_ =0; /* ife_charge */
    dcomplex*   in10_ =0; /* e_charge   */
    int64_t*    in11_ =0; /* nt         */
    double*     in12_ =0; /* targ       */
    int64_t*    in13_ =0; /* ifE        */
    dcomplex*   in14_ =0; /* E          */
    int64_t*    in15_ =0; /* ifcurlE    */
    dcomplex*   in16_ =0; /* curlE      */
    int64_t*    in17_ =0; /* ifdivE     */
    dcomplex*   in18_ =0; /* divE       */
    int64_t*    in19_ =0; /* ier        */
    mwSize      dim20_;   /* 1          */
    mwSize      dim21_;   /* 1          */
    mwSize      dim22_;   /* 1          */
    mwSize      dim23_;   /* 1          */
    mwSize      dim24_;   /* 3          */
    mwSize      dim25_;   /* ns         */
    mwSize      dim26_;   /* 1          */
    mwSize      dim27_;   /* nd3        */
    mwSize      dim28_;   /* ns_h_current */
    mwSize      dim29_;   /* 1          */
    mwSize      dim30_;   /* nd3        */
    mwSize      dim31_;   /* ns_e_current */
    mwSize      dim32_;   /* 1          */
    mwSize      dim33_;   /* nd         */
    mwSize      dim34_;   /* ns_e_charge */
    mwSize      dim35_;   /* 1          */
    mwSize      dim36_;   /* 3          */
    mwSize      dim37_;   /* nt         */
    mwSize      dim38_;   /* 1          */
    mwSize      dim39_;   /* nd3        */
    mwSize      dim40_;   /* nt_E       */
    mwSize      dim41_;   /* 1          */
    mwSize      dim42_;   /* nd3        */
    mwSize      dim43_;   /* nt_curlE   */
    mwSize      dim44_;   /* 1          */
    mwSize      dim45_;   /* nd         */
    mwSize      dim46_;   /* nt_divE    */
    mwSize      dim47_;   /* 1          */

    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);
    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);
    dim28_ = (mwSize) mxWrapGetScalar(prhs[28], &mw_err_txt_);
    dim29_ = (mwSize) mxWrapGetScalar(prhs[29], &mw_err_txt_);
    dim30_ = (mwSize) mxWrapGetScalar(prhs[30], &mw_err_txt_);
    dim31_ = (mwSize) mxWrapGetScalar(prhs[31], &mw_err_txt_);
    dim32_ = (mwSize) mxWrapGetScalar(prhs[32], &mw_err_txt_);
    dim33_ = (mwSize) mxWrapGetScalar(prhs[33], &mw_err_txt_);
    dim34_ = (mwSize) mxWrapGetScalar(prhs[34], &mw_err_txt_);
    dim35_ = (mwSize) mxWrapGetScalar(prhs[35], &mw_err_txt_);
    dim36_ = (mwSize) mxWrapGetScalar(prhs[36], &mw_err_txt_);
    dim37_ = (mwSize) mxWrapGetScalar(prhs[37], &mw_err_txt_);
    dim38_ = (mwSize) mxWrapGetScalar(prhs[38], &mw_err_txt_);
    dim39_ = (mwSize) mxWrapGetScalar(prhs[39], &mw_err_txt_);
    dim40_ = (mwSize) mxWrapGetScalar(prhs[40], &mw_err_txt_);
    dim41_ = (mwSize) mxWrapGetScalar(prhs[41], &mw_err_txt_);
    dim42_ = (mwSize) mxWrapGetScalar(prhs[42], &mw_err_txt_);
    dim43_ = (mwSize) mxWrapGetScalar(prhs[43], &mw_err_txt_);
    dim44_ = (mwSize) mxWrapGetScalar(prhs[44], &mw_err_txt_);
    dim45_ = (mwSize) mxWrapGetScalar(prhs[45], &mw_err_txt_);
    dim46_ = (mwSize) mxWrapGetScalar(prhs[46], &mw_err_txt_);
    dim47_ = (mwSize) mxWrapGetScalar(prhs[47], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim20_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim21_) {
        mw_err_txt_ = "Bad argument size: eps";        goto mw_err_label;
    }

    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != dim22_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim23_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim24_ ||
        mxGetN(prhs[4]) != dim25_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != dim26_) {
        mw_err_txt_ = "Bad argument size: ifh_current";        goto mw_err_label;
    }

    if (mxGetM(prhs[6]) != dim27_ ||
        mxGetN(prhs[6]) != dim28_) {
        mw_err_txt_ = "Bad argument size: h_current";
        goto mw_err_label;
    }

    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != dim29_) {
        mw_err_txt_ = "Bad argument size: ife_current";        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim30_ ||
        mxGetN(prhs[8]) != dim31_) {
        mw_err_txt_ = "Bad argument size: e_current";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim32_) {
        mw_err_txt_ = "Bad argument size: ife_charge";        goto mw_err_label;
    }

    if (mxGetM(prhs[10]) != dim33_ ||
        mxGetN(prhs[10]) != dim34_) {
        mw_err_txt_ = "Bad argument size: e_charge";
        goto mw_err_label;
    }

    if (mxGetM(prhs[11])*mxGetN(prhs[11]) != dim35_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[12]) != dim36_ ||
        mxGetN(prhs[12]) != dim37_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != dim38_) {
        mw_err_txt_ = "Bad argument size: ifE";        goto mw_err_label;
    }

    if (mxGetM(prhs[14]) != dim39_ ||
        mxGetN(prhs[14]) != dim40_) {
        mw_err_txt_ = "Bad argument size: E";
        goto mw_err_label;
    }

    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != dim41_) {
        mw_err_txt_ = "Bad argument size: ifcurlE";        goto mw_err_label;
    }

    if (mxGetM(prhs[16]) != dim42_ ||
        mxGetN(prhs[16]) != dim43_) {
        mw_err_txt_ = "Bad argument size: curlE";
        goto mw_err_label;
    }

    if (mxGetM(prhs[17])*mxGetN(prhs[17]) != dim44_) {
        mw_err_txt_ = "Bad argument size: ifdivE";        goto mw_err_label;
    }

    if (mxGetM(prhs[18]) != dim45_ ||
        mxGetN(prhs[18]) != dim46_) {
        mw_err_txt_ = "Bad argument size: divE";
        goto mw_err_label;
    }

    if (mxGetM(prhs[19])*mxGetN(prhs[19]) != dim47_) {
        mw_err_txt_ = "Bad argument size: ier";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in2_ = mxWrapGetArray_dcomplex(prhs[2], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        in5_ = mxWrapGetArray_int64_t(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        if( mxGetClassID(prhs[6]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in6_ = mxWrapGetArray_dcomplex(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        in7_ = mxWrapGetArray_int64_t(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in8_ = mxWrapGetArray_dcomplex(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        in9_ = mxWrapGetArray_int64_t(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        if( mxGetClassID(prhs[10]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in10_ = mxWrapGetArray_dcomplex(prhs[10], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in10_ = NULL;
    if (mxGetM(prhs[11])*mxGetN(prhs[11]) != 0) {
        in11_ = mxWrapGetArray_int64_t(prhs[11], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in11_ = NULL;
    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != 0) {
        if( mxGetClassID(prhs[12]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in12_ = mxGetDoubles(prhs[12]);
#else
        in12_ = mxGetPr(prhs[12]);
#endif
    } else
        in12_ = NULL;
    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != 0) {
        in13_ = mxWrapGetArray_int64_t(prhs[13], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in13_ = NULL;
    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != 0) {
        if( mxGetClassID(prhs[14]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in14_ = mxWrapGetArray_dcomplex(prhs[14], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in14_ = NULL;
    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != 0) {
        in15_ = mxWrapGetArray_int64_t(prhs[15], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in15_ = NULL;
    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != 0) {
        if( mxGetClassID(prhs[16]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in16_ = mxWrapGetArray_dcomplex(prhs[16], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in16_ = NULL;
    if (mxGetM(prhs[17])*mxGetN(prhs[17]) != 0) {
        in17_ = mxWrapGetArray_int64_t(prhs[17], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in17_ = NULL;
    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != 0) {
        if( mxGetClassID(prhs[18]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in18_ = mxWrapGetArray_dcomplex(prhs[18], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in18_ = NULL;
    if (mxGetM(prhs[19])*mxGetN(prhs[19]) != 0) {
        in19_ = mxWrapGetArray_int64_t(prhs[19], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in19_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[20]++;
    MWF77_emfmm3d(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_, in11_, in12_, in13_, in14_, in15_, in16_, in17_, in18_, in19_);
    plhs[0] = mxCreateDoubleMatrix(dim39_, dim40_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in14_, dim39_*dim40_);
    plhs[1] = mxCreateDoubleMatrix(dim42_, dim43_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[1], in16_, dim42_*dim43_);
    plhs[2] = mxCreateDoubleMatrix(dim45_, dim46_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[2], in18_, dim45_*dim46_);
    plhs[3] = mxCreateDoubleMatrix(dim47_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[3], in19_, dim47_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in2_)  mxFree(in2_);
    if (in3_)  mxFree(in3_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (in9_)  mxFree(in9_);
    if (in10_)  mxFree(in10_);
    if (in11_)  mxFree(in11_);
    if (in13_)  mxFree(in13_);
    if (in14_)  mxFree(in14_);
    if (in15_)  mxFree(in15_);
    if (in16_)  mxFree(in16_);
    if (in17_)  mxFree(in17_);
    if (in18_)  mxFree(in18_);
    if (in19_)  mxFree(in19_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 892 ----
 * em3ddirect(int64_t[1] nd, dcomplex[1] zk, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifh_current, dcomplex[nd3, ns_h_current] h_current, int64_t[1] ife_current, dcomplex[nd3, ns_e_current] e_current, int64_t[1] ife_charge, dcomplex[nd, ns_e_charge] e_charge, int64_t[1] nt, double[3, nt] targ, int64_t[1] ifE, inout dcomplex[nd3, nt_E] E, int64_t[1] ifcurlE, inout dcomplex[nd3, nt_curlE] curlE, int64_t[1] ifdivE, inout dcomplex[nd, nt_divE] divE, double[1] thresh);
 */
static const char* stubids21_ = "em3ddirect(i int64_t[x], i dcomplex[x], i int64_t[x], i double[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], i double[x])";

void mexStub21(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    dcomplex*   in1_ =0; /* zk         */
    int64_t*    in2_ =0; /* ns         */
    double*     in3_ =0; /* sources    */
    int64_t*    in4_ =0; /* ifh_current */
    dcomplex*   in5_ =0; /* h_current  */
    int64_t*    in6_ =0; /* ife_current */
    dcomplex*   in7_ =0; /* e_current  */
    int64_t*    in8_ =0; /* ife_charge */
    dcomplex*   in9_ =0; /* e_charge   */
    int64_t*    in10_ =0; /* nt         */
    double*     in11_ =0; /* targ       */
    int64_t*    in12_ =0; /* ifE        */
    dcomplex*   in13_ =0; /* E          */
    int64_t*    in14_ =0; /* ifcurlE    */
    dcomplex*   in15_ =0; /* curlE      */
    int64_t*    in16_ =0; /* ifdivE     */
    dcomplex*   in17_ =0; /* divE       */
    double*     in18_ =0; /* thresh     */
    mwSize      dim19_;   /* 1          */
    mwSize      dim20_;   /* 1          */
    mwSize      dim21_;   /* 1          */
    mwSize      dim22_;   /* 3          */
    mwSize      dim23_;   /* ns         */
    mwSize      dim24_;   /* 1          */
    mwSize      dim25_;   /* nd3        */
    mwSize      dim26_;   /* ns_h_current */
    mwSize      dim27_;   /* 1          */
    mwSize      dim28_;   /* nd3        */
    mwSize      dim29_;   /* ns_e_current */
    mwSize      dim30_;   /* 1          */
    mwSize      dim31_;   /* nd         */
    mwSize      dim32_;   /* ns_e_charge */
    mwSize      dim33_;   /* 1          */
    mwSize      dim34_;   /* 3          */
    mwSize      dim35_;   /* nt         */
    mwSize      dim36_;   /* 1          */
    mwSize      dim37_;   /* nd3        */
    mwSize      dim38_;   /* nt_E       */
    mwSize      dim39_;   /* 1          */
    mwSize      dim40_;   /* nd3        */
    mwSize      dim41_;   /* nt_curlE   */
    mwSize      dim42_;   /* 1          */
    mwSize      dim43_;   /* nd         */
    mwSize      dim44_;   /* nt_divE    */
    mwSize      dim45_;   /* 1          */

    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);
    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);
    dim28_ = (mwSize) mxWrapGetScalar(prhs[28], &mw_err_txt_);
    dim29_ = (mwSize) mxWrapGetScalar(prhs[29], &mw_err_txt_);
    dim30_ = (mwSize) mxWrapGetScalar(prhs[30], &mw_err_txt_);
    dim31_ = (mwSize) mxWrapGetScalar(prhs[31], &mw_err_txt_);
    dim32_ = (mwSize) mxWrapGetScalar(prhs[32], &mw_err_txt_);
    dim33_ = (mwSize) mxWrapGetScalar(prhs[33], &mw_err_txt_);
    dim34_ = (mwSize) mxWrapGetScalar(prhs[34], &mw_err_txt_);
    dim35_ = (mwSize) mxWrapGetScalar(prhs[35], &mw_err_txt_);
    dim36_ = (mwSize) mxWrapGetScalar(prhs[36], &mw_err_txt_);
    dim37_ = (mwSize) mxWrapGetScalar(prhs[37], &mw_err_txt_);
    dim38_ = (mwSize) mxWrapGetScalar(prhs[38], &mw_err_txt_);
    dim39_ = (mwSize) mxWrapGetScalar(prhs[39], &mw_err_txt_);
    dim40_ = (mwSize) mxWrapGetScalar(prhs[40], &mw_err_txt_);
    dim41_ = (mwSize) mxWrapGetScalar(prhs[41], &mw_err_txt_);
    dim42_ = (mwSize) mxWrapGetScalar(prhs[42], &mw_err_txt_);
    dim43_ = (mwSize) mxWrapGetScalar(prhs[43], &mw_err_txt_);
    dim44_ = (mwSize) mxWrapGetScalar(prhs[44], &mw_err_txt_);
    dim45_ = (mwSize) mxWrapGetScalar(prhs[45], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim19_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim20_) {
        mw_err_txt_ = "Bad argument size: zk";        goto mw_err_label;
    }

    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != dim21_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim22_ ||
        mxGetN(prhs[3]) != dim23_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim24_) {
        mw_err_txt_ = "Bad argument size: ifh_current";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim25_ ||
        mxGetN(prhs[5]) != dim26_) {
        mw_err_txt_ = "Bad argument size: h_current";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim27_) {
        mw_err_txt_ = "Bad argument size: ife_current";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim28_ ||
        mxGetN(prhs[7]) != dim29_) {
        mw_err_txt_ = "Bad argument size: e_current";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != dim30_) {
        mw_err_txt_ = "Bad argument size: ife_charge";        goto mw_err_label;
    }

    if (mxGetM(prhs[9]) != dim31_ ||
        mxGetN(prhs[9]) != dim32_) {
        mw_err_txt_ = "Bad argument size: e_charge";
        goto mw_err_label;
    }

    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != dim33_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[11]) != dim34_ ||
        mxGetN(prhs[11]) != dim35_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != dim36_) {
        mw_err_txt_ = "Bad argument size: ifE";        goto mw_err_label;
    }

    if (mxGetM(prhs[13]) != dim37_ ||
        mxGetN(prhs[13]) != dim38_) {
        mw_err_txt_ = "Bad argument size: E";
        goto mw_err_label;
    }

    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != dim39_) {
        mw_err_txt_ = "Bad argument size: ifcurlE";        goto mw_err_label;
    }

    if (mxGetM(prhs[15]) != dim40_ ||
        mxGetN(prhs[15]) != dim41_) {
        mw_err_txt_ = "Bad argument size: curlE";
        goto mw_err_label;
    }

    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != dim42_) {
        mw_err_txt_ = "Bad argument size: ifdivE";        goto mw_err_label;
    }

    if (mxGetM(prhs[17]) != dim43_ ||
        mxGetN(prhs[17]) != dim44_) {
        mw_err_txt_ = "Bad argument size: divE";
        goto mw_err_label;
    }

    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != dim45_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in1_ = mxWrapGetArray_dcomplex(prhs[1], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        in2_ = mxWrapGetArray_int64_t(prhs[2], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in3_ = mxGetDoubles(prhs[3]);
#else
        in3_ = mxGetPr(prhs[3]);
#endif
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in5_ = mxWrapGetArray_dcomplex(prhs[5], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in7_ = mxWrapGetArray_dcomplex(prhs[7], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        in8_ = mxWrapGetArray_int64_t(prhs[8], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        if( mxGetClassID(prhs[9]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in9_ = mxWrapGetArray_dcomplex(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        in10_ = mxWrapGetArray_int64_t(prhs[10], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in10_ = NULL;
    if (mxGetM(prhs[11])*mxGetN(prhs[11]) != 0) {
        if( mxGetClassID(prhs[11]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in11_ = mxGetDoubles(prhs[11]);
#else
        in11_ = mxGetPr(prhs[11]);
#endif
    } else
        in11_ = NULL;
    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != 0) {
        in12_ = mxWrapGetArray_int64_t(prhs[12], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in12_ = NULL;
    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != 0) {
        if( mxGetClassID(prhs[13]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in13_ = mxWrapGetArray_dcomplex(prhs[13], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in13_ = NULL;
    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != 0) {
        in14_ = mxWrapGetArray_int64_t(prhs[14], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in14_ = NULL;
    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != 0) {
        if( mxGetClassID(prhs[15]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in15_ = mxWrapGetArray_dcomplex(prhs[15], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in15_ = NULL;
    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != 0) {
        in16_ = mxWrapGetArray_int64_t(prhs[16], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in16_ = NULL;
    if (mxGetM(prhs[17])*mxGetN(prhs[17]) != 0) {
        if( mxGetClassID(prhs[17]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
        in17_ = mxWrapGetArray_dcomplex(prhs[17], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in17_ = NULL;
    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != 0) {
        if( mxGetClassID(prhs[18]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in18_ = mxGetDoubles(prhs[18]);
#else
        in18_ = mxGetPr(prhs[18]);
#endif
    } else
        in18_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[21]++;
    MWF77_em3ddirect(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_, in11_, in12_, in13_, in14_, in15_, in16_, in17_, in18_);
    plhs[0] = mxCreateDoubleMatrix(dim37_, dim38_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[0], in13_, dim37_*dim38_);
    plhs[1] = mxCreateDoubleMatrix(dim40_, dim41_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[1], in15_, dim40_*dim41_);
    plhs[2] = mxCreateDoubleMatrix(dim43_, dim44_, mxCOMPLEX);
    mxWrapCopy_dcomplex(plhs[2], in17_, dim43_*dim44_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in1_)  mxFree(in1_);
    if (in2_)  mxFree(in2_);
    if (in4_)  mxFree(in4_);
    if (in5_)  mxFree(in5_);
    if (in6_)  mxFree(in6_);
    if (in7_)  mxFree(in7_);
    if (in8_)  mxFree(in8_);
    if (in9_)  mxFree(in9_);
    if (in10_)  mxFree(in10_);
    if (in12_)  mxFree(in12_);
    if (in13_)  mxFree(in13_);
    if (in14_)  mxFree(in14_);
    if (in15_)  mxFree(in15_);
    if (in16_)  mxFree(in16_);
    if (in17_)  mxFree(in17_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 1140 ----
 * stfmm3d(int64_t[1] nd, double[1] eps, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifstoklet, double[nd3, ns_stok] stoklet, int64_t[1] ifstrslet, double[nd3, ns_strs] strslet, double[nd3, ns_strs] strsvec, int64_t[1] ifrotlet, double[nd3, ns_rot] rotlet, double[nd3, ns_rot] rotvec, int64_t[1] ifdoublet, double[nd3, ns_doub] doublet, double[nd3, ns_doub] doubvec, int64_t[1] ifppreg, inout double[nd3, ns_pot] pot, inout double[nd, ns_pre] pre, inout double[nd9, ns_grad] grad, int64_t[1] nt, double[3, nt] targ, int64_t[1] ifppregtarg, inout double[nd3, nt_pot] pottarg, inout double[nd, nt_pre] pretarg, inout double[nd9, nt_grad] gradtarg, inout int64_t[1] ier);
 */
static const char* stubids22_ = "stfmm3d(i int64_t[x], i double[x], i int64_t[x], i double[xx], i int64_t[x], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], io int64_t[x])";

void mexStub22(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* eps        */
    int64_t*    in2_ =0; /* ns         */
    double*     in3_ =0; /* sources    */
    int64_t*    in4_ =0; /* ifstoklet  */
    double*     in5_ =0; /* stoklet    */
    int64_t*    in6_ =0; /* ifstrslet  */
    double*     in7_ =0; /* strslet    */
    double*     in8_ =0; /* strsvec    */
    int64_t*    in9_ =0; /* ifrotlet   */
    double*     in10_ =0; /* rotlet     */
    double*     in11_ =0; /* rotvec     */
    int64_t*    in12_ =0; /* ifdoublet  */
    double*     in13_ =0; /* doublet    */
    double*     in14_ =0; /* doubvec    */
    int64_t*    in15_ =0; /* ifppreg    */
    double*     in16_ =0; /* pot        */
    double*     in17_ =0; /* pre        */
    double*     in18_ =0; /* grad       */
    int64_t*    in19_ =0; /* nt         */
    double*     in20_ =0; /* targ       */
    int64_t*    in21_ =0; /* ifppregtarg */
    double*     in22_ =0; /* pottarg    */
    double*     in23_ =0; /* pretarg    */
    double*     in24_ =0; /* gradtarg   */
    int64_t*    in25_ =0; /* ier        */
    mwSize      dim26_;   /* 1          */
    mwSize      dim27_;   /* 1          */
    mwSize      dim28_;   /* 1          */
    mwSize      dim29_;   /* 3          */
    mwSize      dim30_;   /* ns         */
    mwSize      dim31_;   /* 1          */
    mwSize      dim32_;   /* nd3        */
    mwSize      dim33_;   /* ns_stok    */
    mwSize      dim34_;   /* 1          */
    mwSize      dim35_;   /* nd3        */
    mwSize      dim36_;   /* ns_strs    */
    mwSize      dim37_;   /* nd3        */
    mwSize      dim38_;   /* ns_strs    */
    mwSize      dim39_;   /* 1          */
    mwSize      dim40_;   /* nd3        */
    mwSize      dim41_;   /* ns_rot     */
    mwSize      dim42_;   /* nd3        */
    mwSize      dim43_;   /* ns_rot     */
    mwSize      dim44_;   /* 1          */
    mwSize      dim45_;   /* nd3        */
    mwSize      dim46_;   /* ns_doub    */
    mwSize      dim47_;   /* nd3        */
    mwSize      dim48_;   /* ns_doub    */
    mwSize      dim49_;   /* 1          */
    mwSize      dim50_;   /* nd3        */
    mwSize      dim51_;   /* ns_pot     */
    mwSize      dim52_;   /* nd         */
    mwSize      dim53_;   /* ns_pre     */
    mwSize      dim54_;   /* nd9        */
    mwSize      dim55_;   /* ns_grad    */
    mwSize      dim56_;   /* 1          */
    mwSize      dim57_;   /* 3          */
    mwSize      dim58_;   /* nt         */
    mwSize      dim59_;   /* 1          */
    mwSize      dim60_;   /* nd3        */
    mwSize      dim61_;   /* nt_pot     */
    mwSize      dim62_;   /* nd         */
    mwSize      dim63_;   /* nt_pre     */
    mwSize      dim64_;   /* nd9        */
    mwSize      dim65_;   /* nt_grad    */
    mwSize      dim66_;   /* 1          */

    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);
    dim28_ = (mwSize) mxWrapGetScalar(prhs[28], &mw_err_txt_);
    dim29_ = (mwSize) mxWrapGetScalar(prhs[29], &mw_err_txt_);
    dim30_ = (mwSize) mxWrapGetScalar(prhs[30], &mw_err_txt_);
    dim31_ = (mwSize) mxWrapGetScalar(prhs[31], &mw_err_txt_);
    dim32_ = (mwSize) mxWrapGetScalar(prhs[32], &mw_err_txt_);
    dim33_ = (mwSize) mxWrapGetScalar(prhs[33], &mw_err_txt_);
    dim34_ = (mwSize) mxWrapGetScalar(prhs[34], &mw_err_txt_);
    dim35_ = (mwSize) mxWrapGetScalar(prhs[35], &mw_err_txt_);
    dim36_ = (mwSize) mxWrapGetScalar(prhs[36], &mw_err_txt_);
    dim37_ = (mwSize) mxWrapGetScalar(prhs[37], &mw_err_txt_);
    dim38_ = (mwSize) mxWrapGetScalar(prhs[38], &mw_err_txt_);
    dim39_ = (mwSize) mxWrapGetScalar(prhs[39], &mw_err_txt_);
    dim40_ = (mwSize) mxWrapGetScalar(prhs[40], &mw_err_txt_);
    dim41_ = (mwSize) mxWrapGetScalar(prhs[41], &mw_err_txt_);
    dim42_ = (mwSize) mxWrapGetScalar(prhs[42], &mw_err_txt_);
    dim43_ = (mwSize) mxWrapGetScalar(prhs[43], &mw_err_txt_);
    dim44_ = (mwSize) mxWrapGetScalar(prhs[44], &mw_err_txt_);
    dim45_ = (mwSize) mxWrapGetScalar(prhs[45], &mw_err_txt_);
    dim46_ = (mwSize) mxWrapGetScalar(prhs[46], &mw_err_txt_);
    dim47_ = (mwSize) mxWrapGetScalar(prhs[47], &mw_err_txt_);
    dim48_ = (mwSize) mxWrapGetScalar(prhs[48], &mw_err_txt_);
    dim49_ = (mwSize) mxWrapGetScalar(prhs[49], &mw_err_txt_);
    dim50_ = (mwSize) mxWrapGetScalar(prhs[50], &mw_err_txt_);
    dim51_ = (mwSize) mxWrapGetScalar(prhs[51], &mw_err_txt_);
    dim52_ = (mwSize) mxWrapGetScalar(prhs[52], &mw_err_txt_);
    dim53_ = (mwSize) mxWrapGetScalar(prhs[53], &mw_err_txt_);
    dim54_ = (mwSize) mxWrapGetScalar(prhs[54], &mw_err_txt_);
    dim55_ = (mwSize) mxWrapGetScalar(prhs[55], &mw_err_txt_);
    dim56_ = (mwSize) mxWrapGetScalar(prhs[56], &mw_err_txt_);
    dim57_ = (mwSize) mxWrapGetScalar(prhs[57], &mw_err_txt_);
    dim58_ = (mwSize) mxWrapGetScalar(prhs[58], &mw_err_txt_);
    dim59_ = (mwSize) mxWrapGetScalar(prhs[59], &mw_err_txt_);
    dim60_ = (mwSize) mxWrapGetScalar(prhs[60], &mw_err_txt_);
    dim61_ = (mwSize) mxWrapGetScalar(prhs[61], &mw_err_txt_);
    dim62_ = (mwSize) mxWrapGetScalar(prhs[62], &mw_err_txt_);
    dim63_ = (mwSize) mxWrapGetScalar(prhs[63], &mw_err_txt_);
    dim64_ = (mwSize) mxWrapGetScalar(prhs[64], &mw_err_txt_);
    dim65_ = (mwSize) mxWrapGetScalar(prhs[65], &mw_err_txt_);
    dim66_ = (mwSize) mxWrapGetScalar(prhs[66], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim26_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != dim27_) {
        mw_err_txt_ = "Bad argument size: eps";        goto mw_err_label;
    }

    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != dim28_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[3]) != dim29_ ||
        mxGetN(prhs[3]) != dim30_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != dim31_) {
        mw_err_txt_ = "Bad argument size: ifstoklet";        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim32_ ||
        mxGetN(prhs[5]) != dim33_) {
        mw_err_txt_ = "Bad argument size: stoklet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim34_) {
        mw_err_txt_ = "Bad argument size: ifstrslet";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim35_ ||
        mxGetN(prhs[7]) != dim36_) {
        mw_err_txt_ = "Bad argument size: strslet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim37_ ||
        mxGetN(prhs[8]) != dim38_) {
        mw_err_txt_ = "Bad argument size: strsvec";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim39_) {
        mw_err_txt_ = "Bad argument size: ifrotlet";        goto mw_err_label;
    }

    if (mxGetM(prhs[10]) != dim40_ ||
        mxGetN(prhs[10]) != dim41_) {
        mw_err_txt_ = "Bad argument size: rotlet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[11]) != dim42_ ||
        mxGetN(prhs[11]) != dim43_) {
        mw_err_txt_ = "Bad argument size: rotvec";
        goto mw_err_label;
    }

    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != dim44_) {
        mw_err_txt_ = "Bad argument size: ifdoublet";        goto mw_err_label;
    }

    if (mxGetM(prhs[13]) != dim45_ ||
        mxGetN(prhs[13]) != dim46_) {
        mw_err_txt_ = "Bad argument size: doublet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[14]) != dim47_ ||
        mxGetN(prhs[14]) != dim48_) {
        mw_err_txt_ = "Bad argument size: doubvec";
        goto mw_err_label;
    }

    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != dim49_) {
        mw_err_txt_ = "Bad argument size: ifppreg";        goto mw_err_label;
    }

    if (mxGetM(prhs[16]) != dim50_ ||
        mxGetN(prhs[16]) != dim51_) {
        mw_err_txt_ = "Bad argument size: pot";
        goto mw_err_label;
    }

    if (mxGetM(prhs[17]) != dim52_ ||
        mxGetN(prhs[17]) != dim53_) {
        mw_err_txt_ = "Bad argument size: pre";
        goto mw_err_label;
    }

    if (mxGetM(prhs[18]) != dim54_ ||
        mxGetN(prhs[18]) != dim55_) {
        mw_err_txt_ = "Bad argument size: grad";
        goto mw_err_label;
    }

    if (mxGetM(prhs[19])*mxGetN(prhs[19]) != dim56_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[20]) != dim57_ ||
        mxGetN(prhs[20]) != dim58_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[21])*mxGetN(prhs[21]) != dim59_) {
        mw_err_txt_ = "Bad argument size: ifppregtarg";        goto mw_err_label;
    }

    if (mxGetM(prhs[22]) != dim60_ ||
        mxGetN(prhs[22]) != dim61_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[23]) != dim62_ ||
        mxGetN(prhs[23]) != dim63_) {
        mw_err_txt_ = "Bad argument size: pretarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[24]) != dim64_ ||
        mxGetN(prhs[24]) != dim65_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[25])*mxGetN(prhs[25]) != dim66_) {
        mw_err_txt_ = "Bad argument size: ier";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        in2_ = mxWrapGetArray_int64_t(prhs[2], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        if( mxGetClassID(prhs[3]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in3_ = mxGetDoubles(prhs[3]);
#else
        in3_ = mxGetPr(prhs[3]);
#endif
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        in4_ = mxWrapGetArray_int64_t(prhs[4], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in7_ = mxGetDoubles(prhs[7]);
#else
        in7_ = mxGetPr(prhs[7]);
#endif
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in8_ = mxGetDoubles(prhs[8]);
#else
        in8_ = mxGetPr(prhs[8]);
#endif
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        in9_ = mxWrapGetArray_int64_t(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        if( mxGetClassID(prhs[10]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in10_ = mxGetDoubles(prhs[10]);
#else
        in10_ = mxGetPr(prhs[10]);
#endif
    } else
        in10_ = NULL;
    if (mxGetM(prhs[11])*mxGetN(prhs[11]) != 0) {
        if( mxGetClassID(prhs[11]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in11_ = mxGetDoubles(prhs[11]);
#else
        in11_ = mxGetPr(prhs[11]);
#endif
    } else
        in11_ = NULL;
    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != 0) {
        in12_ = mxWrapGetArray_int64_t(prhs[12], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in12_ = NULL;
    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != 0) {
        if( mxGetClassID(prhs[13]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in13_ = mxGetDoubles(prhs[13]);
#else
        in13_ = mxGetPr(prhs[13]);
#endif
    } else
        in13_ = NULL;
    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != 0) {
        if( mxGetClassID(prhs[14]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in14_ = mxGetDoubles(prhs[14]);
#else
        in14_ = mxGetPr(prhs[14]);
#endif
    } else
        in14_ = NULL;
    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != 0) {
        in15_ = mxWrapGetArray_int64_t(prhs[15], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in15_ = NULL;
    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != 0) {
        in16_ = mxWrapGetArray_double(prhs[16], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in16_ = NULL;
    if (mxGetM(prhs[17])*mxGetN(prhs[17]) != 0) {
        in17_ = mxWrapGetArray_double(prhs[17], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in17_ = NULL;
    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != 0) {
        in18_ = mxWrapGetArray_double(prhs[18], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in18_ = NULL;
    if (mxGetM(prhs[19])*mxGetN(prhs[19]) != 0) {
        in19_ = mxWrapGetArray_int64_t(prhs[19], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in19_ = NULL;
    if (mxGetM(prhs[20])*mxGetN(prhs[20]) != 0) {
        if( mxGetClassID(prhs[20]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in20_ = mxGetDoubles(prhs[20]);
#else
        in20_ = mxGetPr(prhs[20]);
#endif
    } else
        in20_ = NULL;
    if (mxGetM(prhs[21])*mxGetN(prhs[21]) != 0) {
        in21_ = mxWrapGetArray_int64_t(prhs[21], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in21_ = NULL;
    if (mxGetM(prhs[22])*mxGetN(prhs[22]) != 0) {
        in22_ = mxWrapGetArray_double(prhs[22], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in22_ = NULL;
    if (mxGetM(prhs[23])*mxGetN(prhs[23]) != 0) {
        in23_ = mxWrapGetArray_double(prhs[23], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in23_ = NULL;
    if (mxGetM(prhs[24])*mxGetN(prhs[24]) != 0) {
        in24_ = mxWrapGetArray_double(prhs[24], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in24_ = NULL;
    if (mxGetM(prhs[25])*mxGetN(prhs[25]) != 0) {
        in25_ = mxWrapGetArray_int64_t(prhs[25], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in25_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[22]++;
    MWF77_stfmm3d(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_, in11_, in12_, in13_, in14_, in15_, in16_, in17_, in18_, in19_, in20_, in21_, in22_, in23_, in24_, in25_);
    plhs[0] = mxCreateDoubleMatrix(dim50_, dim51_, mxREAL);
    mxWrapCopy_double(plhs[0], in16_, dim50_*dim51_);
    plhs[1] = mxCreateDoubleMatrix(dim52_, dim53_, mxREAL);
    mxWrapCopy_double(plhs[1], in17_, dim52_*dim53_);
    plhs[2] = mxCreateDoubleMatrix(dim54_, dim55_, mxREAL);
    mxWrapCopy_double(plhs[2], in18_, dim54_*dim55_);
    plhs[3] = mxCreateDoubleMatrix(dim60_, dim61_, mxREAL);
    mxWrapCopy_double(plhs[3], in22_, dim60_*dim61_);
    plhs[4] = mxCreateDoubleMatrix(dim62_, dim63_, mxREAL);
    mxWrapCopy_double(plhs[4], in23_, dim62_*dim63_);
    plhs[5] = mxCreateDoubleMatrix(dim64_, dim65_, mxREAL);
    mxWrapCopy_double(plhs[5], in24_, dim64_*dim65_);
    plhs[6] = mxCreateDoubleMatrix(dim66_, 1, mxREAL);
    mxWrapCopy_int64_t(plhs[6], in25_, dim66_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in2_)  mxFree(in2_);
    if (in4_)  mxFree(in4_);
    if (in6_)  mxFree(in6_);
    if (in9_)  mxFree(in9_);
    if (in12_)  mxFree(in12_);
    if (in15_)  mxFree(in15_);
    if (in16_)  mxFree(in16_);
    if (in17_)  mxFree(in17_);
    if (in18_)  mxFree(in18_);
    if (in19_)  mxFree(in19_);
    if (in21_)  mxFree(in21_);
    if (in22_)  mxFree(in22_);
    if (in23_)  mxFree(in23_);
    if (in24_)  mxFree(in24_);
    if (in25_)  mxFree(in25_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ---- fmm3d.mw: 1272 ----
 * st3ddirectstokstrsrotdoubg(int64_t[1] nd, double[3, ns] sources, double[nd3, ns_stok] stoklet, int64_t[1] ifstrslet, double[nd3, ns_strs] strslet, double[nd3, ns_strs] strsvec, int64_t[1] ifrotlet, double[nd3, ns_rot] rotlet, double[nd3, ns_rot] rotvec, int64_t[1] ifdoublet, double[nd3, ns_doub] doublet, double[nd3, ns_doub] doubvec, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd3, nt] pottarg, inout double[nd, nt] pretarg, inout double[nd9, nt] gradtarg, double[1] thresh);
 */
static const char* stubids23_ = "st3ddirectstokstrsrotdoubg(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i double[x])";

void mexStub23(int nlhs, mxArray* plhs[],
              int nrhs, const mxArray* prhs[])
{
    const char* mw_err_txt_ = 0;
    int64_t*    in0_ =0; /* nd         */
    double*     in1_ =0; /* sources    */
    double*     in2_ =0; /* stoklet    */
    int64_t*    in3_ =0; /* ifstrslet  */
    double*     in4_ =0; /* strslet    */
    double*     in5_ =0; /* strsvec    */
    int64_t*    in6_ =0; /* ifrotlet   */
    double*     in7_ =0; /* rotlet     */
    double*     in8_ =0; /* rotvec     */
    int64_t*    in9_ =0; /* ifdoublet  */
    double*     in10_ =0; /* doublet    */
    double*     in11_ =0; /* doubvec    */
    int64_t*    in12_ =0; /* ns         */
    double*     in13_ =0; /* targ       */
    int64_t*    in14_ =0; /* nt         */
    double*     in15_ =0; /* pottarg    */
    double*     in16_ =0; /* pretarg    */
    double*     in17_ =0; /* gradtarg   */
    double*     in18_ =0; /* thresh     */
    mwSize      dim19_;   /* 1          */
    mwSize      dim20_;   /* 3          */
    mwSize      dim21_;   /* ns         */
    mwSize      dim22_;   /* nd3        */
    mwSize      dim23_;   /* ns_stok    */
    mwSize      dim24_;   /* 1          */
    mwSize      dim25_;   /* nd3        */
    mwSize      dim26_;   /* ns_strs    */
    mwSize      dim27_;   /* nd3        */
    mwSize      dim28_;   /* ns_strs    */
    mwSize      dim29_;   /* 1          */
    mwSize      dim30_;   /* nd3        */
    mwSize      dim31_;   /* ns_rot     */
    mwSize      dim32_;   /* nd3        */
    mwSize      dim33_;   /* ns_rot     */
    mwSize      dim34_;   /* 1          */
    mwSize      dim35_;   /* nd3        */
    mwSize      dim36_;   /* ns_doub    */
    mwSize      dim37_;   /* nd3        */
    mwSize      dim38_;   /* ns_doub    */
    mwSize      dim39_;   /* 1          */
    mwSize      dim40_;   /* 3          */
    mwSize      dim41_;   /* nt         */
    mwSize      dim42_;   /* 1          */
    mwSize      dim43_;   /* nd3        */
    mwSize      dim44_;   /* nt         */
    mwSize      dim45_;   /* nd         */
    mwSize      dim46_;   /* nt         */
    mwSize      dim47_;   /* nd9        */
    mwSize      dim48_;   /* nt         */
    mwSize      dim49_;   /* 1          */

    dim19_ = (mwSize) mxWrapGetScalar(prhs[19], &mw_err_txt_);
    dim20_ = (mwSize) mxWrapGetScalar(prhs[20], &mw_err_txt_);
    dim21_ = (mwSize) mxWrapGetScalar(prhs[21], &mw_err_txt_);
    dim22_ = (mwSize) mxWrapGetScalar(prhs[22], &mw_err_txt_);
    dim23_ = (mwSize) mxWrapGetScalar(prhs[23], &mw_err_txt_);
    dim24_ = (mwSize) mxWrapGetScalar(prhs[24], &mw_err_txt_);
    dim25_ = (mwSize) mxWrapGetScalar(prhs[25], &mw_err_txt_);
    dim26_ = (mwSize) mxWrapGetScalar(prhs[26], &mw_err_txt_);
    dim27_ = (mwSize) mxWrapGetScalar(prhs[27], &mw_err_txt_);
    dim28_ = (mwSize) mxWrapGetScalar(prhs[28], &mw_err_txt_);
    dim29_ = (mwSize) mxWrapGetScalar(prhs[29], &mw_err_txt_);
    dim30_ = (mwSize) mxWrapGetScalar(prhs[30], &mw_err_txt_);
    dim31_ = (mwSize) mxWrapGetScalar(prhs[31], &mw_err_txt_);
    dim32_ = (mwSize) mxWrapGetScalar(prhs[32], &mw_err_txt_);
    dim33_ = (mwSize) mxWrapGetScalar(prhs[33], &mw_err_txt_);
    dim34_ = (mwSize) mxWrapGetScalar(prhs[34], &mw_err_txt_);
    dim35_ = (mwSize) mxWrapGetScalar(prhs[35], &mw_err_txt_);
    dim36_ = (mwSize) mxWrapGetScalar(prhs[36], &mw_err_txt_);
    dim37_ = (mwSize) mxWrapGetScalar(prhs[37], &mw_err_txt_);
    dim38_ = (mwSize) mxWrapGetScalar(prhs[38], &mw_err_txt_);
    dim39_ = (mwSize) mxWrapGetScalar(prhs[39], &mw_err_txt_);
    dim40_ = (mwSize) mxWrapGetScalar(prhs[40], &mw_err_txt_);
    dim41_ = (mwSize) mxWrapGetScalar(prhs[41], &mw_err_txt_);
    dim42_ = (mwSize) mxWrapGetScalar(prhs[42], &mw_err_txt_);
    dim43_ = (mwSize) mxWrapGetScalar(prhs[43], &mw_err_txt_);
    dim44_ = (mwSize) mxWrapGetScalar(prhs[44], &mw_err_txt_);
    dim45_ = (mwSize) mxWrapGetScalar(prhs[45], &mw_err_txt_);
    dim46_ = (mwSize) mxWrapGetScalar(prhs[46], &mw_err_txt_);
    dim47_ = (mwSize) mxWrapGetScalar(prhs[47], &mw_err_txt_);
    dim48_ = (mwSize) mxWrapGetScalar(prhs[48], &mw_err_txt_);
    dim49_ = (mwSize) mxWrapGetScalar(prhs[49], &mw_err_txt_);

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != dim19_) {
        mw_err_txt_ = "Bad argument size: nd";        goto mw_err_label;
    }

    if (mxGetM(prhs[1]) != dim20_ ||
        mxGetN(prhs[1]) != dim21_) {
        mw_err_txt_ = "Bad argument size: sources";
        goto mw_err_label;
    }

    if (mxGetM(prhs[2]) != dim22_ ||
        mxGetN(prhs[2]) != dim23_) {
        mw_err_txt_ = "Bad argument size: stoklet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != dim24_) {
        mw_err_txt_ = "Bad argument size: ifstrslet";        goto mw_err_label;
    }

    if (mxGetM(prhs[4]) != dim25_ ||
        mxGetN(prhs[4]) != dim26_) {
        mw_err_txt_ = "Bad argument size: strslet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[5]) != dim27_ ||
        mxGetN(prhs[5]) != dim28_) {
        mw_err_txt_ = "Bad argument size: strsvec";
        goto mw_err_label;
    }

    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != dim29_) {
        mw_err_txt_ = "Bad argument size: ifrotlet";        goto mw_err_label;
    }

    if (mxGetM(prhs[7]) != dim30_ ||
        mxGetN(prhs[7]) != dim31_) {
        mw_err_txt_ = "Bad argument size: rotlet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[8]) != dim32_ ||
        mxGetN(prhs[8]) != dim33_) {
        mw_err_txt_ = "Bad argument size: rotvec";
        goto mw_err_label;
    }

    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != dim34_) {
        mw_err_txt_ = "Bad argument size: ifdoublet";        goto mw_err_label;
    }

    if (mxGetM(prhs[10]) != dim35_ ||
        mxGetN(prhs[10]) != dim36_) {
        mw_err_txt_ = "Bad argument size: doublet";
        goto mw_err_label;
    }

    if (mxGetM(prhs[11]) != dim37_ ||
        mxGetN(prhs[11]) != dim38_) {
        mw_err_txt_ = "Bad argument size: doubvec";
        goto mw_err_label;
    }

    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != dim39_) {
        mw_err_txt_ = "Bad argument size: ns";        goto mw_err_label;
    }

    if (mxGetM(prhs[13]) != dim40_ ||
        mxGetN(prhs[13]) != dim41_) {
        mw_err_txt_ = "Bad argument size: targ";
        goto mw_err_label;
    }

    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != dim42_) {
        mw_err_txt_ = "Bad argument size: nt";        goto mw_err_label;
    }

    if (mxGetM(prhs[15]) != dim43_ ||
        mxGetN(prhs[15]) != dim44_) {
        mw_err_txt_ = "Bad argument size: pottarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[16]) != dim45_ ||
        mxGetN(prhs[16]) != dim46_) {
        mw_err_txt_ = "Bad argument size: pretarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[17]) != dim47_ ||
        mxGetN(prhs[17]) != dim48_) {
        mw_err_txt_ = "Bad argument size: gradtarg";
        goto mw_err_label;
    }

    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != dim49_) {
        mw_err_txt_ = "Bad argument size: thresh";        goto mw_err_label;
    }

    if (mxGetM(prhs[0])*mxGetN(prhs[0]) != 0) {
        in0_ = mxWrapGetArray_int64_t(prhs[0], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in0_ = NULL;
    if (mxGetM(prhs[1])*mxGetN(prhs[1]) != 0) {
        if( mxGetClassID(prhs[1]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in1_ = mxGetDoubles(prhs[1]);
#else
        in1_ = mxGetPr(prhs[1]);
#endif
    } else
        in1_ = NULL;
    if (mxGetM(prhs[2])*mxGetN(prhs[2]) != 0) {
        if( mxGetClassID(prhs[2]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in2_ = mxGetDoubles(prhs[2]);
#else
        in2_ = mxGetPr(prhs[2]);
#endif
    } else
        in2_ = NULL;
    if (mxGetM(prhs[3])*mxGetN(prhs[3]) != 0) {
        in3_ = mxWrapGetArray_int64_t(prhs[3], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in3_ = NULL;
    if (mxGetM(prhs[4])*mxGetN(prhs[4]) != 0) {
        if( mxGetClassID(prhs[4]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in4_ = mxGetDoubles(prhs[4]);
#else
        in4_ = mxGetPr(prhs[4]);
#endif
    } else
        in4_ = NULL;
    if (mxGetM(prhs[5])*mxGetN(prhs[5]) != 0) {
        if( mxGetClassID(prhs[5]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in5_ = mxGetDoubles(prhs[5]);
#else
        in5_ = mxGetPr(prhs[5]);
#endif
    } else
        in5_ = NULL;
    if (mxGetM(prhs[6])*mxGetN(prhs[6]) != 0) {
        in6_ = mxWrapGetArray_int64_t(prhs[6], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in6_ = NULL;
    if (mxGetM(prhs[7])*mxGetN(prhs[7]) != 0) {
        if( mxGetClassID(prhs[7]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in7_ = mxGetDoubles(prhs[7]);
#else
        in7_ = mxGetPr(prhs[7]);
#endif
    } else
        in7_ = NULL;
    if (mxGetM(prhs[8])*mxGetN(prhs[8]) != 0) {
        if( mxGetClassID(prhs[8]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in8_ = mxGetDoubles(prhs[8]);
#else
        in8_ = mxGetPr(prhs[8]);
#endif
    } else
        in8_ = NULL;
    if (mxGetM(prhs[9])*mxGetN(prhs[9]) != 0) {
        in9_ = mxWrapGetArray_int64_t(prhs[9], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in9_ = NULL;
    if (mxGetM(prhs[10])*mxGetN(prhs[10]) != 0) {
        if( mxGetClassID(prhs[10]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in10_ = mxGetDoubles(prhs[10]);
#else
        in10_ = mxGetPr(prhs[10]);
#endif
    } else
        in10_ = NULL;
    if (mxGetM(prhs[11])*mxGetN(prhs[11]) != 0) {
        if( mxGetClassID(prhs[11]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in11_ = mxGetDoubles(prhs[11]);
#else
        in11_ = mxGetPr(prhs[11]);
#endif
    } else
        in11_ = NULL;
    if (mxGetM(prhs[12])*mxGetN(prhs[12]) != 0) {
        in12_ = mxWrapGetArray_int64_t(prhs[12], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in12_ = NULL;
    if (mxGetM(prhs[13])*mxGetN(prhs[13]) != 0) {
        if( mxGetClassID(prhs[13]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in13_ = mxGetDoubles(prhs[13]);
#else
        in13_ = mxGetPr(prhs[13]);
#endif
    } else
        in13_ = NULL;
    if (mxGetM(prhs[14])*mxGetN(prhs[14]) != 0) {
        in14_ = mxWrapGetArray_int64_t(prhs[14], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in14_ = NULL;
    if (mxGetM(prhs[15])*mxGetN(prhs[15]) != 0) {
        in15_ = mxWrapGetArray_double(prhs[15], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in15_ = NULL;
    if (mxGetM(prhs[16])*mxGetN(prhs[16]) != 0) {
        in16_ = mxWrapGetArray_double(prhs[16], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in16_ = NULL;
    if (mxGetM(prhs[17])*mxGetN(prhs[17]) != 0) {
        in17_ = mxWrapGetArray_double(prhs[17], &mw_err_txt_);
        if (mw_err_txt_)
            goto mw_err_label;
    } else
        in17_ = NULL;
    if (mxGetM(prhs[18])*mxGetN(prhs[18]) != 0) {
        if( mxGetClassID(prhs[18]) != mxDOUBLE_CLASS )
            mw_err_txt_ = "Invalid array argument, mxDOUBLE_CLASS expected";
        if (mw_err_txt_) goto mw_err_label;
#if MX_HAS_INTERLEAVED_COMPLEX
        in18_ = mxGetDoubles(prhs[18]);
#else
        in18_ = mxGetPr(prhs[18]);
#endif
    } else
        in18_ = NULL;
    if (mexprofrecord_)
        mexprofrecord_[23]++;
    MWF77_st3ddirectstokstrsrotdoubg(in0_, in1_, in2_, in3_, in4_, in5_, in6_, in7_, in8_, in9_, in10_, in11_, in12_, in13_, in14_, in15_, in16_, in17_, in18_);
    plhs[0] = mxCreateDoubleMatrix(dim43_, dim44_, mxREAL);
    mxWrapCopy_double(plhs[0], in15_, dim43_*dim44_);
    plhs[1] = mxCreateDoubleMatrix(dim45_, dim46_, mxREAL);
    mxWrapCopy_double(plhs[1], in16_, dim45_*dim46_);
    plhs[2] = mxCreateDoubleMatrix(dim47_, dim48_, mxREAL);
    mxWrapCopy_double(plhs[2], in17_, dim47_*dim48_);

mw_err_label:
    if (in0_)  mxFree(in0_);
    if (in3_)  mxFree(in3_);
    if (in6_)  mxFree(in6_);
    if (in9_)  mxFree(in9_);
    if (in12_)  mxFree(in12_);
    if (in14_)  mxFree(in14_);
    if (in15_)  mxFree(in15_);
    if (in16_)  mxFree(in16_);
    if (in17_)  mxFree(in17_);
    if (mw_err_txt_)
        mexErrMsgTxt(mw_err_txt_);
}

/* ----
 */
void mexFunction(int nlhs, mxArray* plhs[],
                 int nrhs, const mxArray* prhs[])
{
    char id[512];
    if (nrhs == 0) {
        mexPrintf("Mex function installed\n");
        return;
    }

    if (mxGetString(prhs[0], id, sizeof(id)) != 0)
        mexErrMsgTxt("Identifier should be a string");
    else if (strcmp(id, stubids1_) == 0)
        mexStub1(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids2_) == 0)
        mexStub2(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids3_) == 0)
        mexStub3(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids4_) == 0)
        mexStub4(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids5_) == 0)
        mexStub5(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids6_) == 0)
        mexStub6(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids7_) == 0)
        mexStub7(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids8_) == 0)
        mexStub8(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids9_) == 0)
        mexStub9(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids10_) == 0)
        mexStub10(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids11_) == 0)
        mexStub11(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids12_) == 0)
        mexStub12(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids13_) == 0)
        mexStub13(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids14_) == 0)
        mexStub14(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids15_) == 0)
        mexStub15(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids16_) == 0)
        mexStub16(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids17_) == 0)
        mexStub17(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids18_) == 0)
        mexStub18(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids19_) == 0)
        mexStub19(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids20_) == 0)
        mexStub20(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids21_) == 0)
        mexStub21(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids22_) == 0)
        mexStub22(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, stubids23_) == 0)
        mexStub23(nlhs,plhs, nrhs-1,prhs+1);
    else if (strcmp(id, "*profile on*") == 0) {
        if (!mexprofrecord_) {
            mexprofrecord_ = (int*) malloc(24 * sizeof(int));
            mexLock();
        }
        memset(mexprofrecord_, 0, 24 * sizeof(int));
    } else if (strcmp(id, "*profile off*") == 0) {
        if (mexprofrecord_) {
            free(mexprofrecord_);
            mexUnlock();
        }
        mexprofrecord_ = NULL;
    } else if (strcmp(id, "*profile report*") == 0) {
        if (!mexprofrecord_)
            mexPrintf("Profiler inactive\n");
        mexPrintf("%d calls to fmm3d.mw:187\n", mexprofrecord_[1]);
        mexPrintf("%d calls to fmm3d.mw:202\n", mexprofrecord_[2]);
        mexPrintf("%d calls to fmm3d.mw:284\n", mexprofrecord_[3]);
        mexPrintf("%d calls to fmm3d.mw:287\n", mexprofrecord_[4]);
        mexPrintf("%d calls to fmm3d.mw:290\n", mexprofrecord_[5]);
        mexPrintf("%d calls to fmm3d.mw:296\n", mexprofrecord_[6]);
        mexPrintf("%d calls to fmm3d.mw:299\n", mexprofrecord_[7]);
        mexPrintf("%d calls to fmm3d.mw:302\n", mexprofrecord_[8]);
        mexPrintf("%d calls to fmm3d.mw:491\n", mexprofrecord_[9]);
        mexPrintf("%d calls to fmm3d.mw:506\n", mexprofrecord_[10]);
        mexPrintf("%d calls to fmm3d.mw:593\n", mexprofrecord_[11]);
        mexPrintf("%d calls to fmm3d.mw:596\n", mexprofrecord_[12]);
        mexPrintf("%d calls to fmm3d.mw:599\n", mexprofrecord_[13]);
        mexPrintf("%d calls to fmm3d.mw:605\n", mexprofrecord_[14]);
        mexPrintf("%d calls to fmm3d.mw:608\n", mexprofrecord_[15]);
        mexPrintf("%d calls to fmm3d.mw:611\n", mexprofrecord_[16]);
        mexPrintf("%d calls to fmm3d.mw:618\n", mexprofrecord_[17]);
        mexPrintf("%d calls to fmm3d.mw:621\n", mexprofrecord_[18]);
        mexPrintf("%d calls to fmm3d.mw:624\n", mexprofrecord_[19]);
        mexPrintf("%d calls to fmm3d.mw:785\n", mexprofrecord_[20]);
        mexPrintf("%d calls to fmm3d.mw:892\n", mexprofrecord_[21]);
        mexPrintf("%d calls to fmm3d.mw:1140\n", mexprofrecord_[22]);
        mexPrintf("%d calls to fmm3d.mw:1272\n", mexprofrecord_[23]);
    } else if (strcmp(id, "*profile log*") == 0) {
        FILE* logfp;
        if (nrhs != 2 || mxGetString(prhs[1], id, sizeof(id)) != 0)
            mexErrMsgTxt("Must have two string arguments");
        logfp = fopen(id, "w+");
        if (!logfp)
            mexErrMsgTxt("Cannot open log for output");
        if (!mexprofrecord_)
            fprintf(logfp, "Profiler inactive\n");
        fprintf(logfp, "%d calls to fmm3d.mw:187\n", mexprofrecord_[1]);
        fprintf(logfp, "%d calls to fmm3d.mw:202\n", mexprofrecord_[2]);
        fprintf(logfp, "%d calls to fmm3d.mw:284\n", mexprofrecord_[3]);
        fprintf(logfp, "%d calls to fmm3d.mw:287\n", mexprofrecord_[4]);
        fprintf(logfp, "%d calls to fmm3d.mw:290\n", mexprofrecord_[5]);
        fprintf(logfp, "%d calls to fmm3d.mw:296\n", mexprofrecord_[6]);
        fprintf(logfp, "%d calls to fmm3d.mw:299\n", mexprofrecord_[7]);
        fprintf(logfp, "%d calls to fmm3d.mw:302\n", mexprofrecord_[8]);
        fprintf(logfp, "%d calls to fmm3d.mw:491\n", mexprofrecord_[9]);
        fprintf(logfp, "%d calls to fmm3d.mw:506\n", mexprofrecord_[10]);
        fprintf(logfp, "%d calls to fmm3d.mw:593\n", mexprofrecord_[11]);
        fprintf(logfp, "%d calls to fmm3d.mw:596\n", mexprofrecord_[12]);
        fprintf(logfp, "%d calls to fmm3d.mw:599\n", mexprofrecord_[13]);
        fprintf(logfp, "%d calls to fmm3d.mw:605\n", mexprofrecord_[14]);
        fprintf(logfp, "%d calls to fmm3d.mw:608\n", mexprofrecord_[15]);
        fprintf(logfp, "%d calls to fmm3d.mw:611\n", mexprofrecord_[16]);
        fprintf(logfp, "%d calls to fmm3d.mw:618\n", mexprofrecord_[17]);
        fprintf(logfp, "%d calls to fmm3d.mw:621\n", mexprofrecord_[18]);
        fprintf(logfp, "%d calls to fmm3d.mw:624\n", mexprofrecord_[19]);
        fprintf(logfp, "%d calls to fmm3d.mw:785\n", mexprofrecord_[20]);
        fprintf(logfp, "%d calls to fmm3d.mw:892\n", mexprofrecord_[21]);
        fprintf(logfp, "%d calls to fmm3d.mw:1140\n", mexprofrecord_[22]);
        fprintf(logfp, "%d calls to fmm3d.mw:1272\n", mexprofrecord_[23]);
        fclose(logfp);
    } else
        mexErrMsgTxt("Unknown identifier");
}

