BallisticLA / RandBLAS

A header-only C++ library for sketching in randomized linear algebra
https://randblas.readthedocs.io/en/latest/
Other
64 stars 4 forks source link

Possible New Feature : Adding a new function sketch_vector #66

Closed kaiwenhe7 closed 9 months ago

kaiwenhe7 commented 11 months ago

In the case where the user has a vector $\texttt{b}$ that they want to sketch, many of the arguments of sketch_general are not needed. Analogous to GEMV in the BLAS, it may be useful for the user to have a sketch_vector function for computing $\texttt{S} \cdot \texttt{b}$.

rileyjmurray commented 11 months ago

@kaiwenhe7 what do you think of a function signature like the following?

/* 
    y = alpha * opS(submat(S)) * x + beta * y
*/
template <typename T, typename SKOP>
void sketch_vector(
    blas::Op opS,
    int64_t d, // y has length d
    int64_t m, // opS(submat(S)) is d-by-m
    T alpha,
    SKOP &S,
    int64_t i_off,
    int64_t j_off,
    const T *x,
    int64_t incx,
    T beta,
    T *y,
    int64_t incy
);

Note that there would be no layout parameter, since there's no notion of layout for a general sketching operator S.

I think you can implement this just by falling back on sketch_general<T, SKOP>, without considering special implementations for each type of sketching operator.

If this signature looks good to you, can you try implementing it? When you write tests, it would suffice to test with one type of sketching operator.

kaiwenhe7 commented 11 months ago

I think that looks good for the arguments. For the implementation, would it involve calling sketch_general with the correct arguments for a vector or would it call lskge3 for example?

rileyjmurray commented 11 months ago

I’d say just call sketch_general with correct arguments

On Thu, Jul 27, 2023 at 4:11 PM kaiwenhe7 @.***> wrote:

I think that looks good for the arguments. For the implementation, would it involve calling sketch_general with the correct arguments for a vector or would it call lskge3 for example?

— Reply to this email directly, view it on GitHub https://github.com/BallisticLA/RandBLAS/issues/66#issuecomment-1654491575, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRLIFCLW3UD4IDKYJMCWPTXSLDPDANCNFSM6AAAAAA2Y72IT4 . You are receiving this because you commented.Message ID: @.***>

-- Riley

rileyjmurray commented 9 months ago

This will be resolved by #74 once that PR is merged.