Implement PCA by centering data, eigendecomposing the covariance matrix, and projecting onto the leading components.