如何在 IlNumerics 数组中查找行

how to find rows in IlNumerics array

我想根据它的值从矩阵 A 中检索一个子集。

例如,我想从矩阵 A(见下文)中获取第一列值等于 9 的行 预期输出:

{ 9, 12, 21 },
{ 9, 13, 23 },
{ 9, 14, 24 },
Array<double> A = new double[,] {
              { 1, 9, 20 },
              { 2, 11, 21 },
              { 9, 12, 21 },
              { 9, 13, 23 },
              { 9, 14, 24 },
              { 6, 15, 25 }
            };
            
            Array<double> test1 = A[A[0] == 9];
            Array<double> test2 = A[A == 9];

            ///Get the first column
            Array<double> D = A[full, 0];
            
            ///test 3: Get all rows where the value for the first column is 9
            Array<double> match = D.Where(e => e == 9).ToArray();

            ///test 4:Get all rows where the value for the first column is 9 from A
            Array<double> match2 = A.Where(e => e == 9).ToArray();

未经测试,我想这应该可以解决问题:

Array<double> match = A[A[full, 0] == 9, full];