Template Numerical Library version\ main:0b2c40fb1
Loading...
Searching...
No Matches
TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ > Struct Template Reference

Specialization of GraphVertexView for dense adjacency matrices. More...

#include <TNL/Graphs/GraphVertexView.h>

Inheritance diagram for TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >:
[legend]
Collaboration diagram for TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >:
[legend]

Public Types

using Base = Matrices::DenseMatrixRowView< typename MatrixView::SegmentViewType, typename MatrixView::ValuesViewType >
 Base type.
using ConstMatrixRowView = typename MatrixRowView::ConstRowView
using ConstMatrixView = typename MatrixView::ConstViewType
 Type of constant dense matrix view.
using ConstVertexView = GraphVertexView< ConstMatrixView, GraphType_ >
 Type of the constant graph node view.
using IndexType
 The type used for matrix elements indexing.
using MatrixRowView
using MatrixView = Matrices::DenseMatrixView< Real, Device, Index, Organization >
 Type of the dense matrix view.
using RealType
 The type of matrix elements.
using SegmentViewType
 Type representing matrix row format.
using ValuesViewType
 Type of container view used for storing matrix elements values.
using VertexView = GraphVertexView< MatrixView, GraphType_ >
 Type of the graph node view.
Public Types inherited from TNL::Matrices::DenseMatrixRowView< Matrices::DenseMatrixView< Real, Device, Index, Organization >::SegmentViewType, Matrices::DenseMatrixView< Real, Device, Index, Organization >::ValuesViewType >
using ConstIteratorType
 Type of constant iterator for the matrix row.
using ConstRowView
 Type of constant sparse matrix row view.
using ConstValuesViewType
 Type of constant container view used for storing the matrix elements values.
using IndexType
 The type used for matrix elements indexing.
using IteratorType
 Type of iterator for the matrix row.
using MatrixElementType
 The type of related matrix element.
using RealType
 The type of matrix elements.
using RowView
 Type of dense matrix row view.
using SegmentViewType
 Type representing matrix row format.
using ValuesViewType
 Type of container view used for storing matrix elements values.

Public Member Functions

__cuda_callable__ GraphVertexView (const GraphVertexView &)=default
 Copy constructor.
__cuda_callable__ GraphVertexView (const MatrixRowView &matrixRowView)
 Constructs a vertex view from a matrix row view.
__cuda_callable__ GraphVertexView (const SegmentViewType &segmentView, const ValuesViewType &valuesView)
 Constructs a vertex view from segment and values views.
__cuda_callable__ GraphVertexView (MatrixRowView &&matrixRowView)
 Constructs a vertex view by moving from a matrix row view.
__cuda_callable__ IndexType getDegree () const
 Returns the degree (number of edges) of this vertex.
__cuda_callable__ RealTypegetEdgeWeight (IndexType edgeIndex)
 Returns the weight of the edge at the given edge index (non-const version).
__cuda_callable__ const RealTypegetEdgeWeight (IndexType edgeIndex) const
 Returns the weight of the edge at the given edge index (const version).
__cuda_callable__ IndexType getTargetIndex (IndexType edgeIndex) const
 Returns the target vertex index of the edge at the given edge index.
__cuda_callable__ IndexType getVertexIndex () const
 Returns the index of this vertex in the graph.
__cuda_callable__ void setEdge (IndexType edgeIndex, IndexType target, const RealType &weight)
 Sets both the target vertex and weight for an edge.
__cuda_callable__ void setEdgeWeight (IndexType edgeIndex, const RealType &weight)
 Sets the weight of the edge at the given edge index.
Public Member Functions inherited from TNL::Matrices::DenseMatrixRowView< Matrices::DenseMatrixView< Real, Device, Index, Organization >::SegmentViewType, Matrices::DenseMatrixView< Real, Device, Index, Organization >::ValuesViewType >
__cuda_callable__ DenseMatrixRowView (SegmentViewType segmentView, ValuesViewType values)
 Constructor with segmentView and values.
__cuda_callable__ IteratorType begin ()
 Returns iterator pointing at the beginning of the matrix row.
__cuda_callable__ ConstIteratorType cbegin () const
 Returns constant iterator pointing at the beginning of the matrix row.
__cuda_callable__ ConstIteratorType cend () const
 Returns constant iterator pointing at the end of the matrix row.
__cuda_callable__ IteratorType end ()
 Returns iterator pointing at the end of the matrix row.
__cuda_callable__ IndexType getColumnIndex (IndexType localIdx) const
 This method is only for compatibility with sparse matrix row.
__cuda_callable__ IndexType getRowIndex () const
 Returns the matrix row index.
__cuda_callable__ IndexType getSize () const
 Returns size of the matrix row, i.e. number of matrix elements in this row.
__cuda_callable__ const RealTypegetValue (IndexType column) const
 Returns constants reference to an element with given column index.
__cuda_callable__ void setElement (IndexType localIdx, IndexType column, const RealType &value)
 Sets value of matrix element with given column index.
__cuda_callable__ void setValue (IndexType column, const RealType &value)
 Sets value of matrix element with given column index.

Additional Inherited Members

Protected Attributes inherited from TNL::Matrices::DenseMatrixRowView< Matrices::DenseMatrixView< Real, Device, Index, Organization >::SegmentViewType, Matrices::DenseMatrixView< Real, Device, Index, Organization >::ValuesViewType >
SegmentViewType segmentView
ValuesViewType values

Detailed Description

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
struct TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >

Specialization of GraphVertexView for dense adjacency matrices.

This specialization is used when the graph stores its adjacency information using a dense matrix. In this case, edge indices correspond directly to target vertex indices, and all possible edges (for the vertex degree) are stored explicitly.

Template Parameters
RealType of edge weights.
DeviceDevice type (Host or Cuda).
IndexType for indexing vertices and edges.
OrganizationDense matrix elements organization.
GraphType_Graph type for orientation information.

Member Typedef Documentation

◆ MatrixRowView

Constructor & Destructor Documentation

◆ GraphVertexView() [1/3]

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::GraphVertexView ( const SegmentViewType & segmentView,
const ValuesViewType & valuesView )
inline

Constructs a vertex view from segment and values views.

Parameters
segmentViewView of the matrix segment (row metadata).
valuesViewView of edge weights.

◆ GraphVertexView() [2/3]

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::GraphVertexView ( MatrixRowView && matrixRowView)
inline

Constructs a vertex view by moving from a matrix row view.

Parameters
matrixRowViewMatrix row view to move from.

◆ GraphVertexView() [3/3]

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::GraphVertexView ( const MatrixRowView & matrixRowView)
inline

Constructs a vertex view from a matrix row view.

Parameters
matrixRowViewMatrix row view to copy from.

Member Function Documentation

◆ getDegree()

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ IndexType TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::getDegree ( ) const
inlinenodiscard

Returns the degree (number of edges) of this vertex.

For dense matrices, this is the size of the row, which corresponds to the number of vertices in the graph.

Returns
The vertex degree.

◆ getEdgeWeight() [1/2]

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ RealType & TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::getEdgeWeight ( IndexType edgeIndex)
inlinenodiscard

Returns the weight of the edge at the given edge index (non-const version).

Parameters
edgeIndexIndex of the edge (0 to getDegree()-1).
Returns
Reference to the edge weight.

◆ getEdgeWeight() [2/2]

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ const RealType & TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::getEdgeWeight ( IndexType edgeIndex) const
inlinenodiscard

Returns the weight of the edge at the given edge index (const version).

Parameters
edgeIndexIndex of the edge (0 to getDegree()-1).
Returns
Const reference to the edge weight.

◆ getTargetIndex()

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ IndexType TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::getTargetIndex ( IndexType edgeIndex) const
inlinenodiscard

Returns the target vertex index of the edge at the given edge index.

Parameters
edgeIndexIndex of the edge (0 to getDegree()-1).
Returns
Index of the target vertex.

◆ getVertexIndex()

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ IndexType TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::getVertexIndex ( ) const
inlinenodiscard

Returns the index of this vertex in the graph.

Returns
The vertex index.

◆ setEdge()

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ void TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::setEdge ( IndexType edgeIndex,
IndexType target,
const RealType & weight )
inline

Sets both the target vertex and weight for an edge.

For dense matrices, the edge is identified by its target index, so the edgeIndex parameter is not used. This method sets the weight for the edge to the specified target vertex.

Parameters
edgeIndexEdge index (it is ignored for dense adjacency matrices).
targetTarget vertex index.
weightNew weight for the edge.

◆ setEdgeWeight()

template<typename Real, typename Device, typename Index, TNL::Algorithms::Segments::ElementsOrganization Organization, typename GraphType_>
__cuda_callable__ void TNL::Graphs::GraphVertexView< Matrices::DenseMatrixView< Real, Device, Index, Organization >, GraphType_ >::setEdgeWeight ( IndexType edgeIndex,
const RealType & weight )
inline

Sets the weight of the edge at the given edge index.

Parameters
edgeIndexIndex of the edge (0 to getDegree()-1).
weightNew weight for the edge.

The documentation for this struct was generated from the following file: