def _burkardt_13_power(n, p):
 if ((n != int(n)) or (n < 2)):
  raise ValueError('n must be an integer greater than 1')
 n = int(n)
 if ((p != int(p)) or (p < 0)):
  raise ValueError('p must be a non-negative integer')
 p = int(p)
 (a, b) = divmod(p, n)
 large = np.power(10.0, ((- n) * a))
 small = (large * np.power(10.0, (- n)))
 return (np.diag(([large] * (n - b)), b) + np.diag(([small] * b), (b - n)))

def _burkardt_13_power ( n , p ) : if ( ( n != int ( n ) ) or ( n < 2 ) ) : raise ValueError ( 'n must be an integer greater than 1' ) n = int ( n ) if ( ( p != int ( p ) ) or ( p < 0 ) ) : raise ValueError ( 'p must be a non-negative integer' ) p = int ( p ) ( a , b ) = divmod ( p , n ) large = np . power ( 10.0 , ( ( - n ) * a ) ) small = ( large * np . power ( 10.0 , ( - n ) ) ) return ( np . diag ( ( [ large ] * ( n - b ) ) , b ) + np . diag ( ( [ small ] * b ) , ( b - n ) ) )
a helper function for testing matrix functions .