    use precision
    use io
    use ferror
    implicit none
    real(D),parameter::ZERO=0.0
    real(D),allocatable::a(:,:),z(:,:),mu(:),lambda(:),work(:)
    integer,allocatable::newseed(:)
    real(D)::abstol
    character(80)::arg
    integer,external::iargc
    integer::j,k,n,sz,info,nfound
!
    if(iargc().eq.0) call fexit('asize [seed]',2)
    call random_seed(size=sz)
    allocate(newseed(sz))
    if(iargc().eq.sz+1) then
       do j=1,sz
          call getarg(j+1,arg)
          read(arg,*) newseed(j)
       enddo
    else
       call random_seed(get=newseed)
    endif
    write(LOGFILE,100) newseed
100 format('seed: ',4i11)
!
    call getarg(1,arg)
    read(arg,*) n
    allocate(a(n,n),z(n,n),mu(n),work(2*n),lambda(n))
!
!  Create a random symmetric matrix A
!
    call random_number(a)
    do k=1,n-1
       do j=k+1,n
          a(j,k)=a(k,j)
       enddo
    enddo
!
!  Compute eigenvalues and eigenvectors as in assim.f90
!
    call rs(n,n,a,mu,1,z,work,work(n+1),info)
    if(info.ne.0) then
       nfound=0
    else
       nfound=n
       do j=1,nfound
          lambda(j)=mu(nfound-j+1)
          !! a(:,j)=z(:,nfound-j+1)
       enddo
    endif
    write(LOGFILE,110) info,nfound
110 format('info: ',i0,' nfound: ',i0)
    write(LOGFILE,111) lambda(1:nfound)
111 format('eigenvalues:'/(5es14.4))
    stop
    end
