While working on matlab to C conversion, I have encountered a problem which involves result mismatch. The function I've been trying to validate is an SVD function with its corresponding matlab built-in function. The result that is obtained from the vector of singular values (the last n by n matrix) in C implementation produces a result with column mismatch as compared to its corresponding matlab built-in function. In some of the cases the obtained result produces opposite signed values as well.
I have attached the c implementation, I kindly ask for your cooperation in pinpointing the problem which could help me find a solution.