MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Extract any diagonal from a square matrix...


I'm sure everyone's past caring, but here's a solution that avoids
separate definitions for super- and subdiagonals, and behaves well with
nonsquare matrices:

diag[t_, d_] := Extract[t, Cases[Position[t, _, {2}, Heads -> False],
{x_, y_} /; y == x + d]]


  • Prev by Date: Re: Lists and rules
  • Next by Date: Re: NestWhile iterator.
  • Previous by thread: Re: Extract any diagonal from a square matrix...
  • Next by thread: General--Differential equation problem..