Into

Modules

Documentation

classPiiFilteredMatrix

#include <PiiFilteredMatrix.h>

A model of the matrix concept that accesses selected elements of another matrix.

Inherits PiiConceptualMatrix< PiiFilteredMatrix< Matrix, Filter > >

Description

PiiFilteredMatrix is a 1-by-N matrix in which each element refers to an element in another matrix that matches a filter. An element is a match if the corresponding element in the filter is non-zero.

 PiiMatrix<int> mat(3, 3,
                    -3, -2, -1,
                    -4,  0,  1,
                     2,  3,  4);
 PiiMatrix<bool> filter(3, 3,
                        1, 0, 1,
                        1, 0, 0,
                        0, 0, 1);

 PiiFilteredMatrix<PiiMatrix<int>, PiiMatrix<bool> > filtered(mat, filter);
 // filtered = (-3, -1, -4, 4)

Usually, there is no need to explicitly create an instance of PiiFilteredMatrix. Use the Pii::filteredMatrix() function instead. PiiMatrix also has an operator() that takes another matrix as a parameter and returns a filtered matrix.

 PiiMatrix<int> filtered(Pii::filteredMatrix(mat, filter));
 // Even simpler
 PiiMatrix<int> filtered2(mat(filter));

Public types

typedef PiiConceptualMatrix< PiiFilteredMatrix< Matrix, Filter > >
typedef PiiMatrixTraits< PiiFilteredMatrix< Matrix, Filter > >

Constructors and destructor

(
  • Matrix & matrix
  • const Filter & filter
)

Public member functions

BaseType::const_iterator
( )
BaseType::iterator
( )
int
BaseType::const_iterator
( )
BaseType::iterator
( )
(
  • typename Traits::value_type value
)
int
( )
template<class Matrix, class Filter>
PiiFilteredMatrix< Matrix, Filter >
(
  • Matrix & matrix
  • const Filter & filter
)

Creates a PiiFilteredMatrix that accesses those elements of matrix whose corresponding element in filter is non-zero.

Function details

  • PiiFilteredMatrix

    (
    • Matrix & matrix
    • const Filter & filter
    )
    [inline]
  • PiiFilteredMatrix

    ( )
    [inline]
  • BaseType::const_iterator begin

    ()
    [inline]

    Reimplemented from PiiConceptualMatrix.

  • BaseType::iterator begin

    ()
    [inline]

    Reimplemented from PiiConceptualMatrix.

  • int columns

    ()
    [inline]

    Reimplemented from PiiConceptualMatrix.

  • BaseType::const_iterator end

    ()
    [inline]

    Reimplemented from PiiConceptualMatrix.

  • BaseType::iterator end

    ()
    [inline]

    Reimplemented from PiiConceptualMatrix.

  • PiiFilteredMatrix & operator=

    (
    • typename Traits::value_type value
    )
    [inline]
  • int rows

    ()
    [inline]

    Reimplemented from PiiConceptualMatrix.

  • template<class Matrix, class Filter>

    PiiFilteredMatrix< Matrix, Filter > filteredMatrix

    (
    • Matrix & matrix
    • const Filter & filter
    )
    [inline]

    Creates a PiiFilteredMatrix that accesses those elements of matrix whose corresponding element in filter is non-zero.

    Note that this function does not check that matrix and filter are equal in size.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.