Olympic champion Ariarne Titmus has announced her immediate retirement from elite swimming in a surprise move.