On the sample complexity of purity and inner product estimation