toeplitz.src

来自「没有说明」· SRC 代码 · 共 56 行

SRC
56
字号
/*
** toeplitz.src
** (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.
**
**> toeplitz
**
**  Purpose:    Creates a Toeplitz matrix from a column vector.
**
**  Format:     t = toeplitz(x);
**
**  Input:      x    Kx1 vector.
**
**  Output:     t    KxK Toeplitz matrix.
**
**  Globals:    None
**
**  Example:   x = seqa(1,1,5);
**             y = toeplitz(x);
**
**                 1 2 3 4 5
**                 2 1 2 3 4
**             y = 3 2 1 2 3
**                 4 3 2 1 2
**                 5 4 3 2 1
*/

proc toeplitz(x);
    local n,v;

    /* check for complex input */
    if iscplx(x);
        if hasimag(x);
            errorlog "ERROR: Not implemented for complex matrices.";
            end;
        else;
            x = real(x);
        endif;
    endif;

    n = rows(x);
    v = seqa(0,1,n);
    retp( submat(rotater((rev(trimr(x,1,0))|x)',v),0,v+n) );
endp;

⌨️ 快捷键说明

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