/* Solve Ax = b, where A is a 2x2 matrix and b is a 2x1 vector.  */
int32_t matsolve_2x2(float *A, float *b, float *x)
/* Solve Ax = b, where A is a 2x2 matrix and b is a 2x1 vector.  */
int32_t matsolve_2x2(float *A, float *b, float *x)
{
	float det = A[0] * A[3] - A[1] * A[2];
	if (det == 0)
		return FAILURE;
	x[0] = (A[3] * b[0] - A[1] * b[1]) / det;
	x[1] = (A[0] * b[1] - A[2] * b[0]) / det;
	return SUCCESS;
}