# How to programme the SPICE(sparse iterative covariance-based estimation)

(Alen) #1

where R_hat is a constant matrix, a is constant vector consisting matrix A ; R is calculated by a and matrix P=diag(p), that is R = A’*diag(p)*A

my code is: I cannot obtain the right result,who can help me?

``````cvx_begin sdp quiet
variable p(1,length(A))
expressions w(length(A),1) complex
expressions R(M,M) complex
R = (A'*diag(p)*A);
minimize trace_inv(inv_R_hat*R*inv_R_hat)

subject to
w =conj(diag(A*inv_hat*A'))/M;
1 == p*w ;
cvx_end
``````

I cannot obtain the right result,who can help me?
the SPICE is from SPICE: a sparse covariance-based estimation method for array processing

(Mark L. Stone) #2

Don’t take this as an exhaustive list of issues:

Where is the nonnegativity constraint on `p`?

What are `inv_hat` and `inv_R_hat`, and how are they related? I believe your `inv_R_hat` inside `trace_inv` should be `sqrtm(inv(Rhat))`. Is it? And `inv_hat` should be `inv(Rhat)`,

I think you inadvertently declared `complex` to be an expression (you should have used `expression`, not `expressions`). Anyhow, I don’t think you need the `expressions` statements at all, because the `R =` and `w =` statements make `R` and `w` expressions without extra declaration.

Don’t use `quiet` until you have verified everything is running correctly with correct results. That will allow you to see the solver and CVX output.

(Alen) #3

Thanks for your reply, as you said, inv_hat is the inverse of R_hat, inv_R_hat is sqrtm(inv(R_hat)), which is stated in my previous code. This is my new code, but I also cannot get the right answer.

cvx_begin
variable p(1,length(A))
R = (A’* diag( p )* A);
minimize trace_inv(inv_R_hatRinv_R_hat)
subject to
w = (diag(A* inv_hat* A’))/M;
1 == p*w ;
p >= 0;
cvx_end

(Mark L. Stone) #4

You haven’t shown us the solver and CVX output from running this problem, nor described in what way the answer is not correct. Have yiu tried a simple, easy to diagnose case, such as 2 by 2?

(Alen) #5

The CVX solver status is failed in the print details when implement the coding which is designed for direction of arrival (DOA) estimation in array signal processing.

(Mark L. Stone) #6

Please show all the solver and CVX output.

(Alen) #7

All printout are as follows:
Warning: This linear matrix inequality appears to be unsymmetric. This is
very likely an error that will produce unexpected results. Please check
the LMI; and, if necessary, re-enter the model.

In cvxprob/newcnstr (line 241)
In >= (line 21)
In cvx/trace_inv (line 28)
In minimize (line 14)
In SPICE_CVX (line 48)
Calling SDPT3 4.0: 1713 variables, 690 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 690
dim. of sdp var = 64, num. of sdp blk = 1
dim. of linear var = 198
dim. of free var = 491
2 linear variables from unrestricted variable.
*** convert ublk to lblk

SDPT3: Infeasible path-following algorithms

## number of iterations = 1 Total CPU time (secs) = 1.37 CPU time per iteration = 1.37 termination code = 3 DIMACS: 1.1e+02 0.0e+00 9.2e+00 0.0e+00 1.0e+00 7.7e+00

Status: Failed
Optimal value (cvx_optval): NaN

(Mark L. Stone) #8

Per the warning, the argument of `trace_inv` apparently is not symmetric.
Is `inv_R_hat` exactly symmetric?

(Mark L. Stone) #9

Hmm, I’m not sure whether CVX will recognize `inv_R_hat*R*inv_R_hat` as symmetric (or whether it really matters if it does), even if `inv_R_hat` is exactly symmetric.

Another approach, still requiring `inv_R_hat` to be symmetric is per my answer in Generalizing "trace_inv" for matrix quadratic forms