Skip to Content

clFloat {OpenCL}

clFloat represents a single-precision vector that can be used with OpenCL.
Package: 
OpenCL
Version: 
0.1-3

Description

clFloat is a constructor of a single-precision vector - an object of the class "clFloat".

The purpose of this type is to serve as a pass-though for OpenCL calls that involve single precision vectors such that they do not need to be converted to/from double precision and thus incurring the corresponding penalty. This type is not designed to be a full numeric vector replacement and thus opeartion such as arithmetics are intentionally not implemented.

The current internal representation is a raw vector of the machine-specific representation of the C float type but this may change in the future so no code should rely on it. It also implies that serialization is only compatible for machines of the same endianness.

as.clFloat coerces objects into single-precision vectors essentially by calling clFloat(as.numeric(x)).

is.clFloat returns TRUE the x is an object of the class clFloat

Some most basic methods such as length or print are implemented as well as basic coersion methods.

Usage

clFloat(x)
as.clFloat(x)
is.clFloat(x)
 
## S3 method for class 'clFloat':
as.double((x, ...))

## S3 method for class 'clFloat':
as.integer((x, ...))

## S3 method for class 'clFloat':
as.character((x, ...))

## S3 method for class 'clFloat':
print((x, ...))

## S3 method for class 'clFloat':
length((x))

## S3 replacement method for class 'clFloat':
length((x) <- value)

## S3 method for class 'clFloat':
x[(...)]

## S3 replacement method for class 'clFloat':
x[(...) <- value]

Arguments

x
object
...
arguments passed to subsequent methods
value
new length or values

See Also

oclRun

Examples

x <- clFloat(1:10/2)
print(x)
length(x)
as.double(x)
as.character(x)
as.integer(x)
is.clFloat(x)
identical(x, as.clFloat(as.numeric(x)))
x[1:5]
x[1] <- 0
 
## clFloat is the return type of oclRun(..., native.result=TRUE)
## for single-precision kernels. It can also be used instead of
## numeric vectors in such kernels to avoid conversions.
## See oclRun() examples.

Author(s)

Simon Urbanek

Documentation reproduced from package OpenCL, version 0.1-3. License: BSD