Returns a string representation of a mat3

@param {mat3} a matrix to represent as a string
@returns {String} string representation of the matrix
483444
function str(a) {
  return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';
}
588800
private static String arraysToString(final Object[] a) {
    if (a == null) {
      return "null";
    }
    final int iMax = a.length - 1;
    if (iMax == -1) {
      return "[]";
    }

    final StringBuilder b = new StringBuilder();
    b.append('[');
    for (int i = 0;; i++) {
      b.append(String.valueOf(a[i]));
      if (i == iMax) {
        return b.append(']').toString();
      }
      b.append(", ");
    }
  }
576669
function flatten(matrix) {
    const res = [];

    // If the given matrix is not a matrix but a scalar.
    if (!Array.isArray(matrix)) {
        matrix = [
            [matrix]
        ];
    }

    matrix.forEach((row) => {
        // If the given matrix is a vector.
        if (!Array.isArray(row)) {
            row = [row];
        }

        row.forEach((elem) => {
            res.push(elem.real);
            res.push(elem.imag);
        });
    });
    return res;
}
1156662
def to_a type=String
      if type == String
        return self.to_s
      elsif type == Array
        return self.to_ary
      elsif type == Matrix
        return self.to_matrix
      else
        return nil
      end
    end
883931
def get_matrix(self):
        
        # Init matrix (remember, a matrix, not an array)
        a = np.zeros((4, 4), dtype=np.float32)
        w, x, y, z = self.w, self.x, self.y, self.z
        # First row
        a[0, 0] = - 2.0 * (y * y + z * z) + 1.0
        a[1, 0] = + 2.0 * (x * y + z * w)
        a[2, 0] = + 2.0 * (x * z - y * w)
        a[3, 0] = 0.0
        # Second row
        a[0, 1] = + 2.0 * (x * y - z * w)
        a[1, 1] = - 2.0 * (x * x + z * z) + 1.0
        a[2, 1] = + 2.0 * (z * y + x * w)
        a[3, 1] = 0.0
        # Third row
        a[0, 2] = + 2.0 * (x * z + y * w)
        a[1, 2] = + 2.0 * (y * z - x * w)
        a[2, 2] = - 2.0 * (x * x + y * y) + 1.0
        a[3, 2] = 0.0
        # Fourth row
        a[0, 3] = 0.0
        a[1, 3] = 0.0
        a[2, 3] = 0.0
        a[3, 3] = 1.0
        return a
242889
function printMatrix2 (m) {
  const tStr = m.elements.map(formatPrintNumber);
  const matrixString = `
  +-                -+
  | ${tStr[0]}  ${tStr[2]} |
  | ${tStr[1]}  ${tStr[3]} |
  +-                -+`;
  return matrixString;
}
311724
function(matrix) {
            	var M = matrix.elements || matrix;
            	if (typeof(M[0][0]) == 'undefined') { M = Matrix$b.create(M).elements; }
            	var T = this.dup(), cols = T.elements[0].length;
            	var i = T.elements.length, nj = M[0].length, j;
            	if (i != M.length) { return null; }
            	while (i--) {
            	    j = nj;
            	    while (j--) {
            		T.elements[i][cols + j] = M[i][j];
            	    }
            	}
            	return T;
                }
227461
function() {
        return "| " + this.matrix[0][0] + " " + this.matrix[0][1] + " " + this.matrix[0][2] + " " + this.matrix[0][3] + " |\n" + "| " + this.matrix[1][0] + " " + this.matrix[1][1] + " " + this.matrix[1][2] + " " + this.matrix[1][3] + " |\n" + "| " + this.matrix[2][0] + " " + this.matrix[2][1] + " " + this.matrix[2][2] + " " + this.matrix[2][3] + " |\n" + "| " + this.matrix[3][0] + " " + this.matrix[3][1] + " " + this.matrix[3][2] + " " + this.matrix[3][3] + " |";
    }
970777
def pretty_str(p, decimal_places=2, print_zero=True, label_columns=False):
    ''''''
    if len(p.shape) == 1:
        return vector_str(p, decimal_places, print_zero)
    if len(p.shape) == 2:
        return matrix_str(p, decimal_places, print_zero, label_columns)
    raise Exception('Invalid array with shape {0}'.format(p.shape))
341335
function Mat33(a, b, c) {
  if (typeof a === 'object' && a !== null) {
    this.ex = Vec3.clone(a);
    this.ey = Vec3.clone(b);
    this.ez = Vec3.clone(c);
  } else {
    this.ex = Vec3();
    this.ey = Vec3();
    this.ez = Vec3();
  }
}
500618
function svdJs() {
                var A = this;
                var V = Matrix$b.I(A.rows());
                var S = A.transpose();
                var U = Matrix$b.I(A.cols());
                var err = Number.MAX_VALUE;
                var i = 0;
                var maxLoop = 100;

                while(err > 2.2737e-13 && i < maxLoop) {
                    var qr = S.transpose().qrJs();
                    S = qr.R;
                    V = V.x(qr.Q);
                    qr = S.transpose().qrJs();
                    U = U.x(qr.Q);
                    S = qr.R;

                    var e = S.triu(1).unroll().norm();
                    var f = S.diagonal().norm();

                    if(f == 0)
                        f = 1;

                    err = e / f;

                    i++;
                }

                var ss = S.diagonal();
                var s = [];

                for(var i = 1; i <= ss.cols(); i++) {
                    var ssn = ss.e(i);
                    s.push(Math.abs(ssn));

                    if(ssn < 0) {
                        for(var j = 0; j < U.rows(); j++) {
                            V.elements[j][i - 1] = -(V.elements[j][i - 1]);
                        }
                    }
                }

                return {U: U, S: $V(s).toDiagonalMatrix(), V: V};
            }
1107683
private String getHalfMatrixString(Permutation permutation) {
        StringBuilder builder = new StringBuilder(permutation.size());
        int size = permutation.size();
        for (int indexI = 0; indexI < size - 1; indexI++) {
            for (int indexJ = indexI + 1; indexJ < size; indexJ++) {
                builder.append(getConnectivity(permutation.get(indexI), permutation.get(indexJ)));
            }
        }
        return builder.toString();
    }
356918
function() {
            	var matrix_rows = [];
            	var n = this.elements.length;
            	for (var i = 0; i < n; i++) {
            	    matrix_rows.push($V(this.elements[i]).inspect());
            	}
            	return matrix_rows.join('\n');
                }
1285700
def matrix(
        m, n, lst,
        m_text: list=None,
        n_text: list=None):
    

    fmt = ""
    if n_text:
        fmt += "     {}\n".format(" ".join(n_text))
    for i in range(1, m+1):
        if m_text:
            fmt += "{:<4.4} ".format(m_text[i-1])
        fmt += "|"
        for j in range(1, n+1):
            if (i, j) in lst:
                fmt += "x|"
            else:
                fmt += " |"
        fmt += "\n"
    return fmt
1209275
function getMatrix(data) {
    var matrix = init(data.version);
    fillFinders(matrix);
    fillAlignAndTiming(matrix);
    fillStub(matrix);

    var penalty = Infinity;
    var bestMask = 0;
    for (var mask = 0; mask < 8; mask++) {
        fillData(matrix, data, mask);
        fillReserved(matrix, data.ec_level, mask);
        var p = calculatePenalty(matrix);
        if (p < penalty) {
            penalty = p;
            bestMask = mask;
        }
    }

    fillData(matrix, data, bestMask);
    fillReserved(matrix, data.ec_level, bestMask);

    return matrix.map(function(row) {
        return row.map(function(cell) {
            return cell & 1;
        });
    });
}
953644
function amf3Encode(a) {
    var buf = new Buffer(0);
    a.forEach(function (o) {
        buf = Buffer.concat([buf, amf3EncodeOne(o)]);
    });
    return buf;
}
1000743
def imag(self):
        """"""
        return matrix(self.tt.imag(), n=self.n, m=self.m)