Skip to content

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

@mircomarahrens

Description

@mircomarahrens

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions