An update to the moremata package is now available from SSC. Type
Code:
. ssc install moremata, replace
to install the update.

Handling of collinear variables by the entropy balancing function mm_ebal() was somewhat inconsistent. This is fixed.

By the way, although it seems obvious, I just realized some days ago that entropy balancing can be used to obtain weights that orthogonalize the data (while keeping means and variances at their original values; thanks goes to Xiang Zhou from Harvard University). Here's an example:
Code:
. sysuse nlsw88, clear
(NLSW, 1988 extract)

. drop if missing(age, hours, tenure)
(19 observations deleted)

. mata:

: X = st_data(., "age hours tenure")

: N = rows(X)

: C = (X:-mean(X)) :/ sqrt(diagonal(variance(X))*(N-1)/N)'

: C = C, C:^2:-1, C[,1]:*C[,2], C[,1]:*C[,3], C[,2]:*C[,3]

: S = mm_ebal_init(J(1, cols(C), 0), rows(C), C, 1)

: (void) mm_ebal(S)
Iteration 0:   max difference =  .16084911  
Iteration 1:   max difference =  .08103064  
Iteration 2:   max difference =  .00177662  
Iteration 3:   max difference =  4.710e-06  
Iteration 4:   max difference =  2.727e-11  
Iteration 5:   max difference =  7.384e-18  

: w = mm_ebal_W(S)

: // results from original data
: mean(X)
                 1             2             3
    +-------------------------------------------+
  1 |  39.15087562   37.23978446   5.981701848  |
    +-------------------------------------------+

: variance(X)
[symmetric]
                  1              2              3
    +----------------------------------------------+
  1 |    9.37435121                                |
  2 |  -.8281974752    109.8472395                 |
  3 |   1.231685343    9.288419209    30.35687977  |
    +----------------------------------------------+

: // results from reweighted data
: mean(X, w)
                 1             2             3
    +-------------------------------------------+
  1 |  39.15087562   37.23978446   5.981701848  |
    +-------------------------------------------+

: variance(X, w)
[symmetric]
                 1             2             3
    +-------------------------------------------+
  1 |   9.37435121                              |
  2 |  3.57506e-16   109.8472395                |
  3 |  8.68228e-16   2.04289e-16   30.35687977  |
    +-------------------------------------------+

: // => means and variances still the same, covariances are zero
: end
ben