AdamNiederer / AdamNiederer/faster

how to accomplish `zip_mut_with` in faster?

Đang mở
#37 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
1.6k
Fork
52
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

hey,

I have spent a few minutes trying unsuccessfully to write a simd version of code that uses ndarray's [`zip_mut_with`](https://docs.rs/ndarray/0.10.14/ndarray/struct.ArrayBase.html#method.zip_mut_with) - is there currently a way of combining a `simd_iter_mut` and `simd_iter` with `zip`?

Essentially, I'd like to modify the elements of an array in place with an operation that uses the values in another array of the same shape.

I tried this:

```rust
let mut xs = ndarray::Array::from_elem((64,), 0.0f32);
let ys = ndarray::Array::from_elem((64,), 1.0f32);
(xs.as_slice_mut().unwrap().simd_iter_mut(f32s(0.0)),
ys.as_slice().unwrap().simd_iter(f32s(0.0)))
.zip()
.simd_for_each(|(x, y)| {
*x += *y; // or whatever, not sure if this is correct for the closure
});
```

and got this error:

```console
error[E0599]: no method named `simd_for_each` found for type `faster::Zip<(faster::SIMDIter<&mut [f32]>, faster::SIMDIter<&[f32]>)>` in the current scope
--> src/mlp/m3r.rs:298:26
|
298 | .simd_for_each(|(z, b)| {
| ^^^^^^^^^^^^^
...
```

Any recommendations for how to proceed? First time using the library, apologies if this is an obvious question.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.