Skip to content

Optimization of the matrices multiplication #4

@olgOk

Description

@olgOk

Optimize matrices multiplication, tensors multiplication. The optimization allows to speed up essential circuit calculations. Please be familiar with TensorNetwork framework.
`def get_state_vector(self):
"""
Returns resulting state vector as a tensor of rank 1.
Round values to 3 decimal points.
"""
# connect all nodes and evaluate all tensors stored in it
self.evaluate_patch()

if len(self.network) > 1:
  for index in reversed(range(1, len(self.network) - 1)):
    self.network[index + 1][0] ^ self.network[index][1]
  self.network[1][0] ^ self.network[0][0]
nodes = tn.reachable(self.network[1])
result = tn.contractors.greedy(nodes, ignore_edge_order=True)
# round the result to three decimals
state_vecor = np.round(result.tensor, 3)
return state_vecor`

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions