Skip to content

Dot product #23

@paraynaud

Description

@paraynaud

Specialize dot product when pv1.simulate_vector != pv2.simulate_vector.

Suppose $w$ a Vector represented by a PartitionedVector (storing $U_i w$) and $$v = \sum_{i=1}^N U_i^\top \hat{v}_i$$
then

$$ v^\top w = (\sum_{i=1}^N U_i^\top \widehat{v}_i)^\top w = \sum_{i=1}^N \widehat{v}_i^\top U_i w,$$

which accumulates element scalar products.

If both have simulate_vector=true we should avoid to build the Vector.
We should add a flag field saying if the Vector is build or not.

If both have simulate_vector=false we can try something more complex:

$$ \left (\sum_{i=1}^N U_i^\top \hat{v}_i \right)^\top \left (\sum_{i=1}^N U_i^\top \hat{w}_i \right) = \left (\sum_{i=1}^N \hat{v}_i^\top U_i \right) \left (\sum_{i=1}^N U_i^\top \hat{w}_i \right) = \sum_{i=1}^N \sum_{j=1}^N \hat{v}_i^\top U_i U_j^\top \hat{w}_j $$

Even if there is $N^2$ terms, a majority of them should vanish because $U_i U_j^\top=0$ if there is no common variables between elements.
After identifying those key pairs, we will have to access efficiently the value of their element components.

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