Пример #1
0
        //!!!Similar code elsewhere
        //There is likely similar code elsewhere
        private IEnumerable <string> FindNonRedunantFeatures <T>(Matrix <string, string, T> matrixIn)
        {
            var goodRowList =
                from rowKey in matrixIn.RowKeys
                .AsParallel().WithParallelOptionsScope()
                let row = matrixIn.RowView(rowKey)
                          let distinctValueList = row.Values.Distinct().ToList()
                                                  where distinctValueList.Count > 1
                                                  select rowKey;

            var matrix2 = matrixIn.SelectRowsView(goodRowList);

            //Creates a list of the alphabetically later duplicate row keys
            var duplicateRowKey =
                (
                    from rowKey1 in matrix2.RowKeys
                    .AsParallel().WithParallelOptionsScope()
                    let row1 = matrix2.RowView(rowKey1)
                               from rowKey2 in matrix2.RowKeys
                               where rowKey2.CompareTo(rowKey1) == 1
                               let row2 = matrix2.RowView(rowKey2)
                                          where SpecialFunctions.DictionaryEqual(row1, row2)
                                          select rowKey2
                ).ToHashSet();

            return(matrix2.RowKeys.Except(duplicateRowKey));
        }