clamp A matrix when solving linear system