File: sci_amell.c

package info (click to toggle)
scilab 6.0.1-10%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 365,292 kB
  • sloc: xml: 827,376; cpp: 273,125; ansic: 216,672; java: 190,706; fortran: 90,783; ml: 24,107; tcl: 16,853; sh: 13,608; makefile: 9,556; lex: 1,615; perl: 1,566; yacc: 1,263; php: 690; cs: 614
file content (65 lines) | stat: -rw-r--r-- 2,106 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2006 - INRIA - Allan CORNET
 * Copyright (C) 2009 - Digiteo - Vincent LIARD
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 */

#include "gw_signal.h"

#include "api_scilab.h"
#include "Scierror.h"
#include "localization.h"

extern int C2F(amell)(double *du, double *dk, double *dsn2, int *n);

int sci_amell(char *fname, void* pvApiCtx)
{
    int input_rows, input_cols, output_length, rows, cols;
    double *argument, *input, *output;
    double parameter;
    int *arg;

    CheckRhs(2, 2);
    CheckLhs(1, 1);
    getVarAddressFromPosition(pvApiCtx, 1, &arg);
    if (isVarComplex(pvApiCtx, arg))
    {
        Scierror(999, _("%s: Input argument #%d must be real.\n"), fname, 1);
        return 1;
    }
    getMatrixOfDouble(pvApiCtx, arg, &input_rows, &input_cols, &input);
    getVarAddressFromPosition(pvApiCtx, 2, &arg);
    if (isVarComplex(pvApiCtx, arg))
    {
        Scierror(999, _("%s: Input argument #%d must be real.\n"), fname, 2);
        return 1;
    }
    getMatrixOfDouble(pvApiCtx, arg, &rows, &cols, &argument);
    parameter = *argument;
    if (rows != 1 || cols != 1)
    {
        Scierror(999, _("%s: Wrong size for input argument #%d: A scalar expected.\n"), fname, 2);
        return 1;
    }
    if (parameter < 0 || parameter > 1)
    {
        Scierror(999, _("%s: Wrong value for input argument #%d: Must be in the interval [%s, %s].\n"), fname, "0", "1");
        return 1;
    }
    allocMatrixOfDouble(pvApiCtx, Rhs + 1, input_rows, input_cols, &output);
    output_length = input_rows * input_cols;
    C2F(amell)(input, &parameter, output, &output_length);
    LhsVar(1) = Rhs + 1;
    PutLhsVar();
    return 0;
}