GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
GmCSxSparseMatrixLayout< IndexType, T > Struct Template Reference

A structure for storing a matrix layout in either CSR or CSC format. The template type defines the type that will be used for storing indices (the Armadillo library, for example, works with a 64 bits index while the LIS library works with a 32 bits index). More...

#include <gmSparseMatrixLayout.h>

Inheritance diagram for GmCSxSparseMatrixLayout< IndexType, T >:
Collaboration diagram for GmCSxSparseMatrixLayout< IndexType, T >:

Public Member Functions

 GmCSxSparseMatrixLayout (bool arma)
 Constructor.

 
virtual ~GmCSxSparseMatrixLayout ()
 Destructor.
 
virtual bool empty () const
 Returns true if the layout is empty.
 
virtual void clear ()
 Clears the layout releasing memory and making the matrix a zero matrix.
 
virtual int index (int row, int col) const
 Returns the index for the value in the given matrix row, col. Returns -1 if the value is not part of the sparse layout.
 
virtual int dindex (int n) const
 Returns the index for the value in the diagonal of the given matrix row (column). Returns -1 if the value is not part of the sparse layout. This call is semantically equivalent to calling index(n, n) but can be optimized depending on the sparse layout in use.
 
virtual void printStatistics (const GmLogCategory &logger) const
 Print layout statistics to the given logger.
 
GMC_API_EXPORT int index (int row, int col) const
 An specialization of GmCSxSparseMatrixLayout::index() for CSC matrices. Since we can't partially specialize a member function without partially specializing the whole class, two identical implementations are needed, one for each supported IndexType.
 
GMC_API_EXPORT int index (int row, int col) const
 Returns the index for the value in the given matrix row, col. Returns -1 if the value is not part of the sparse layout.
 
GMC_API_EXPORT int index (int row, int col) const
 An specialization of GmCSxSparseMatrixLayout::index() for CSR matrices.
 
GMC_API_EXPORT int index (int row, int col) const
 Returns the index for the value in the given matrix row, col. Returns -1 if the value is not part of the sparse layout.
 
- Public Member Functions inherited from GmSparseMatrixLayout
 GmSparseMatrixLayout (GmSparseMatrixLayoutTypes type)
 Constructor.
 
virtual ~GmSparseMatrixLayout ()
 Virtual destructor.
 
void emitLayoutCompleted ()
 Emits the layoutCompleted signal.
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Public Attributes

IndexType * _ptr
 Vector storing the index of the first non zero element of each matrix row(CSR)/column(CSC). Size = _n + 1.
 
IndexType * _index
 Vector storing the column(CSR)/row(CSC) index for each non zero value. Size = _nnz.
 
int _n
 The number of rows(CSR)/columns(CSC) in the matrix.
 
int _nnz
 The number of elements stored in the matrix (in some cases zero values can be stored, so this can be different from the real number of non zero entries in the matrix)
 
int _arma
 Stores 1 if the layout should store 1 extra space per vector to be compatible with Armadillo requirements. 0 otherwise.
 
- Public Attributes inherited from GmSparseMatrixLayout
GmSparseMatrixLayoutTypes _type
 The stored sparse matrix type.
 
bool _shared
 Is this layout shared? Mutable to enable matrices sharing a layout to specify so.
 

Protected Member Functions

int indexWorker (int start, int end, int ind) const
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Signals inherited from GmSparseMatrixLayout
void layoutCompleted ()
 A signal emitted when the layout has been completed. This signal is emitted on behalf of the layout builder so that matrices sharing a layout don't have to also share the builder.
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

template<class IndexType, GmSparseMatrixLayoutTypes T>
struct GmCSxSparseMatrixLayout< IndexType, T >

A structure for storing a matrix layout in either CSR or CSC format. The template type defines the type that will be used for storing indices (the Armadillo library, for example, works with a 64 bits index while the LIS library works with a 32 bits index).

Constructor & Destructor Documentation

◆ GmCSxSparseMatrixLayout()

template<class IndexType , GmSparseMatrixLayoutTypes T>
GmCSxSparseMatrixLayout< IndexType, T >::GmCSxSparseMatrixLayout ( bool arma)
inline

Constructor.

When the arma flag is set to true, the layout includes extra positions for storing sentinel values needed by the Armadillo CSC format

Member Function Documentation

◆ clear()

template<class IndexType , GmSparseMatrixLayoutTypes T>
virtual void GmCSxSparseMatrixLayout< IndexType, T >::clear ( )
inlinevirtual

Clears the layout releasing memory and making the matrix a zero matrix.

Implements GmSparseMatrixLayout.

◆ dindex()

template<class IndexType , GmSparseMatrixLayoutTypes T>
virtual int GmCSxSparseMatrixLayout< IndexType, T >::dindex ( int n) const
inlinevirtual

Returns the index for the value in the diagonal of the given matrix row (column). Returns -1 if the value is not part of the sparse layout. This call is semantically equivalent to calling index(n, n) but can be optimized depending on the sparse layout in use.

Implements GmSparseMatrixLayout.

◆ empty()

template<class IndexType , GmSparseMatrixLayoutTypes T>
virtual bool GmCSxSparseMatrixLayout< IndexType, T >::empty ( ) const
inlinevirtual

Returns true if the layout is empty.

Implements GmSparseMatrixLayout.

◆ index() [1/5]

template<class IndexType , GmSparseMatrixLayoutTypes T>
virtual int GmCSxSparseMatrixLayout< IndexType, T >::index ( int row,
int col ) const
virtual

Returns the index for the value in the given matrix row, col. Returns -1 if the value is not part of the sparse layout.

Implements GmSparseMatrixLayout.

◆ index() [2/5]

GMC_API_EXPORT int GmCSxSparseMatrixLayout< int, GM_CSC_SPARSE_FORMAT >::index ( int row,
int col ) const
virtual

An specialization of GmCSxSparseMatrixLayout::index() for CSC matrices. Since we can't partially specialize a member function without partially specializing the whole class, two identical implementations are needed, one for each supported IndexType.

Implements GmSparseMatrixLayout.

◆ index() [3/5]

GMC_API_EXPORT int GmCSxSparseMatrixLayout< arma::uword, GM_CSC_SPARSE_FORMAT >::index ( int row,
int col ) const
virtual

Returns the index for the value in the given matrix row, col. Returns -1 if the value is not part of the sparse layout.

Implements GmSparseMatrixLayout.

◆ index() [4/5]

GMC_API_EXPORT int GmCSxSparseMatrixLayout< int, GM_CSR_SPARSE_FORMAT >::index ( int row,
int col ) const
virtual

An specialization of GmCSxSparseMatrixLayout::index() for CSR matrices.

Implements GmSparseMatrixLayout.

◆ index() [5/5]

GMC_API_EXPORT int GmCSxSparseMatrixLayout< arma::uword, GM_CSR_SPARSE_FORMAT >::index ( int row,
int col ) const
virtual

Returns the index for the value in the given matrix row, col. Returns -1 if the value is not part of the sparse layout.

Implements GmSparseMatrixLayout.

◆ printStatistics()

template<class IndexType , GmSparseMatrixLayoutTypes T>
void GmCSxSparseMatrixLayout< IndexType, T >::printStatistics ( const GmLogCategory & logger) const
virtual

Print layout statistics to the given logger.

Implements GmSparseMatrixLayout.


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