replaced variable-length array with SG_MALLOC in log_det_test_3