0

For a given N, I need to create the following matrix: enter image description here

I have understood that :

 from scipy.linalg import toeplitz
 y=toeplitz(range(1,N))

will create a Toeplitz matrix. But it is not the exact matrix given above.
Appreciate your help

Community
  • 1
  • 1
Charith
  • 415
  • 3
  • 10

1 Answers1

1

From the docs:

scipy.linalg.toeplitz(c, r=None)

Construct a Toeplitz matrix.

The Toeplitz matrix has constant diagonals, with c as its first column and r as its first row. If r is not given, r == conjugate(c) is assumed.

Thus you need to pass the first column and the first row like this:

toeplitz(c=[1, *np.arange(N,1,-1)], r=np.arange(1,N+1))
Community
  • 1
  • 1
joni
  • 6,840
  • 2
  • 13
  • 20