Skip to content

[ENHANCEMENT] Customize fuseaxes on FusionStyle #69

@mtfishman

Description

@mtfishman

fuseaxes is used in matricize to fuse the axes of the codomain and domain:

function matricize(::ReshapeFusion, a::AbstractArray, biperm::BlockedTrivialPermutation{2})
new_axes = fuseaxes(axes(a), biperm)
return reshape(a, new_axes...)
end

It is defined as reducing over TensorProducts.⊗/TensorProducts.tensor_product:

function fuseaxes(
axes::Tuple{Vararg{AbstractUnitRange}}, blockedperm::AbstractBlockPermutation
)
axesblocks = blocks(axes[blockedperm])
return map(block -> isempty(block) ? trivial_axis(axes) : (block...), axesblocks)
end

I think it would make sense to have a version of fuseaxes and tensor_product that accepts the FusionStyle as a first argument so they can be customized on the FusionStyle. That can make sure that the space determined for the matricization is consistent with the desired type of matricization (for example, in the case of fused or unfused matricization of symmetric tensors).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions