MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / SparseMatrixDirectAccess

Class SparseMatrixDirectAccess

extensions/include/cuMat/src/SparseMatrix.h:558–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556
557 template<typename _SparseMatrix>
558 class SparseMatrixDirectAccess : public MatrixBase<SparseMatrixDirectAccess<_SparseMatrix> >
559 {
560 public:
561 using Type = SparseMatrixDirectAccess<_SparseMatrix>;
562 using Base = MatrixBase<Type>;
563 CUMAT_PUBLIC_API
564
565 private:
566 _SparseMatrix matrix_;
567 public:
568 SparseMatrixDirectAccess(const _SparseMatrix* matrix) : matrix_(*matrix) {} //store by value, needed for the host->device transfer
569
570 __host__ __device__ CUMAT_STRONG_INLINE Index rows() const { return matrix_.rows(); }
571 __host__ __device__ CUMAT_STRONG_INLINE Index cols() const { return matrix_.cols(); }
572 __host__ __device__ CUMAT_STRONG_INLINE Index batches() const { return matrix_.batches(); }
573 /**
574 * \brief Accesses a single entry, used directly the linear index to access the entry.
575 * \param linear the linear index
576 * \return the scalar coefficient at this position
577 * \see SparseMatrix::direct()
578 */
579 __device__ const Scalar& coeff(Index /*row*/, Index /*col*/, Index /*batch*/, Index linear) const
580 {
581 return matrix_.getRawCoeff(linear);
582 }
583 };
584} //end namespace internal
585
586//Common typedefs

Callers

nothing calls this directly

Calls 1

getRawCoeffMethod · 0.80

Tested by

no test coverage detected