Stata 15 help for mf_trace_AVBV


[M-5] trace_AVBV() -- Obtain trace of a special-purpose matrix


real scalar trace_AVBV(real matrix A, real matrix B, real vector v)


trace_AVBV(A, B, v) returns trace((A*diag(v))*(B*diag(v))), calculated efficiently, where A and B are symmetric matrices with zeros on their diagonals.

trace_AVBV() is an undocumented function.


This calculation arises in certain spatial statistical calculations.


trace_AVBV(A, B, v): A: n x n B: n x n v: n x 1


trace_AVBV(A, B, v) assumes, but does not check, that A and B are symmetric with zeros on their diagonals.

trace_AVBV(A, B, v) aborts with error if A, B, or v is a view.

Source code

Function is built in.

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index