I'm using CUSP for part of my GPU accelerated code. I have a need to extract the diagonal from a cusp matrix, C. Which should be put into diagonal in the below code.
cusp::extract_diagonal(C, diagonal);
However on compilation I get "cusp" has no member "extract_diagonal"
If I have:
#include <cusp/format_utils.h>
As in the example I get format_utils.h cannot be found. If I insert detail in to complete the path to the header as below:
#include <cusp/detail/format_utils.h>
Compilation is able to find format_utils.h but still says there is no "extract_diagonal"
The example I'm looking at is:
// include cusp array1d header file
#include <cusp/array1d.h>
#include <cusp/coo_matrix.h>
#include <cusp/print.h>
#incldue <cusp/gallery/poisson.h>
#include <cusp/format_utils.h>
int main()
{
// initialize 5x5 poisson matrix
cusp::coo_matrix<int,float,cusp::host_memory> A;
cusp::gallery::poisson5pt(A, 5, 5);
// allocate array to hold diagonal entries
cusp::array1d<float, cusp::host_memory> diagonal(A.num_rows);
// extract diagonal of A
cusp::extract_diagonal(A, diagonal);
// print diagonal entries
cusp::print(diagonal);
}
Versions are as below:
The following libraries were found:
CUDA v6.0
Thrust v1.7.1
Cusp v0.4.0
Am I missing some include or other? As a last resort I included all headers in the main cusp directory to no avail.
Any suggestions would be great.