Skip to content

set_col() fails #143

@polarathene

Description

@polarathene

set_col() docs could do with an example.

It is not clear what the expected array for new_col should look like. I have tried dims [3, 1, 1, 1] and [1, 3, 1 ,1], both times an error was thrown about incorrect size.

let range_a: Vec<u8> = (1..4).collect();
let range_b: Vec<u8> = (4..7).collect();

let dims = Dim4::new(&[1, 3, 1, 1]);
let mut range_a_af = af::Array::new(&range_a, dims);
let     range_b_af = af::Array::new(&range_b, dims);

af_print!("range_a_af:", range_a_af);
// [1 3 1 1]
//          1          2          3 
af_print!("range_b_af:", range_b_af);
// [1 3 1 1]
//          4          5          6

// I'd like all values in a column to be changed to those the values in the given array or the given arrays matching column, I assume for a scalar value I'd use a constant array(sized to elements in the column or matching dims depending how this method works
range_a_af = set_col(&range_a_af, &range_b_af, 0); // should replace 1 with 4?
af_print!("range_a_af == [4, 2, 3]?: ", range_a_af);

This throws the following error:

In function void assign(opencl::Array<T>&, const unsigned int&, const af_seq*, const opencl::Array<outType>&) [with Tout = unsigned char; Tin = unsigned char; af_seq = af_seq]
In file src/api/c/assign.cpp:59
Size mismatch between input and output

thread 'main' panicked at 'Error message: Size is incorrect', /home/pola/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.4.3/src/error.rs:66

This might be due to the indexing bug that @9prady9 fixed here. Either that or I've misunderstood how to use this method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions