Generate Toeplitz matrix from column and row vector.

Toeplitz(a, b)

Arguments

a

vector that will be the first column

b

vector that if present will form the first row.

Details

Toeplitz(a, b) returns a (non-symmetric) Toeplitz matrix whose first column is a and whose first row is b. The following rows are shifted to the left.

If the first element of b differs from the last element of a it is overwritten by this one (and a warning sent).

Value

Matrix of size (length(a), length(b)).

Note

stats::Toeplitz does not allow to specify the row vector, that is returns only the symmetric Toeplitz matrix.

See also

Examples

Toeplitz(c(1, 2, 3, 4, 5))
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    1    2    3    4    5
#> [2,]    2    1    2    3    4
#> [3,]    3    2    1    2    3
#> [4,]    4    3    2    1    2
#> [5,]    5    4    3    2    1
Toeplitz(c(1, 2, 3, 4, 5), c(1.5, 2.5, 3.5, 4.5, 5.5))
#> Warning: First elements of vectors 'a', 'b' are not equal.
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    1  2.5  3.5  4.5  5.5
#> [2,]    2  1.0  2.5  3.5  4.5
#> [3,]    3  2.0  1.0  2.5  3.5
#> [4,]    4  3.0  2.0  1.0  2.5
#> [5,]    5  4.0  3.0  2.0  1.0