tensorflow / quantum
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 375 units with 8,786 lines of code in units (77.6% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (218 lines of code)
    • 34 medium complex units (2,325 lines of code)
    • 74 simple units (2,855 lines of code)
    • 265 very simple units (3,388 lines of code)
0% | 2% | 26% | 32% | 38%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cc0% | 2% | 27% | 39% | 30%
py0% | 2% | 26% | 21% | 49%
h0% | 0% | 15% | 59% | 25%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
tensorflow_quantum/core/src0% | 7% | 17% | 37% | 38%
tensorflow_quantum/datasets0% | 33% | 53% | 7% | 6%
tensorflow_quantum/core/ops0% | 0% | 31% | 37% | 30%
tensorflow_quantum/python/layers0% | 0% | 51% | 25% | 23%
tensorflow_quantum/python0% | 0% | 28% | 40% | 31%
tensorflow_quantum/core/serialize0% | 0% | 9% | 17% | 72%
tensorflow_quantum/python/differentiators0% | 0% | 23% | 33% | 43%
benchmarks/scripts/models0% | 0% | 100% | 0% | 0%
tensorflow_quantum/python/optimizers0% | 0% | 0% | 41% | 58%
benchmarks/scripts0% | 0% | 0% | 0% | 100%
scripts0% | 0% | 0% | 0% | 100%
release0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
void CreateGradientCircuit()
in tensorflow_quantum/core/src/adj_util.cc
118 37 4
def tfi_rectangular()
in tensorflow_quantum/datasets/spin_system.py
100 26 3
void Compute()
in tensorflow_quantum/core/ops/tfq_ps_decompose_op.cc
105 25 1
def __init__()
in tensorflow_quantum/python/layers/high_level/controlled_pqc.py
74 25 8
def gate_approx_eq()
in tensorflow_quantum/python/util.py
46 23 3
def exponential()
in tensorflow_quantum/python/util.py
51 23 2
def tfi_chain()
in tensorflow_quantum/datasets/spin_system.py
74 22 3
def xxz_chain()
in tensorflow_quantum/datasets/spin_system.py
85 22 3
Status ResolveQubitIds()
in tensorflow_quantum/core/src/program_resolution.cc
107 22 3
Status ResolveQubitIds()
in tensorflow_quantum/core/src/program_resolution.cc
80 20 4
def _channel_approx_eq()
in tensorflow_quantum/python/util.py
29 20 3
def serialize_circuit()
in tensorflow_quantum/core/serialize/serializer.py
46 19 1
def expand_circuits()
in tensorflow_quantum/python/layers/circuit_executors/input_checks.py
46 19 4
def _arg_to_proto()
in tensorflow_quantum/core/serialize/op_serializer.py
44 18 4
def __init__()
in tensorflow_quantum/python/layers/high_level/noisy_controlled_pqc.py
63 18 8
def batch_calculate_sampled_expectation()
in tensorflow_quantum/core/ops/batch_util.py
39 17 5
def _get_cirq_samples()
in tensorflow_quantum/core/ops/cirq_ops.py
80 16 1
void Compute()
in tensorflow_quantum/core/ops/tfq_ps_weights_from_symbols_op.cc
97 15 1
def call()
in tensorflow_quantum/python/layers/circuit_construction/elementary.py
33 15 5
void ComputeLarge()
in tensorflow_quantum/core/ops/noise/tfq_noisy_expectation.cc
80 14 6