Strilanc/Quirk

View on GitHub
src/math/Matrix.js

Summary

Maintainability
F
2 wks
Test Coverage

File Matrix.js has 891 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
Severity: Major
Found in src/math/Matrix.js - About 2 days to fix

    Matrix has 70 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Matrix {
        /**
         * @param {int} width
         * @param {int} height
         * @param {!Float64Array|!Float32Array} buffer Complex value data, packed row-wise with real and imaginary
    Severity: Major
    Found in src/math/Matrix.js - About 1 day to fix

      Function isScaler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          isScaler(epsilon=0) {
              if (this._width !== this._height) {
                  return false;
              }
              let sr = this._buffer[0];
      Severity: Minor
      Found in src/math/Matrix.js - About 1 hr 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 applyToStateVectorAtQubitWithControls has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          applyToStateVectorAtQubitWithControls(stateVector, qubitIndex, controls) {
              let chunkSize = this._width*2;
              let chunkBuf = stateVector._buffer.slice(0, chunkSize);
              let strideLength = 2 << qubitIndex;
              let strideChunkSize = strideLength*chunkSize >> 1;
      Severity: Minor
      Found in src/math/Matrix.js - About 1 hr 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 eigenDecomposition has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          eigenDecomposition() {
              if (this.width() !== 2 || this.height() !== 2) {
                  throw new Error("Not implemented: non-2x2 eigen decomposition");
              }
              let [a, b, c, d] = this._2x2Breakdown();
      Severity: Minor
      Found in src/math/Matrix.js - About 1 hr to fix

        Function expandedForQubitInRegister has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            expandedForQubitInRegister(targetQubitOffset, registerSize, controls) {
                let used = Math.round(Math.log2(this._width));
                let result = Matrix.identity(1 << (registerSize - targetQubitOffset - used)).
                    tensorProduct(this).
                    tensorProduct(Matrix.identity(1 << targetQubitOffset)).
        Severity: Minor
        Found in src/math/Matrix.js - About 1 hr 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 qubitOperationToAngleAxisRotation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            qubitOperationToAngleAxisRotation() {
                Util.need(this.width() === 2 && this.height() === 2, "Need a 2x2 matrix.");
                Util.need(this.isUnitary(0.01), "Need a unitary matrix.");
        
                // Extract orthogonal components, adjusting for factors of i.
        Severity: Minor
        Found in src/math/Matrix.js - About 1 hr to fix

          Function qrDecomposition has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              qrDecomposition() {
                  if (this._width !== this._height) {
                      throw new DetailedError("Expected a square matrix.", this);
                  }
                  let Q = Matrix.identity(this._width);
          Severity: Minor
          Found in src/math/Matrix.js - About 1 hr to fix

            Function isApproximatelyHermitian has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                isApproximatelyHermitian(epsilon) {
                    if (this._width !== this._height) {
                        return false;
                    }
                    for (let c = 0; c < this._width; c++) {
            Severity: Minor
            Found in src/math/Matrix.js - About 1 hr 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 tensorProduct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                tensorProduct(other) {
                    let w1 = this._width;
                    let h1 = this._height;
                    let w2 = other._width;
                    let h2 = other._height;
            Severity: Minor
            Found in src/math/Matrix.js - About 1 hr 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 isIdentity has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                isIdentity(epsilon=0) {
                    if (this._width !== this._height) {
                        return false;
                    }
                    for (let c = 0; c < this._width; c++) {
            Severity: Minor
            Found in src/math/Matrix.js - About 1 hr 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 tensorProduct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                tensorProduct(other) {
                    let w1 = this._width;
                    let h1 = this._height;
                    let w2 = other._width;
                    let h2 = other._height;
            Severity: Minor
            Found in src/math/Matrix.js - About 1 hr to fix

              Function timesQubitOperation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  timesQubitOperation(operation2x2, qubitIndex, controlMask, desiredValueMask) {
                      Util.need((controlMask & (1 << qubitIndex)) === 0, "Matrix.timesQubitOperation: self-controlled");
                      Util.need(operation2x2._width === 2 && operation2x2._height === 2, "Matrix.timesQubitOperation: not 2x2");
              
                      let {_width: w, _height: h, _buffer: old} = this;
              Severity: Minor
              Found in src/math/Matrix.js - About 1 hr to fix

                Function applyToStateVectorAtQubitWithControls has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    applyToStateVectorAtQubitWithControls(stateVector, qubitIndex, controls) {
                        let chunkSize = this._width*2;
                        let chunkBuf = stateVector._buffer.slice(0, chunkSize);
                        let strideLength = 2 << qubitIndex;
                        let strideChunkSize = strideLength*chunkSize >> 1;
                Severity: Minor
                Found in src/math/Matrix.js - About 1 hr to fix

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

                      isDiagonal(epsilon=0) {
                          for (let c = 0; c < this._width; c++) {
                              for (let r = 0; r < this._height; r++) {
                                  if (r === c) {
                                      continue;
                  Severity: Minor
                  Found in src/math/Matrix.js - 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 isUpperTriangular has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      isUpperTriangular(epsilon=0) {
                          for (let r = 0; r < this._height; r++) {
                              for (let c = 0; c < r && c < this._width; c++) {
                                  let k = (r*this._width + c)*2;
                                  let v1 = this._buffer[k];
                  Severity: Minor
                  Found in src/math/Matrix.js - 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 qrDecomposition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      qrDecomposition() {
                          if (this._width !== this._height) {
                              throw new DetailedError("Expected a square matrix.", this);
                          }
                          let Q = Matrix.identity(this._width);
                  Severity: Minor
                  Found in src/math/Matrix.js - 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 _timesMatrix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      _timesMatrix(other) {
                          if (this._width !== other._height) {
                              throw new DetailedError("Incompatible sizes.", {'this': this, other})
                          }
                          let w = other._width;
                  Severity: Minor
                  Found in src/math/Matrix.js - 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 isPhasedPermutation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      isPhasedPermutation(epsilon = 0) {
                          if (this._width !== this._height) {
                              return false;
                          }
                  
                  
                  Severity: Minor
                  Found in src/math/Matrix.js - 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 timesQubitOperation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      timesQubitOperation(operation2x2, qubitIndex, controlMask, desiredValueMask) {
                          Util.need((controlMask & (1 << qubitIndex)) === 0, "Matrix.timesQubitOperation: self-controlled");
                          Util.need(operation2x2._width === 2 && operation2x2._height === 2, "Matrix.timesQubitOperation: not 2x2");
                  
                          let {_width: w, _height: h, _buffer: old} = this;
                  Severity: Minor
                  Found in src/math/Matrix.js - 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 isLowerTriangular has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      isLowerTriangular(epsilon=0) {
                          for (let r = 0; r < this._height; r++) {
                              for (let c = r + 1; c < this._width; c++) {
                                  let k = (r*this._width + c)*2;
                                  let v1 = this._buffer[k];
                  Severity: Minor
                  Found in src/math/Matrix.js - 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 singularValueDecomposition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      singularValueDecomposition(epsilon=0, maxIterations=100) {
                          if (this._width !== this._height) {
                              throw new DetailedError("Expected a square matrix.", this);
                          }
                  
                  
                  Severity: Minor
                  Found in src/math/Matrix.js - 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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      _inline_rowMix_preMultiply(row1, row2, op) {
                          let [a, b, c, d] = op._2x2Breakdown();
                          for (let col = 0; col < this._width; col++) {
                              let x = this.cell(col, row1);
                              let y = this.cell(col, row2);
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 1 day to fix
                  src/math/Matrix.js on lines 975..989

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 285.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      _inline_colMix_postMultiply(col1, col2, op) {
                          let [a, b, c, d] = op._2x2Breakdown();
                          for (let row = 0; row < this._width; row++) {
                              let x = this.cell(col1, row);
                              let y = this.cell(col2, row);
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 1 day to fix
                  src/math/Matrix.js on lines 953..967

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 285.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      minus(other) {
                          let {_width: w, _height: h, _buffer: b1} = this;
                          let b2 = other._buffer;
                          Util.need(other._width === w && other._height === h, "Matrix.minus: compatible sizes");
                  
                  
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 6 hrs to fix
                  src/math/Matrix.js on lines 572..582

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 157.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      plus(other) {
                          let {_width: w, _height: h, _buffer: b1} = this;
                          let b2 = other._buffer;
                          Util.need(other._width === w && other._height === h, "Matrix.plus: compatible sizes");
                  
                  
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 6 hrs to fix
                  src/math/Matrix.js on lines 589..599

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 157.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      _inline_colScale_postMultiply(col, scale) {
                          for (let row = 0; row < this._height; row++) {
                              let v1 = this.cell(col, row);
                              let v2 = v1.times(scale);
                              let k = (row*this._width + col)*2;
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 5 hrs to fix
                  src/math/Matrix.js on lines 922..930

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 137.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      _inline_rowScale_preMultiply(row, scale) {
                          for (let col = 0; col < this._width; col++) {
                              let v1 = this.cell(col, row);
                              let v2 = v1.times(scale);
                              let k = (row*this._width + col)*2;
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 5 hrs to fix
                  src/math/Matrix.js on lines 937..945

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 137.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              for (let c = 0; c < r && c < this._width; c++) {
                                  let k = (r*this._width + c)*2;
                                  let v1 = this._buffer[k];
                                  let v2 = this._buffer[k+1];
                                  if (isNaN(v1) || isNaN(v2) || v1*v1 + v2*v2 > epsilon*epsilon) {
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 3 hrs to fix
                  src/math/Matrix.js on lines 329..336

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 107.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              for (let c = r + 1; c < this._width; c++) {
                                  let k = (r*this._width + c)*2;
                                  let v1 = this._buffer[k];
                                  let v2 = this._buffer[k+1];
                                  if (isNaN(v1) || isNaN(v2) || v1*v1 + v2*v2 > epsilon*epsilon) {
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 3 hrs to fix
                  src/math/Matrix.js on lines 347..354

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 107.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      getRow(rowIndex) {
                          Util.need(rowIndex >= 0 && rowIndex <= this.height(), "rowIndex >= 0 && rowIndex <= this.height()");
                          let row = [];
                          for (let c = 0; c < this._width; c++) {
                              row.push(this.cell(c, rowIndex));
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 3 hrs to fix
                  src/math/Matrix.js on lines 1382..1389

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 102.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      getColumn(colIndex) {
                          Util.need(colIndex >= 0 && colIndex <= this.width(), "colIndex >= 0 && colIndex <= this.width()");
                          let col = [];
                          for (let r = 0; r < this._height; r++) {
                              col.push(this.cell(colIndex, r));
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 3 hrs to fix
                  src/math/Matrix.js on lines 1395..1402

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 102.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  for (let i = 0; i < chunkBuf.length; i += 2) {
                                      resultBuf[k] = transformedChunk._buffer[i];
                                      resultBuf[k+1] = transformedChunk._buffer[i+1];
                                      k += strideLength;
                                  }
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 2 hrs to fix
                  src/math/Matrix.js on lines 692..696

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 82.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  for (let i = 0; i < chunkBuf.length; i += 2) {
                                      chunkBuf[i] = stateVector._buffer[k];
                                      chunkBuf[i+1] = stateVector._buffer[k+1];
                                      k += strideLength;
                                  }
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 2 hrs to fix
                  src/math/Matrix.js on lines 702..706

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 82.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          let vσ = Matrix.PAULI_X.times(x).
                              plus(Matrix.PAULI_Y.times(y)).
                              plus(Matrix.PAULI_Z.times(z));
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 1 hr to fix
                  src/math/Matrix.js on lines 841..843

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 58.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          let sigma_v = Matrix.PAULI_X.times(x).plus(
                                        Matrix.PAULI_Y.times(y)).plus(
                                        Matrix.PAULI_Z.times(z));
                  Severity: Major
                  Found in src/math/Matrix.js and 1 other location - About 1 hr to fix
                  src/math/Matrix.js on lines 1255..1257

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 58.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status