Matrix.Row C# (CSharp) Method

Row() public method

public Row ( int row ) : int[]
row int
return int[]
    public int[] Row(int row)
    {
        throw new NotImplementedException("You need to implement this function.");
    }

Usage Example

        public static Tuple <List <double>, List <int> > GetDistances(Matrix <double> X)
        {
            int n = X.RowCount;
            //Vector<double> d = new DenseVector(n * (n - 1) / 2, 0);
            List <double> d = new List <double>();

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    //d[(i - 1) * n - (i - 1) * 1 / 2 + j - i] = (X.Row(i) - X.Row(j)).Norm(1);
                    d.Add((X.Row(i) - X.Row(j)).Norm(1));
                }
            }

            List <double> d_unique = new List <double>();
            List <int>    J        = new List <int>();

            foreach (var g in d.GroupBy(v => v))
            {
                d_unique.Add(g.Key);
                J.Add(g.Count());
            }

            return(new Tuple <List <double>, List <int> >(d_unique, J));
        }
All Usage Examples Of Matrix::Row