MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / assign

Function assign

src/backend/cpu/assign.cpp:34–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace cpu {
33template<typename T>
34void assign(Array<T>& out, const af_index_t idxrs[], const Array<T>& rhs) {
35 vector<bool> isSeq(4);
36 vector<af_seq> seqs(4, af_span);
37 // create seq vector to retrieve output dimensions, offsets & offsets
38 for (dim_t x = 0; x < 4; ++x) {
39 if (idxrs[x].isSeq) { seqs[x] = idxrs[x].idx.seq; }
40 isSeq[x] = idxrs[x].isSeq;
41 }
42
43 vector<Array<uint>> idxArrs(4, createEmptyArray<uint>(dim4()));
44 // look through indexs to read af_array indexs
45 for (dim_t x = 0; x < 4; ++x) {
46 if (!isSeq[x]) {
47 idxArrs[x] = castArray<uint>(idxrs[x].idx.arr);
48 idxArrs[x].eval();
49 }
50 }
51
52 vector<CParam<uint>> idxParams(idxArrs.begin(), idxArrs.end());
53 getQueue().enqueue(kernel::assign<T>, out, out.getDataDims(), rhs,
54 move(isSeq), move(seqs), move(idxParams));
55}
56
57#define INSTANTIATE(T) \
58 template void assign<T>(Array<T> & out, const af_index_t idxrs[], \

Callers

nothing calls this directly

Calls 5

dim4Class · 0.70
getQueueFunction · 0.50
evalMethod · 0.45
enqueueMethod · 0.45
getDataDimsMethod · 0.45

Tested by

no test coverage detected