Exemple #1
0
    public static void zaxpy(int n, Complex ca, Complex[] cx,
                             int incx, ref Complex[] cy, int incy, int xIndex = 0, int yIndex = 0)

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    ZAXPY adds a multiple of one complex <double> vector to another.
    //
    //  Discussion:
    //
    //    This routine uses double precision complex arithmetic.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    15 April 2006
    //
    //  Author:
    //
    //    C++ version by John Burkardt
    //
    //  Reference:
    //
    //    Jack Dongarra, Cleve Moler, Jim Bunch, Pete Stewart,
    //    LINPACK User's Guide,
    //    SIAM, 1979.
    //
    //    Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh,
    //    Basic Linear Algebra Subprograms for Fortran Usage,
    //    Algorithm 539,
    //    ACM Transactions on Mathematical Software,
    //    Volume 5, Number 3, September 1979, pages 308-323.
    //
    //  Parameters:
    //
    //    Input, int N, the number of elements in CX and CY.
    //
    //    Input, complex <double> CA, the multiplier of CX.
    //
    //    Input, complex <double> CX[], the first vector.
    //
    //    Input, int INCX, the increment between successive entries of CX.
    //
    //    Input/output, complex <double> CY[], the second vector.
    //    On output, CY(*) has been replaced by CY(*) + CA * CX(*).
    //
    //    Input, int INCY, the increment between successive entries of CY.
    //
    {
        int i;

        switch (n)
        {
        case <= 0:
            return;
        }

        if (BLAS0.zabs1(ca) == 0.0)
        {
            return;
        }

        if (incx != 1 || incy != 1)
        {
            int ix = incx switch
            {
Exemple #2
0
    public static int izamax(int n, Complex[] x, int incx, int index = 0)

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    IZAMAX indexes the complex <double> vector element of maximum absolute value.
    //
    //  Discussion:
    //
    //    This routine uses double precision complex arithmetic.
    //
    //    WARNING: This index is a 1-based index, not a 0-based index!
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    15 April 2006
    //
    //  Author:
    //
    //    C++ version by John Burkardt
    //
    //  Reference:
    //
    //    Jack Dongarra, Cleve Moler, Jim Bunch, Pete Stewart,
    //    LINPACK User's Guide,
    //    SIAM, 1979.
    //
    //    Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh,
    //    Basic Linear Algebra Subprograms for FORTRAN usage,
    //    ACM Transactions on Mathematical Software,
    //    Volume 5, Number 3, pages 308-323, 1979.
    //
    //  Parameters:
    //
    //    Input, int N, the number of entries in the vector.
    //
    //    Input, complex <double> X[], the vector.
    //
    //    Input, int INCX, the increment between successive entries of X.
    //
    //    Output, int IZAMAX, the index of the element of maximum
    //    absolute value.
    //
    {
        int    i;
        double smax;

        int value = 0;

        if (n < 1 || incx <= 0)
        {
            return(value);
        }

        value = 1;

        switch (n)
        {
        case 1:
            return(value);
        }

        if (incx != 1)
        {
            int ix = 0;
            smax = BLAS0.zabs1(x[index + 0]);
            ix  += incx;

            for (i = 1; i < n; i++)
            {
                if (smax < BLAS0.zabs1(x[index + ix]))
                {
                    value = i + 1;
                    smax  = BLAS0.zabs1(x[index + ix]);
                }

                ix += incx;
            }
        }
        else
        {
            smax = BLAS0.zabs1(x[index + 0]);
            for (i = 1; i < n; i++)
            {
                if (!(smax < BLAS0.zabs1(x[index + i])))
                {
                    continue;
                }

                value = i + 1;
                smax  = BLAS0.zabs1(x[index + i]);
            }
        }

        return(value);
    }