-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathget_transpose.hpp
More file actions
32 lines (28 loc) · 910 Bytes
/
get_transpose.hpp
File metadata and controls
32 lines (28 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include <cusparse.h>
#include <spblas/detail/view_inspectors.hpp>
namespace spblas {
namespace __cusparse {
//
// Takes in a CSR or CSR_transpose (aka CSC) or CSC or CSC_transpose
// and returns the cusparseOperation_t value associated with it being
// represented in the CSR format
//
// CSR = CSR + NON_TRANSPOSE
// CSR_transpose = CSR + TRANSPOSE
// CSC = CSR + TRANSPOSE
// CSC_transpose = CSR + NON_TRANSPOSE
//
template <matrix M>
cusparseOperation_t get_transpose(M&& m) {
static_assert(__detail::has_csr_base<M> || __detail::has_csc_base<M>);
if constexpr (__detail::has_base<M>) {
return get_transpose(m.base());
} else if constexpr (__detail::is_csr_view_v<M>) {
return CUSPARSE_OPERATION_NON_TRANSPOSE;
} else if constexpr (__detail::is_csc_view_v<M>) {
return CUSPARSE_OPERATION_TRANSPOSE;
}
}
} // namespace __cusparse
} // namespace spblas