We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug outer function currently doesn't support input arrays of different sizes
To Reproduce nc::NdArray<double> x = {1., 2.}; nc::NdArray<double> y = {1., 2., 3.}; auto output = nc::outer (x, z);
nc::NdArray<double> x = {1., 2.}; nc::NdArray<double> y = {1., 2., 3.}; auto output = nc::outer (x, z);
Expected behavior output should be something like { {1, 2, 3}, {2, 4, 6} }
Code suggestions In addition to below, it would be good for the function to flatten the input arrays.
` template NdArray outer(const NdArray& inArray1, const NdArray& inArray2) { STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
const auto size1 = inArray1.size(); const auto size2 = inArray2.size(); auto returnArray = NdArray<dtype>(size1, size2); for (uint32 row = 0; row < size1; ++row) { const auto array1Value = inArray1[row]; std::transform(inArray2.begin(), inArray2.end(), returnArray.begin(row), [array1Value](dtype value) -> dtype { return array1Value * value; }); } return returnArray;
} `
The text was updated successfully, but these errors were encountered:
dpilger26
No branches or pull requests
Describe the bug
outer function currently doesn't support input arrays of different sizes
To Reproduce
nc::NdArray<double> x = {1., 2.}; nc::NdArray<double> y = {1., 2., 3.}; auto output = nc::outer (x, z);
Expected behavior
output should be something like { {1, 2, 3}, {2, 4, 6} }
Code suggestions
In addition to below, it would be good for the function to flatten the input arrays.
`
template
NdArray outer(const NdArray& inArray1, const NdArray& inArray2)
{
STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype);
}
`
The text was updated successfully, but these errors were encountered: