File: transpose.cu

package info (click to toggle)
python-escript 5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 87,772 kB
  • ctags: 49,550
  • sloc: python: 585,488; cpp: 133,173; ansic: 18,675; xml: 3,283; sh: 690; makefile: 215
file content (24 lines) | stat: -rw-r--r-- 468 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <cusp/transpose.h>
#include <cusp/array2d.h>
#include <cusp/print.h>

int main(void)
{
    // initialize a 2x3 matrix
    cusp::array2d<float, cusp::host_memory> A(2,3);
    A(0,0) = 10;  A(0,1) = 20;  A(0,2) = 30;
    A(1,0) = 40;  A(1,1) = 50;  A(1,2) = 60;

    // print A
    cusp::print(A);

    // compute the transpose
    cusp::array2d<float, cusp::host_memory> At;
    cusp::transpose(A, At);

    // print A^T
    cusp::print(At);

    return 0;
}