In the case that S has all entries being zero, which is permitted, the resulting matrix will be positive semi-definite, but only positive definite if all the following are true:
size(A, 1) == size(A, 2)
all elements of D are positive (again, only non-negativity is enforced)
For example, this matrix is positive semi-definite, but not positive definite:
(I do wonder whether there should be a ispossemidef function defined somewhere central, e.g. LinearAlgebra or maybe PDMats. since being PSD is useful, and often sufficient for many useful algorithms to apply)
In the case that
S
has all entries being zero, which is permitted, the resulting matrix will be positive semi-definite, but only positive definite if all the following are true:D
are positive (again, only non-negativity is enforced)For example, this matrix is positive semi-definite, but not positive definite:
(I do wonder whether there should be a
ispossemidef
function defined somewhere central, e.g. LinearAlgebra or maybe PDMats. since being PSD is useful, and often sufficient for many useful algorithms to apply)