Computing a sketch: dense data
Full matrix-matrix operations
-
template<typename T, typename SKOP>
inline void RandBLAS::sketch_general(blas::Layout layout, blas::Op opS, blas::Op opA, int64_t d, int64_t n, int64_t m, T alpha, SKOP &S, const T *A, int64_t lda, T beta, T *B, int64_t ldb) Sketch from the left in a GEMM-like operation
\[\operatorname{mat}(B) = \alpha \cdot \underbrace{\operatorname{op}(S)}_{d \times m} \cdot \underbrace{\operatorname{op}(\operatorname{mat}(A))}_{m \times n} + \beta \cdot \underbrace{\operatorname{mat}(B)}_{d \times n}, \tag{$\star$}\]where \(\alpha\) and \(\beta\) are real scalars, \(\operatorname{op}(X)\) either returns a matrix \(X\) or its transpose, and \(S\) is a sketching operator.
-
template<typename T, typename SKOP>
inline void RandBLAS::sketch_general(blas::Layout layout, blas::Op opA, blas::Op opS, int64_t m, int64_t d, int64_t n, T alpha, const T *A, int64_t lda, SKOP &S, T beta, T *B, int64_t ldb) Sketch from the right in a GEMM-like operation
\[\operatorname{mat}(B) = \alpha \cdot \underbrace{\operatorname{op}(\operatorname{mat}(A))}_{m \times n} \cdot \underbrace{\operatorname{op}(S)}_{n \times d} + \beta \cdot \underbrace{\operatorname{mat}(B)}_{m \times d}, \tag{$\star$}\]where \(\alpha\) and \(\beta\) are real scalars, \(\operatorname{op}(X)\) either returns a matrix \(X\) or its transpose, and \(S\) is a sketching operator.
Full matrix-vector operations
-
template<typename T, typename SKOP>
inline void RandBLAS::sketch_vector(blas::Op opS, T alpha, SKOP &S, const T *x, int64_t incx, T beta, T *y, int64_t incy) Perform a GEMV-like operation:
\[\operatorname{mat}(y) = \alpha \cdot \operatorname{op}(S) \cdot \operatorname{mat}(x) + \beta \cdot \operatorname{mat}(y), \tag{$\star$}\]where \(\alpha\) and \(\beta\) are real scalars and \(S\) is a sketching operator.
Submatrix operations
-
template<typename T, typename SKOP>
inline void RandBLAS::sketch_general(blas::Layout layout, blas::Op opS, blas::Op opA, int64_t d, int64_t n, int64_t m, T alpha, SKOP &S, int64_t ro_s, int64_t co_s, const T *A, int64_t lda, T beta, T *B, int64_t ldb) Sketch from the left in a GEMM-like operation
\[\operatorname{mat}(B) = \alpha \cdot \underbrace{\operatorname{op}(\operatorname{submat}(S))}_{d \times m} \cdot \underbrace{\operatorname{op}(\operatorname{mat}(A))}_{m \times n} + \beta \cdot \underbrace{\operatorname{mat}(B)}_{d \times n}, \tag{$\star$}\]where \(\alpha\) and \(\beta\) are real scalars, \(\operatorname{op}(X)\) either returns a matrix \(X\) or its transpose, and \(S\) is a sketching operator.
-
template<typename T, typename SKOP>
inline void RandBLAS::sketch_general(blas::Layout layout, blas::Op opA, blas::Op opS, int64_t m, int64_t d, int64_t n, T alpha, const T *A, int64_t lda, SKOP &S, int64_t ro_s, int64_t co_s, T beta, T *B, int64_t ldb) Sketch from the right in a GEMM-like operation
\[\operatorname{mat}(B) = \alpha \cdot \underbrace{\operatorname{op}(\operatorname{mat}(A))}_{m \times n} \cdot \underbrace{\operatorname{op}(\operatorname{submat}(S))}_{n \times d} + \beta \cdot \underbrace{\operatorname{mat}(B)}_{m \times d}, \tag{$\star$}\]where \(\alpha\) and \(\beta\) are real scalars, \(\operatorname{op}(X)\) either returns a matrix \(X\) or its transpose, and \(S\) is a sketching operator.
-
template<typename T, typename SKOP>
inline void RandBLAS::sketch_vector(blas::Op opS, int64_t d, int64_t m, T alpha, SKOP &S, int64_t ro_s, int64_t co_s, const T *x, int64_t incx, T beta, T *y, int64_t incy) Perform a GEMV-like operation. If \({\texttt{opS}} = \texttt{NoTrans},\) then we perform
\[\operatorname{mat}(y) = \alpha \cdot \underbrace{\operatorname{submat}(S)}_{d \times m} \cdot \underbrace{\operatorname{mat}(x)}_{m \times 1} + \beta \cdot \underbrace{\operatorname{mat}(y)}_{d \times 1}, \tag{$\star$}\]otherwise, we perform
\[\operatorname{mat}(y) = \alpha \cdot \underbrace{\operatorname{submat}(S)^T}_{m \times d} \cdot \underbrace{\operatorname{mat}(x)}_{d \times 1} + \beta \cdot \underbrace{\operatorname{mat}(y)}_{m \times 1}, \tag{$\diamond$}\]where \(\alpha\) and \(\beta\) are real scalars and \(S\) is a sketching operator.