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

📄 eigch.src

📁 没有说明
💻 SRC
字号:
/*
** eigch.src - Complex hermitian 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
** ==============================================================
**     va = EIGCH(xr,xi);                                   28
**     { valr,vali,vecr,veci } = EIGCH2(xr,xi);             81
*/

#include eig.ext

/*
**> eigch
**
**  Purpose:    To compute the eigenvalues of a complex, hermitian matrix.
**
**  Format:     va = eigch(xr,xi);
**
**  Input:      xr    NxN matrix, real part.
**
**              xi    NxN matrix, imaginary part.
**
**  Output:     va        Nx1 vector, real 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 1 to _eigerr-1 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 in ascending order.  The eigenvalues for
**              a complex hermitian matrix are always real so this procedure
**              returns only one vector.
**
**              This function is provided for backward compatibility
**              with previous versions of GAUSS.  It uses an
**              intrinsic function eigh. 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:   eigch2, eigcg, eigrg, eigrs, complex
*/

proc eigch(xr,xi);
    xr = eigh(complex(xr,xi));
    if scalerr(xr[1]);
        _eigerr = scalerr(xr[1]);
        xr[1] = 0;
    else;
        _eigerr = 0;
    endif;
    retp(xr);
endp;

/*
**> eigch2
**
**  Purpose:    To compute eigenvalues and eigenvectors of a complex,
**              hermitian matrix.
**
**  Format:     { var,vai,ver,vei } = eigch2(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 1 to _eigerr-1 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 in ascending order.  The eigenvalues
**              of a complex hermitian matrix are always real.  This
**              procedure returns a vector of zeros for the imaginary part
**              of the eigenvalues so the syntax is consistent with other
**              eigxx procedure calls.  The columns of ver and vei contain
**              the real and imaginary eigenvectors of x in the same order
**              as the eigenvalues.  The eigenvectors are orthonormal.
**
**              This function is provided for backward compatibility
**              with previous versions of GAUSS.  It uses an
**              intrinsic function eigh. 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:   eigch, eigcg, eigrg, eigrs
*/

proc (4) = eigch2(xr,xi);
    local er,ei;
    { xr,xi,er,ei } = cmsplit2(eighv(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 + -