2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2014 - Scilab Enterprises - Sylvain Genin
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
17 #include "special_functions_gw.hxx"
18 #include "function.hxx"
20 #include "overload.hxx"
25 #include "localization.h"
26 extern double C2F(dgammacody)(double*);
29 /*--------------------------------------------------------------------------*/
30 types::Function::ReturnValue sci_gamma(types::typed_list &in, int _iRetCount, types::typed_list &out)
34 Scierror(77, _("%s: Wrong number of input arguments: At least %d expected.\n"), "gamma", 1);
35 return types::Function::Error;
38 if (in.size() > 1 || in[0]->isDouble() == false)
40 std::wstring wstFuncName = L"%" + in[0]->getShortTypeStr() + L"_gamma";
41 return Overload::call(wstFuncName, in, _iRetCount, out);
44 /***** get data *****/
45 types::Double* pDblIn = in[0]->getAs<types::Double>();
47 if (pDblIn->isComplex() || pDblIn->getDims() > 2)
49 return Overload::call(L"%s_gamma", in, _iRetCount, out);
52 types::Double* pDblOut = new types::Double(pDblIn->getDims(), pDblIn->getDimsArray());
54 double* pDblValIn = pDblIn->getReal();
55 double* pDblValOut = pDblOut->getReal();
57 /***** perform operation *****/
58 for (int i = 0; i < pDblIn->getSize(); i++)
60 pDblValOut[i] = C2F(dgammacody)(pDblValIn + i);
63 /***** return data *****/
64 out.push_back(pDblOut);
65 return types::Function::OK;
67 /*--------------------------------------------------------------------------*/