dseuss/mpnum

View on GitHub

Showing 61 of 125 total issues

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

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

    def _generate(sites, ldim, rank, func, force_rank):
    Severity: Minor
    Found in mpnum/factory.py - About 35 mins to fix

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

          def lfun(self, coeff, funs, state, mode='auto', eps=1e-10):
      Severity: Minor
      Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

            def block_pmfs_as_array(self, state, mode, asarray=False, eps=1e-10,
        Severity: Minor
        Found in mpnum/povm/mppovm.py - About 35 mins to fix

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

          def random_mps(sites, ldim, rank, randstate=None, force_rank=False):
          Severity: Minor
          Found in mpnum/factory.py - About 35 mins to fix

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

            def _eig_minimize_locally(leftvec, mpo_ltens, rightvec, eigvec_ltens,
            Severity: Minor
            Found in mpnum/linalg.py - About 35 mins to fix

              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

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

                def approx_range_finder(A, sketch_size, n_iter, piter_normalizer='auto',
                Severity: Minor
                Found in mpnum/utils/extmath.py - About 35 mins to fix

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

                      def _compress_svd(self, rank=None, relerr=None, direction=None,
                  Severity: Minor
                  Found in mpnum/mparray.py - About 35 mins to fix

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

                        def _compression_var(self, num_sweeps, startmpa=None, rank=None,
                    Severity: Minor
                    Found in mpnum/mparray.py - About 35 mins to fix

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

                      def random_lowrank(rows, cols, rank, randstate=np.random, dtype=np.float_):
                      Severity: Minor
                      Found in mpnum/_testing.py - About 35 mins to fix

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

                            def block_pmfs_as_array(self, state, mode, asarray=False, eps=1e-10,
                        Severity: Minor
                        Found in mpnum/povm/mppovm.py - About 35 mins to fix

                          Function randomized_svd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def randomized_svd(M, n_components, n_oversamples=10, n_iter='auto',
                                             piter_normalizer='auto', transpose='auto', randstate=np.random):
                              """Computes a truncated randomized SVD. Uses the same convention as
                              :func:`scipy.sparse.linalg.svds`. However, we guarantee to return the
                              singular values in descending order.
                          Severity: Minor
                          Found in mpnum/utils/extmath.py - About 35 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def est_lfun(self, coeff, funs, samples, weights=None, eps=1e-10):
                                  """Estimate a linear combination of functions of POVM outcomes
                          
                                  This function estimates the function with exact value given by
                                  :func:`MPPovm.lfun`; see there for description of the
                          Severity: Minor
                          Found in mpnum/povm/mppovm.py - About 35 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 partialtrace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def partialtrace(mpa, axes=(0, 1), mptype=None):
                              """Computes the trace or partial trace of an MPA.
                          
                              This function is most useful for computing traces of an MPO or MPA over
                              given physical legs. For obtaining partial traces (i.e., reduced states)
                          Severity: Minor
                          Found in mpnum/mparray.py - About 35 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 dot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def dot(mpa1, mpa2, axes=(-1, 0), astype=None):
                              """Compute the matrix product representation of the contraction of ``a``
                                  and ``b`` over the given axes. [:ref:`Sch11 <Sch11>`, Sec. 4.2]
                          
                              :param mpa1, mpa2: Factors as MPArrays
                          Severity: Minor
                          Found in mpnum/mparray.py - About 35 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 _compress_svd_r has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _compress_svd_r(self, rank, relerr, svdfunc):
                                  """Compresses the MPA in place from left to right using SVD;
                                  yields a left-canonical state
                          
                                  See :func:`~compress` for parameters
                          Severity: Minor
                          Found in mpnum/mparray.py - About 25 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 sumup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def sumup(mpas, weights=None):
                              """Returns the sum of the MPArrays in ``mpas``. Same as
                          
                              .. code-block:: python
                          
                          
                          Severity: Minor
                          Found in mpnum/mparray.py - About 25 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 _compression_var has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _compression_var(self, num_sweeps, startmpa=None, rank=None,
                                                   randstate=np.random, var_sites=2):
                                  """Return a compression of ``self`` using variational compression
                                  [:ref:`Sch11 <Sch11>`, Sec. 4.5.2]
                          
                          
                          Severity: Minor
                          Found in mpnum/mparray.py - About 25 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def update(self, index, tens, canonicalization=None):
                                  """Update the local tensor at site ``index`` to the new value ``tens``.
                                  Checks the rank and shape of the new values to keep the MPA consistent.
                                  Therefore, some actions such as changing the rank between two sites
                                  require to update both sites at the same time, which can be done by
                          Severity: Minor
                          Found in mpnum/mpstruct.py - About 25 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

                          Severity
                          Category
                          Status
                          Source
                          Language