anchor.diff:      integer :: typ, order
       integer, optional :: typ0, order0
       real(8) :: ermax, min_res
  -    real(8) anorm, anorm_t
  +    real(8) anorm
       typ = 2 ! 1 - KSL, 2 - KSL-symm
       if ( present(typ0) ) then
           typ = typ0 
  
positive.code:           call init_bfun_sizes(ry(i),n(i),ry(i+1),ry(i),n(i),ry(i+1),ra(i),ra(i+1),ry(i)*n(i)*ry(i+1),ry(i)*n(i)*ry(i+1))
            call dinit_bfun_main(phinew(i)%p,crA(pa(i):pa(i+1)-1),phinew(i+1)%p)
            anorm = normest(ry(i)*n(i)*ry(i+1),4, dmatvec, dmatvec_transp)
            anorm_t = norm_true(ry(i)*n(i)*ry(i+1), dmatvec, dmatvec_transp)
            print *, 'anorm, anorm_t = ', anorm, anorm_t 
            call dexp_mv(ry(i)*n(i)*ry(i+1), order, tau/2, curcr, crnew(i)%p, eps, anorm, dmatvec)
            if ( i < d ) then
               call dqr(ry(i)*n(i),ry(i+1),crnew(i)%p,R)
  
negative.code:              ra(i), ra(i+1), phinew(i)%p, crA(pa(i)), curcr, curcr, phitmp)
               call dinit_sfun(ry(i+1), ry(i+1), ra(i+1), ry(i+1), ry(i+1), phitmp, phinew(i+1)%p)
               anorm = normest(ry(i+1)*ry(i+1), 4, dsfun_matvec, dsfun_matvec_transp)
               call dexp_mv(ry(i+1)*ry(i+1), order, -tau/2, R, Stmp, eps, anorm, dsfun_matvec)
               call dgemm('n','n',ry(i)*n(i),ry(i+1),ry(i+1),1d0,curcr, ry(i)*n(i), Stmp, ry(i+1), 0d0, crnew(i)%p, ry(i)*n(i))
               call dcopy(ry(i)*n(i)*ry(i+1),crnew(i)%p,1,curcr,1)
  