Accord.Statistics.Analysis.ProcrustesAnalysis.ApplyTranslateScale C# (CSharp) Method

ApplyTranslateScale() private method

Apply Procrustes translation and scale to the given dataset
private ApplyTranslateScale ( ProcrustedDataset p, double samples ) : void
p ProcrustedDataset Procrusted dataset to process and store the results to
samples double The dataset itself
return void
        private void ApplyTranslateScale(ProcrustedDataset p, double[,] samples)
        {
            // Save the original data
            p.Source = samples;

            // Save the original data center (i.e. mean)
            p.Center = p.Source.Mean(dimension: 0);
            // Translate the samples to zero
            p.Dataset = Translate(samples);

            // Save the original scale of the dataset
            p.Scale = GetDatasetScale(p.Dataset);
            // Scale the dataset to 1
            p.Dataset = Scale(p.Dataset);
        }