anchor.diff:  	END SUBROUTINE dfpmin
   
   	SUBROUTINE lnsrch(xold,fold,g,p,x,f,stpmax,check,func)
  -	IMPLICIT NONE
   	REAL(SP), DIMENSION(:), INTENT(IN) :: xold,g
   	REAL(SP), DIMENSION(:), INTENT(INOUT) :: p
   	REAL(SP), INTENT(IN) :: fold,stpmax
  
positive.code: 	INTEGER(our_int) :: ndum
  	REAL(SP) :: a,alam,alam2,alamin,b,disc,f2,fold2,pabs,rhs1,rhs2,slope,&
  		tmplam
  	ndum=assert_eq(size(g),size(p),size(x),size(xold),'lnsrch')
  	check=.false.
  	pabs=vabs(p(:))
  	if (pabs > stpmax) p(:)=p(:)*stpmax/pabs
  
negative.code: 	STOP 'program terminated by nrerror'
  	END SUBROUTINE nrerror
  
  
  	FUNCTION outerprod(a,b)
  	REAL(SP), DIMENSION(:), INTENT(IN) :: a,b
  	REAL(SP), DIMENSION(size(a),size(b)) :: outerprod
  	outerprod = spread(a,dim=2,ncopies=size(b)) * &
  		spread(b,dim=1,ncopies=size(a))
  	END FUNCTION outerprod
  
  
  
  
  
  
  
  !BL
  	SUBROUTINE unit_matrix(mat)
  	REAL(SP), DIMENSION(:,:), INTENT(OUT) :: mat
  