#NEWLINE# def _compute_B_statistics( self , K , W , log_concave , * args , **kwargs ) : #NEWLINE# #INDENT# '\n        Rasmussen suggests the use of a numerically stable positive definite matrix B\n        Which has a positive diagonal elements and can be easily inverted\n\n        :param K: Prior Covariance matrix evaluated at locations X\n        :type K: NxN matrix\n        :param W: Negative hessian at a point (diagonal matrix)\n        :type W: Vector of diagonal values of Hessian (1xN)\n        :returns: (W12BiW12, L_B, Li_W12)\n        ' #NEWLINE# if ( not log_concave ) : #NEWLINE# #INDENT# W = np . clip ( W , 1e-06 , 1e+30 ) #NEWLINE# #UNINDENT# if np . any ( np . isnan ( W ) ) : #NEWLINE# #INDENT# raise ValueError ( 'One or more element(s) of W is NaN' ) #NEWLINE# #UNINDENT# W_12 = np . sqrt ( W ) #NEWLINE# B = ( np . eye ( K . shape [ 0 ] ) + ( ( W_12 * K ) * W_12 . T ) ) #NEWLINE# L = jitchol ( B ) #NEWLINE# ( LiW12 , _ ) = dtrtrs ( L , np . diagflat ( W_12 ) , lower = 1 , trans = 0 ) #NEWLINE# K_Wi_i = np . dot ( LiW12 . T , LiW12 ) #NEWLINE# C = np . dot ( LiW12 , K ) #NEWLINE# Ki_W_i = ( K - C . T . dot ( C ) ) #NEWLINE# I_KW_i = ( np . eye ( K . shape [ 0 ] ) - np . dot ( K , K_Wi_i ) ) #NEWLINE# logdet_I_KW = ( 2 * np . sum ( np . log ( np . diag ( L ) ) ) ) #NEWLINE# return ( K_Wi_i , logdet_I_KW , I_KW_i , Ki_W_i )