⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eigcg.src

📁 没有说明
💻 SRC
字号:
/*
** eigcg.src - Complex general eigenvalues/eigenvectors.
** (C) Copyright 1988-1998 by Aptech Systems, Inc.
** All Rights Reserved.
**
** This Software Product is PROPRIETARY SOURCE CODE OF APTECH
** SYSTEMS, INC.    This File Header must accompany all files using
** any portion, in whole or in part, of this Source Code.   In
** addition, the right to create such files is strictly limited by
** Section 2.A. of the GAUSS Applications License Agreement
** accompanying this Software Product.
**
** If you wish to distribute any portion of the proprietary Source
** Code, in whole or in part, you must first obtain written
** permission from Aptech Systems.
**
** These functions require GAUSS-386.
**
**      Format                                             Line
** ==============================================================
**     { var,vai } = EIGCG(xr,xi);                          28
**     { var,vai,ver,vei } = EIGCG2(xr,xi);                 83
*/

#include eig.ext

/*
**> eigcg
**
**  Purpose:    To compute the eigenvalues of a complex, general matrix.
**
**  Format:     { var,vai } = eigcg(xr,xi);
**
**  Input:      xr    NxN matrix, real part.
**
**              xi    NxN matrix, imaginary part.
**
**  Output:     var       Nx1 vector, real part of eigenvalues.
**
**              vai       Nx1 vector, imaginary part of eigenvalues.
**
**              _eigerr   global scalar, if all the eigenvalues can
**                        be determined _eigerr = 0,  otherwise _eigerr is set
**                        to the index of the eigenvalue that failed.  The
**                        eigenvalues for indices _eigerr+1 to N should be
**                        correct.
**
**  Remarks:    Error handling is controlled with the low bit of the
**              trap flag.
**
**                    TRAP 0     set _eigerr and terminate with message.
**
**                    TRAP 1     set _eigerr and continue execution.
**
**              The eigenvalues are unordered except that complex conjugate
**              pairs of eigenvalues will appear consecutively with the
**              eigenvalue having the positive imaginary part first.
**
**              This function is provided for backward compatibility
**              with previous versions of GAUSS.  It uses an
**              intrinsic function eig. If portability to the 16-bit
**              environment is not an issue and you have the complex
**              version of GAUSS, use the intrinsic function directly.
**              It is faster and more memory efficient.
**
**  Globals:    _eigerr
**
**  See Also:   eigcg2, eigch, eigrg, eigrs
*/

proc (2) = eigcg(xr,xi);
    { xr,xi } = cmsplit(eig(complex(xr,xi)));
    if scalerr(xr[1]);
        _eigerr = scalerr(xr[1]);
        xr[1] = 0;
    else;
        _eigerr = 0;
    endif;
    retp(xr,xi);
endp;

/*
**> eigcg2
**
**  Purpose:    To compute eigenvalues and eigenvectors of a complex,
**              general matrix.
**
**  Format:     { var,vai,ver,vei } = eigcg2(xr,xi);
**
**  Input:      xr    NxN matrix, real part.
**
**              xi    NxN matrix, imaginary part.
**
**  Output:     var       Nx1 vector, real part of eigenvalues.
**
**              vai       Nx1 vector, imaginary part of eigenvalues.
**
**              ver       NxN matrix, real part of eigenvectors.
**
**              vei       NxN matrix, imaginary part of eigenvectors.
**
**              _eigerr   global scalar, if all the eigenvalues can
**                        be determined _eigerr = 0,  otherwise _eigerr is set
**                        to the index of the eigenvalue that failed.  The
**                        eigenvalues for indices _eigerr+1 to N should be
**                        correct.  The eigenvectors are not computed.
**
**  Remarks:    Error handling is controlled with the low bit of the
**              trap flag.
**
**                    TRAP 0     set _eigerr and terminate with message
**
**                    TRAP 1     set _eigerr and continue execution
**
**              The eigenvalues are unordered except that complex conjugate
**              pairs of eigenvalues will appear consecutively with the
**              eigenvalue having the positive imaginary part first.  The
**              columns of ver and vei contain the real and imaginary
**              eigenvectors of x in the same order as the eigenvalues.
**              The eigenvectors are not normalized.
**
**              This function is provided for backward compatibility
**              with previous versions of GAUSS.  It uses an
**              intrinsic function eig. If portability to the 16-bit
**              environment is not an issue and you have the complex
**              version of GAUSS, use the intrinsic function directly.
**              It is faster and more memory efficient.
**
**  Globals:    _eigerr
**
**  See Also:   eigcg, eigch, eigrg, eigrs
*/

proc (4) = eigcg2(xr,xi);
    local er,ei;
    { xr,xi,er,ei } = cmsplit2(eigv(complex(xr,xi)));
    if scalerr(xr[1]);
        _eigerr = scalerr(xr[1]);
    xr[1] = 0;
    else;
        _eigerr = 0;
    endif;
    retp(xr,xi,er,ei);
endp;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -