Repository navigation
Documentation improvements for new users #587
Description
Activity
There are a few issues:
TandUneed more trait bounds (MulonTandCloneonU).- When multiplying two variables of type
ArrayViewtogether, a&must be explicitly written for each operand. The reason is that there are a few implementations ofMulfor various combinations of owned arrays and references to arrays. For example, if the left operand is an owned array, then you can use this implementation or this one, neither of which needs to allocate a new array for the result. (They update the owned array in-place and return it.) When you only have two views, however, you need to use this implementation, which takes two references to arrays. See also Add examples of binary arithmetic operators #589. - The implementation of
Mul<&'a ArrayBase<S2, E>> for &'a ArrayBase<S, D>(the one you need to use) currently doesn't allow arrays with elements of different types (TandUin the example you provided). I've created Allow ops on arrays with elems of different types #588 to fix this.
These changes make the project compile. Note that I've temporarily added a patch for
ndarrayto incorporate #588 until it's merged and a new version ofndarrayis released. Alternatively, if you want to use the most recent release ofndarraywithout this patch, you could eliminate theUtype parameter and useTwhereUis now.By the way, welcome to ndarray!
Ah thanks! The
TandUthing was one of my attempts to fix the issue! I've gone back to justTnow as I originally wrote.The example in #588 does help though I'd potentially add a note just to tell people that to use an arithmetic operator their type
Tshould implement it. It does feel like a bit of a silly mistake now I see it but it honestly hadn't occurred to me I was thinking it might have been down to theViewReprvsOwnedRepror the factTdidn't impl one of theDatatraits.And thanks I'm looking forward to getting deeper into ndarray 😄. Since my current issue has been resolved you can close this if you want. I'll open new issues if I encounter any other troubles
- addeddocsIssues relating primarily to documentation or API visibility.Issues relating primarily to documentation or API visibility.
on Feb 25, 2019
So I'm a new user to ndarray and was recommended to open an issue with any roadblocks or issues I have using ndarray as areas where the docs or examples could be improved to make it easier for people to use.
Currently my one issue is trying to multiply two views of an array together saving the result in a new array. I'm taking a window of an array, multiplying it by a provided
ArrayView3but I just get some variant ofOr
I thought from the docs here that multiplying references to the
Windowand theArrayView3would work. But it doesn't and I haven't found any docs or examples that have helped me figure this out yet.For reference the code is here:
https://github.com/xd009642/ndarray-vision/blob/eba3eff041be6d88f4605261138893d1a3d90c33/src/core/image.rs#L46