pub type GpuVector<T> = GpuTensor<T, 1>;
Expand description
A storage buffer containing a vector.
Aliased Type§
pub struct GpuVector<T> { /* private fields */ }
Implementations§
Source§impl<T> GpuVector<T>
impl<T> GpuVector<T>
Sourcepub fn encase(
device: &Device,
vector: impl AsRef<[T]>,
usage: BufferUsages,
) -> Self
pub fn encase( device: &Device, vector: impl AsRef<[T]>, usage: BufferUsages, ) -> Self
Allocates a new vector on the gpu initialized from vector
.
If T
implements Pod
, use GpuMatrix::init
instead.
Sourcepub fn uninit(device: &Device, len: u32, usage: BufferUsages) -> Selfwhere
T: Pod,
pub fn uninit(device: &Device, len: u32, usage: BufferUsages) -> Selfwhere
T: Pod,
Allocates a new uninitialized vector on the gpu for len
elements of type T
.
Sourcepub fn init(
device: &Device,
vector: impl AsRef<[T]>,
usage: BufferUsages,
) -> Selfwhere
T: Pod,
pub fn init(
device: &Device,
vector: impl AsRef<[T]>,
usage: BufferUsages,
) -> Selfwhere
T: Pod,
Allocates a new vector on the gpu initialized from vector
.
If T
does not implement Pod
, use GpuMatrix::encase
instead.
Sourcepub fn rows(&self, first_row: u32, num_rows: u32) -> GpuVectorView<'_, T>
pub fn rows(&self, first_row: u32, num_rows: u32) -> GpuVectorView<'_, T>
Takes a view, over this vector, with num_rows
rows starting at row first_row
.