Skip to content
New issue

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

[Feature request] Support xt::linalg::outer for higher-dimensional objects #231

Open
mircomarahrens opened this issue Mar 29, 2023 · 0 comments

Comments

@mircomarahrens
Copy link

Hello,

currently xt::linalg::outer only supports 1D vectors and is missing higher-dimensional objects. A quick workaround could be:

template<typename T>
static inline auto outer(expression_type <T> &M, expression_type <T> &W) {
    auto &&dM = M.derived_cast(); auto &&dW = W.derived_cast();
    shape_type shapeM = shape(M);
    dM = expand_dims(dM, shapeM.size());
    dW = expand_dims(dW, 0);
    return tensordot(dM, dW, {shapeM.size()}, {0});;
}

Is there a particular reason why only 1D vectors are supported in xt::linalg::outer?

Best regards,
Mirco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant