Returns the first element of the array. More...

template<typename T >
scalar () const
 Returns host-side scalar of first component of data. More...
 

Detailed Description

Returns the first element of the array.

Gets the first element of the array and transefer it to the host.

Function Documentation

T scalar ( ) const

Returns host-side scalar of first component of data.

No need to call unlock() afterward.

float f[] = {1,2,3,4};
array a(2,2,f);
float scalar = a.scalar<float>();
printf("%f\n",scalar); //prints 1.0