A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://arrayfire.github.io/arrayfire-rust/arrayfire/../arrayfire/../arrayfire/struct.Indexer.html below:

arrayfire::Indexer - Rust

[−][src]Struct arrayfire::Indexer

Struct to manage an array of resources of type af_indexer_t(ArrayFire C struct)

While sharing an Indexer object with other threads, just move it across threads. At the moment, one cannot share borrowed references across threads.

Given below are examples illustrating correct and incorrect usage of Indexer struct.

Correct Usage
use arrayfire::{Array, Dim4, randu, index_gen, Indexer};





let dims    = Dim4::new(&[1, 3, 1, 1]);
let indices = [1u8, 0, 1];
let idx     = Array::new(&indices, dims);
let values  = [2.0f32, 5.0, 6.0];
let arr     = Array::new(&values, dims);

let mut idxr = Indexer::default();



idxr.set_index(&idx, 0, None);

index_gen(&arr, idxr);
Incorrect Usage

This example is not tested

idxr.set_index(&Array::new(&[1, 0, 1], dims), 0, None);
error: borrowed value does not live long enough
  --> <anon>:16:55
  |
16 | idxr.set_index(&Array::new(&[1, 0, 1], dims), 0, None);
  |                 ----------------------------          ^ temporary value dropped here while still borrowed
  |                 |
  |                 temporary value created here
...
19 | }
  | - temporary value needs to live until here
  |
  = note: consider using a `let` binding to increase its lifetime
impl<'object> Indexer<'object>[src] pub fn new() -> Self[src] 👎

Deprecated since 3.7.0:

Use Indexer::default() instead

Create a new Indexer object and set the dimension specific index objects later

pub fn set_index<'s, T>(
    &'s mut self,
    idx: &'object T,
    dim: u32,
    is_batch: Option<bool>
) where
    T: Indexable + 'object, 
[src]

Set either Array or Seq to index an Array along idx dimension

pub fn len(&self) -> usize[src]

Get number of indexing objects set

pub fn is_empty(&self) -> bool[src]

Check if any indexing objects are set

pub unsafe fn get(&self) -> af_index_t[src]

Get native(ArrayFire) resource handle


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4