*
* @LagPolyRoots   lagpoly
*
* Produces a table of the inverted roots of the input lag polynomial, showing the
* modulus and (for complex roots) the period.
*
* Parameters:
*   lagpoly = polynomial represented as a VECTOR with
*      p(x)=v(1)+v(2)x+v(3)x**3+...+v(p+1)x**d
*
* Revision Schedule:
*   10/2005 Writte by Tom Doan, Estima
*
procedure LagPolyRoots lagpoly
type vector lagpoly
*
option string title
local integer i n
local vect[complex] roots
*
compute n=%rows(lagpoly)-1
*
compute roots=%polycxroots(lagpoly)
ewise roots(i)=1.0/roots(i)
report(action=define)
report(atrow=1,atcol=1,span) title
report(atrow=2,atcol=1) "Real" "Imag" "Modulus" "Period"
do i=n,1,-1
   report(row=new,atcol=1) %real(roots(i)) %imag(roots(i)) %cabs(roots(i))
   if %imag(roots(i))<>0.0.and.%arg(roots(i))>0
      report(row=current,atcol=4) 2*%pi/%arg(roots(i))
end do i
report(action=format,atcol=1,tocol=4,picture="*.###")
report(action=show)
end

