 Usage:  d = xdiagp (x)  
 
 Input:

  x                      n x p matrix 
                         
  w                      optional, scalar or n x 1 weight vector 
                         
 Output:

  d                      n x 1 vector of diagonal elements of 
                         X(X'WX)^(-1) X' or W'^(1/2)X(X'WX)^(-1) X'W^(1/2) 
                         
--------------------------------------------------------------
(C) MD*TECH Method and Data Technologies, 17.8.2000
