dseuss/mpnum

View on GitHub

Showing 61 of 125 total issues

Function sample has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def sample(self, rng, state, n_samples, method='cond', n_group=1,
Severity: Major
Found in mpnum/povm/mppovm.py - About 1 hr to fix

    Function sample has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def sample(self, rng, state, n_samples, method, n_group=1, mode='auto',
    Severity: Major
    Found in mpnum/povm/mppovm.py - About 1 hr to fix

      Function _local_sum_identity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _local_sum_identity(mpas, embed_tensor=None):
          """Implement a special case of :func:`local_sum`.
      
          See :func:`local_sum` for a description.  We return an MPA with
          smaller rank than naive embed+MPA-sum.
      Severity: Minor
      Found in mpnum/mparray.py - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function reductions_mpo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def reductions_mpo(mpa, width=None, startsites=None, stopsites=None):
          """Iterate over MPO partial traces of an MPO
      
          The support of the i-th result is :code:`range(startsites[i],
          stopsites[i])`.
      Severity: Minor
      Found in mpnum/mpsmpo.py - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function approx_range_finder has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def approx_range_finder(A, sketch_size, n_iter, piter_normalizer='auto',
                              randstate=np.random):
          """Computes an orthonormal matrix whose range approximates the range of A.
      
          Parameters
      Severity: Minor
      Found in mpnum/utils/extmath.py - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _sample_cond has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _sample_cond(self, rng, state, mode, n_samples, n_group, out, eps):
      Severity: Major
      Found in mpnum/povm/mppovm.py - About 50 mins to fix

        Function _eig_sum_minimize_locally has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _eig_sum_minimize_locally(
        Severity: Major
        Found in mpnum/linalg.py - About 50 mins to fix

          Function randomized_svd has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def randomized_svd(M, n_components, n_oversamples=10, n_iter='auto',
          Severity: Major
          Found in mpnum/utils/extmath.py - About 50 mins to fix

            Function eig_sum has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def eig_sum(mpas, num_sweeps, var_sites=2,
            Severity: Major
            Found in mpnum/linalg.py - About 50 mins to fix

              Function eig has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def eig(mpo, num_sweeps, var_sites=2,
              Severity: Major
              Found in mpnum/linalg.py - About 50 mins to fix

                Function random_mpa has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def random_mpa(sites, ldim, rank, randstate=None, normalized=False,
                Severity: Major
                Found in mpnum/factory.py - About 50 mins to fix

                  Function random_mpo has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def random_mpo(sites, ldim, rank, randstate=None, hermitian=False,
                  Severity: Major
                  Found in mpnum/factory.py - About 50 mins to fix

                    Function _eig_sum_leftvec_add has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def _eig_sum_leftvec_add(
                    Severity: Minor
                    Found in mpnum/linalg.py - About 45 mins to fix

                      Function _eig_sum_rightvec_add has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def _eig_sum_rightvec_add(
                      Severity: Minor
                      Found in mpnum/linalg.py - About 45 mins to fix

                        Function _sample_direct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _sample_direct(self, rng, state, mode, n_samples, out, eps):
                        Severity: Minor
                        Found in mpnum/povm/mppovm.py - About 45 mins to fix

                          Function _mppl_lfun_estimator has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def _mppl_lfun_estimator(self, est_coeff, est_funs, other, n_samples,
                          Severity: Minor
                          Found in mpnum/povm/mppovm.py - About 45 mins to fix

                            Function _random_op has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def _random_op(sites, ldim, hermitian=False, normalized=False, randstate=None,
                            Severity: Minor
                            Found in mpnum/factory.py - About 45 mins to fix

                              Function lfun_from has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def lfun_from(self, other, coeff, state, mode='auto', other_weights=None,
                              Severity: Minor
                              Found in mpnum/povm/mppovm.py - About 45 mins to fix

                                Function compression_svd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def compression_svd(array, rank, direction='right', retproj=False):
                                    """Re-implement MPArray.compress('svd') but on the level of the dense
                                    array representation, i.e. it truncates the Schmidt-decompostion
                                    on each bipartition sequentially.
                                
                                
                                Severity: Minor
                                Found in mpnum/_testing.py - About 45 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function est_lfun has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def est_lfun(self, coeff, funs, samples, weights=None, eps=1e-10):
                                Severity: Minor
                                Found in mpnum/povm/mppovm.py - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language