MatMulParams

#include <popsparse/MatMulParams.hpp>

Definitions for sparse matrix multiply operations.

namespace popsparse

Support for sparse matrices.

namespace dynamic

Support for dynamic sparse matrices.

Functions

std::ostream &operator<<(std::ostream&, const MatMulParams&)
class MatMulParams

Matrix multiplication parameters

These are the parameters which define a matrix multiplication with one sparse operand (always the left-hand operand) and one dense operand.

Equivalent dense multiplication for given parameters is as follows:

[groups][m][k] * [groups][k][n] = [groups][m][n]

static MatMulParams createWithNzRatio(const SparsityParams &sparsityParams, double nzRatio, std::size_t groups, std::size_t m, std::size_t k, std::size_t n)
static MatMulParams createWithNumNonZeroValues(const SparsityParams &sparsityParams, std::size_t numNonZeroElems, std::size_t groups, std::size_t m, std::size_t k, std::size_t n)
inline const SparsityParams &getSparsityParams() const
inline std::size_t getNumGroups() const
inline std::size_t getM() const
inline std::size_t getK() const
inline std::size_t getN() const
double getNzRatio() const
std::size_t getNumNonZeroValues() const
friend bool operator<(const MatMulParams &a, const MatMulParams &b)
friend bool operator==(const MatMulParams &a, const MatMulParams &b)
friend bool operator!=(const MatMulParams &a, const MatMulParams &b)

Private Members

SparsityParams sparsityParams
double nzRatio
std::size_t groups
std::size_t m
std::size_t k
std::size_t n
namespace static_

Functions

std::ostream &operator<<(std::ostream&, const MatMulParams&)
class MatMulParams

Matrix multiplication parameters

These are the parameters which define a matrix multiplication with one sparse operand and one dense operand.

Equivalent dense multiplication for given parameters is as follows when created as sparse-dense using static_::MatMulParams::createForSparseDense

[groups][m][k] * [groups][k][n] = [groups][m][n]

Equivalent dense multiplication for given parameters is as follows when created as a dense-sparse using static_::MatMulParams::createForDenseSparse

[groups][n][k] * [groups][k][m] = [groups][n][m]

static MatMulParams createForSparseDense(std::size_t groups, std::size_t m, std::size_t k, std::size_t n)

Create matrix multiplication parameters for sparse * dense yielding a dense result.

[groups][m][k] * [groups][k][n] = [groups][m][n]

sparse * dense = dense

static MatMulParams createForDenseSparse(std::size_t groups, std::size_t n, std::size_t k, std::size_t m)

Create matrix multiplication parameters for sparse * dense yielding a dense result.

[groups][n][k] * [groups][k][m] = [groups][n][m]

dense * sparse = dense

inline std::size_t getNumGroups() const
inline std::size_t getM() const
inline std::size_t getK() const
inline std::size_t getN() const
inline bool isTransposed() const
friend bool operator<(const MatMulParams &a, const MatMulParams &b)
friend bool operator==(const MatMulParams &a, const MatMulParams &b)
friend bool operator!=(const MatMulParams &a, const MatMulParams &b)

Private Members

std::size_t groups
std::size_t m
std::size_t k
std::size_t n
bool transposed