pr.probability – Expectation of the determinant of the inverse of non-central Wishart matrix

The joint distribution of the eigenvalues $lambda_i$, $i=1,2,ldots n$ of $A$ is known,
$$P(lambda_1,lambda_2,ldotslambda_n)=c_{k,n}prod_{i<j}|lambda_i-lambda_j|prod_m e^{-lambda_m/2}lambda_m^{(k-n-1)/2},$$
with $c_{k,n}$ a normalization constant.

The desired expectation value is given by
$$U_{n,k}=mathbb E(det(I+(I+A)^{-1}))=int_0^infty dlambda_1int_0^infty dlambda_2cdots int_0^infty dlambda_n,prod_{i<j}|lambda_i-lambda_j|prod_m e^{-lambda_m/2}lambda_m^{(k-n-1)/2}left(1+(1+lambda_m)^{-1}right).$$
For small $n$ the integrals can be done by quadrature, but the integrals quickly become unwieldy.

For example, for $n=1$, $k>0$ I find
$$U_{1,k}=2^{-frac{k}{2}} left(2^{k/2}+sqrt{e} ,Gamma left(1-tfrac{1}{2}k,tfrac{1}{2}right)right),$$
with $Gamma$ the incomplete Gamma function.

If you are satisfied with the expectation value of the logarithm of the determinant, then you can use the Marchenko-Pastur distribution to obtain an accurate result for large $n$.

performance tuning – Mean values of skew diagonals of a $(n+1,n)$ matrix

How mean values of skew diagonals of a $(n+1,n)$ matrix can be computed efficiently?

Here is my naive implementation:

ClearAll(build) ;
build(matrix_) := Block(
    {col,row} = Dimensions(matrix) ;
    signal = ConstantArray(0,2*row) ;
        signal((i)) = Table(If(q+p==i+1,matrix((q,p)),Nothing),{q,1,col},{p,1,row}) ;
        signal((i)) = Mean(Flatten(signal((i)))) ;
    ) ;

Looks like it’s time complexity is $O(n^3)$, can it be reduced?


n = 4 ;
ncols = n + 1 ;
nrows = n ;
matrix = Array(m,{ncols,nrows}) ;
(* {{m(1,1),m(1,2),m(1,3),m(1,4)},{m(2,1),m(2,2),m(2,3),m(2,4)},{m(3,1),m(3,2),m(3,3),m(3,4)},{m(4,1),m(4,2),m(4,3),m(4,4)},{m(5,1),m(5,2),m(5,3),m(5,4)}} *)
(* {m(1,1),1/2 (m(1,2)+m(2,1)),1/3 (m(1,3)+m(2,2)+m(3,1)),1/4 (m(1,4)+m(2,3)+m(3,2)+m(4,1)),1/4 (m(2,4)+m(3,3)+m(4,2)+m(5,1)),1/3 (m(3,4)+m(4,3)+m(5,2)),1/2 (m(4,4)+m(5,3)),m(5,4)} *)

n = 4 ;
ncols = n + 1 ;
nrows = n ;
data = Range(1,2*n) ;
data = Partition(data,n,1) ;
(* {{1,2,3,4},{2,3,4,5},{3,4,5,6},{4,5,6,7},{5,6,7,8}} *)
(* {1,2,3,4,5,6,7,8} *)

linear algebra – A matrix Riccati differential equation with constant coefficients? Is there a solution for this in closed form?

The following is a matrix Riccati differential equation with constant coefficient matrices.

$$Dfrac{partial{C(t)}}{partial{t}}S + frac{1}{n}C(t)QDC(t)S – EC(t)Q = 0$$ or
$$Ddot{C}(t)S + frac{1}{n}C(t)QDC(t)S – EC(t)Q = 0$$
given initial condition $C(0) = C_0$.

I stumbled upon this from some other problem and I don’t have any background in matrix differential equations and I’d like to know if there is any way to solve this equation. I read it can be reduced to an algebraic Riccati equation. Is there any closed form expression for solution of this equation? Or anything that is closest to solving this equation?

Matrix dimensions

$C(t)$———-> $(m+1)times n$

$S$————–>$ntimes 1$


$D$————–>$(m+1)times(m+1)$ diagonal matrix. (it is also singular, as there is a diagonal entry that is 0).

$E$————–>$1times (m+1)$

If its useful to know, $n>>m$ and $mge 3$

linear algebra – Problem with a rank of symmetric matrix

Thanks for contributing an answer to Mathematics Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

matrix – Logarithm of singular matrices

I wanted to calculate following quantity:

$X=Tr(rho_1 log(rho_2))$,

as in the relative entropy. Here, $rho_1, rho_2$ are positive semidefinite matrices with non-orthogonal support (so that the thing does not diverge – terms like $0 log(0)$ should be taken to zero, which is standard assumption) and $Tr$ is trace.

There is a similar SE question, the given function

MatrixLogSafe(x_) := MatrixFunction(Piecewise({{Log(#1), #1 > 0}}) &, x)

which should deal with the matrix logarithm, it behaves, however, strange.

For e.x. I assume that $rho_1 =rho_2 ={{0.33,0,0},{0,0,0},{0,0,0.66}}$. The quantity $X$ should then be

$X=0.33 log(0.33) + 0.66 log(0.66)= -0.640099$.

However, using MatriLogSafe in the definition gives different output:

In(402):= Tr({{0.33, 0, 0}, {0, 0, 0}, {0, 0, 0.66}}.MatrixLogSafe({{0.33, 0, 0}, {0, 0, 0}, {0, 0, 0.66}}))

Out(402)= -0.731717

The problem is, that MatrixLogSafe sometimes “switch the eigenvectors”,

In(403):= MatrixLogSafe({{0.33, 0, 0}, {0, 0, 0}, {0, 0, 0.66}})

Out(403)= {{0., 0., 0.}, {0., -0.415515, 0.}, {0., 0., -1.10866}}

(so $log(0.33)= -1.10866$ and $log(0.66)=-0.415515$, but the output should be { { -1.10866, 0, 0.}, {0., 0., 0.}, {0., 0.,-0.415515}}).

(Somehow I think the problem is that the I use numerical values, but I want that the function works for both numerical and “exact” (?) numbers)

How one can fix it?

patterns and practices – How does an Application Security Risk Matrix look like?

I am looking into “Secure Development Lifecycle” (SDLC) and I found a resource that say one should create a “Application Security Risk Matrix”. I guess that matrix has one row for each thread (e.g. SQL Injection), and the columns might be something like severity / likelihood / mitigation / comments. But I don’t really know. And I also would appreciate more examples of threads.

Is there a template / a reputable example for an Application Security Risk Matrix? Is it the same as a “Thread Matrix” (example)?

What I found

INFORMATION SECURITY RISK ANALYSIS – A MATRIX-BASED APPROACH: A lot of different matrices which seem to weight already found issues.

ICT risk matrix / Managing Cybersecurity Risks Using a Risk Matrix: More like a chart. I found a lot of tose via image search, but most of them were in private blogs.

matrices – Matrix rank only adding single row

I have a dense matrix and a set of rows. I would like to check if adding any single row from the set to the original matrix would make the new matrix rank deficient. Right now I am doing a full LU decomposition each time. This feels wasteful, and I have a hunch that I should be able to keep some information between iterations. Does anyone know of a way to speed this up?