Hi,
I'm working on a series of optimization problems wherein the objective function to be minimized is the determinant of the variance-covariance matrix. If we consider the expression for determinant as a function f(q; x) then x is the vector of decision variable and q is a vector of parameters based on a user supplied probability distribution.
For different values of the q vector (Monte Carlo sample), I run the optimization to find optimal values of x. Note, the matrices are symmetric/square.
Because of floating point issues, there are certain scenarios wherein the determinant of a matrix is "extremely" low (but not zero). Strangely calculating rank of such matrices using rank function will say it is NOT full rank so I use the rank function to first check whether it is full rank to avoid reporting wrong determinant values and output NaN for such cases. Im surprised because I would expect det to do what rank does and not output incorrect det values if not full rank.
When the rank function does indicate full rank, in such cases I use the "det" function to calculate the determinant. My expectation is that in such scenarios I could be confident of det having reported the correct result (but do see point b below)
The above simple (but very costly) logic is built in to a user defined function used for actual optimization.
My question is:-
a) Is there a way to avoid using Rank/Det function for my context? My objective is speed (as long as answer is not incorrect) and in present approach I seem to be duplicating effots with rank followed by det.
(Btw, there seems to be lot of posts online suggesting to not use det function, but I guess they do NOT apply for my scenario?)
b) Even using the rank function first does NOT provide a guarantee. I see some matrices with crazy determinant values and my hypothesis is that it is not a full rank matrix but rank function reports it as full rank. So optimization should have just reported NaN but get some gibberish value
c) I'm considering using "cond" or "rcond" but not sure whether they would mimic what I want to do and worried about cutoff values to be used (considering that the range of user supplied q is quite vast, so determining a single cutoff that works well is tough). I dont want to use eps; some suggest 1e-12 but understand that it depends on context of the problem (what am doing can be used across different industries/functions so possibly I could have a good generic "default" value which could be over ridden by the user if required)
Any thoughts or suggestions highly appreciated (Im using Matlab 2015a on a Win 8 and Win 10 machine)
Thanks
Hari