Skip to content

Use ArrayD as the return value of operator overloading functions #896

Closed
@SparrowLii

Description

@SparrowLii

In the current operator overloading function( which in impl_ops.rs ), we always use the dimension of the first operand as the dimension of the return value. This is obviously inconsistent with the facts, and this is the fundamental reason why we cannot achieve co-broadcasting.
I think the greatest significance of operator overloading and co_broadcast is to simplify the user's use, for which we can appropriately sacrifice a little efficiency. In this case, we should not ask users to ensure that the dimensions of the operands are the same. ( Otherwise they can use zip_mut_with directly).
So co_broadcast is what we need to implement in operator overloading. And because we cannot determine the dimension of its return value, using ArrayD is an inevitable trend.
( Or, we can implement separate operator overloading for each Dim (Ix0 ~ IxDyn) through procedural macros, but this will increase the amount of code dozens of times )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions