numl.Math.LinearAlgebra.Matrix.this C# (CSharp) Method

this() public method

Indexer to get items within this collection using array index syntax.
public this ( bool>.Func f, VectorType t ) : Matrix
f bool>.Func The Func<Vector,bool> to process.
t VectorType The VectorType to process.
return Matrix
        public Matrix this[Func<Vector, bool> f, VectorType t]
        {
            get
            {
                int count = 0;
                if (t == VectorType.Row)
                {
                    for (int i = 0; i < Rows; i++)
                        if (f(this[i, t]))
                            count++;

                    Matrix m = new Matrix(count, Cols);
                    int j = -1;
                    for (int i = 0; i < Rows; i++)
                        if (f(this[i, t]))
                            m[++j, t] = this[i, t];

                    return m;
                }
                else
                {
                    for (int i = 0; i < Cols; i++)
                        if (f(this[i, t]))
                            count++;

                    Matrix m = new Matrix(Rows, count);
                    int j = -1;
                    for (int i = 0; i < Cols; i++)
                        if (f(this[i, t]))
                            m[++j, t] = this[i, t];

                    return m;
                }

            }
        }

Same methods

Matrix::this ( int i ) : Vector
Matrix::this ( int i, VectorType t ) : Vector
Matrix::this ( bool>.Func f ) : double
Matrix::this ( IEnumerable slice ) : double
Matrix::this ( int i, int j ) : double