代码之家  ›  专栏  ›  技术社区  ›  Kris

在MathNet.Numerics中查找多个列

  •  0
  • Kris  · 技术社区  · 6 年前

    Matrix<float> mat  // dense matrix of size n x k, where n is large and k ~ 10
    int[] index        // int[] of length l ~ 10, e.g. { 7, 13, 11, ... }
    

    所以我想查找多个列,例如“ mat[index] “,这将是形状 l x k .

    有人能告诉我怎么做吗?

    index 把行叠起来还是有更好的方法?)

    1 回复  |  直到 6 年前
        1
  •  0
  •   Kris    6 年前

    下面是堆叠解决方案:

    Matrix<T> lookup = CreateMatrix.DenseOfRowVectors(indices.Select(i => matrix.Row(i)));
    

    感觉可能有一种更好的方法不需要新的内存分配。