autoray.experimental.complexity_tracing
=======================================

.. py:module:: autoray.experimental.complexity_tracing

.. autoapi-nested-parse::

   Functionality for tracing through an autoray.lazy computation and estimating
   the cost and scaling.

   In the following there are ``cost_*`` functions that estimate the total cost
   of a given operation, including sub-leading factors. There are also
   `cost_scaling_*` functions that only consider the leading factor of the cost,
   so that we can prime number decompose it and extract the scaling.



Attributes
----------

.. autoapisummary::

   autoray.experimental.complexity_tracing.cost_scaling_tensordot
   autoray.experimental.complexity_tracing.cost_scaling_matmul
   autoray.experimental.complexity_tracing.cost_scaling_einsum
   autoray.experimental.complexity_tracing.COSTS
   autoray.experimental.complexity_tracing.COST_SCALINGS


Functions
---------

.. autoapisummary::

   autoray.experimental.complexity_tracing.cost_tensordot
   autoray.experimental.complexity_tracing.cost_qr
   autoray.experimental.complexity_tracing.cost_svd
   autoray.experimental.complexity_tracing.cost_eigh
   autoray.experimental.complexity_tracing.cost_scaling_linalg
   autoray.experimental.complexity_tracing.cost_matmul
   autoray.experimental.complexity_tracing.cost_einsum
   autoray.experimental.complexity_tracing.cost_linear
   autoray.experimental.complexity_tracing.cost_nothing
   autoray.experimental.complexity_tracing.cost_node
   autoray.experimental.complexity_tracing.compute_cost
   autoray.experimental.complexity_tracing.prime_factors
   autoray.experimental.complexity_tracing.is_prime
   autoray.experimental.complexity_tracing.closest_prime
   autoray.experimental.complexity_tracing.frequencies
   autoray.experimental.complexity_tracing.compute_cost_scalings


Module Contents
---------------

.. py:function:: cost_tensordot(x)

.. py:data:: cost_scaling_tensordot

.. py:function:: cost_qr(x)

.. py:function:: cost_svd(x)

.. py:function:: cost_eigh(x)

.. py:function:: cost_scaling_linalg(x)

   Here we only care about the leading factor of the cost, which we need to
   preserve so that we can prime number decompose it.


.. py:function:: cost_matmul(x)

.. py:data:: cost_scaling_matmul

.. py:function:: cost_einsum(x)

.. py:data:: cost_scaling_einsum

.. py:function:: cost_linear(x)

.. py:function:: cost_nothing(x)

.. py:data:: COSTS

.. py:function:: cost_node(x, allow_missed=True)

.. py:function:: compute_cost(z, print_missed=True)

.. py:data:: COST_SCALINGS

.. py:function:: prime_factors(n) -> list[int]

.. py:function:: is_prime(n: int) -> bool

.. py:function:: closest_prime(nt: int) -> int

.. py:function:: frequencies(it)

.. py:function:: compute_cost_scalings(z, factor_map, print_missed=True)

