Necessary and sufficient conditions for finite-time stability of linear systems