private IDataset CreateRevertedDataset(IDataset data, double[,] pcs) { var n = VariableNames; var nDouble = data.DoubleVariables.Where(x => !ComponentNames.Contains(x)).ToArray(); var nDateTime = data.DateTimeVariables.ToArray(); var nString = data.StringVariables.ToArray(); IEnumerable <IList> nData = n.Select((_, x) => Enumerable.Range(0, pcs.GetLength(0)).Select(r => pcs[r, x]).ToList()); IEnumerable <IList> nDoubleData = nDouble.Select(x => data.GetDoubleValues(x).ToList()); IEnumerable <IList> nDateTimeData = nDateTime.Select(x => data.GetDateTimeValues(x).ToList()); IEnumerable <IList> nStringData = nString.Select(x => data.GetStringValues(x).ToList()); return(new Dataset(n.Concat(nDouble).Concat(nDateTime).Concat(nString), nData.Concat(nDoubleData).Concat(nDateTimeData).Concat(nStringData).ToArray())); }