A 3-by-3 matrix. Stored in column-major order.
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();
  }
}
347553
function makeMatrix(columns, rows) {
  let matrix = [];
  for (let i = 0; i < columns; i++) {
    let column = [];
    for (let j = 0; j < rows; j++) {
      column.push(0);
    }
    matrix.push(column);
  }
  return matrix;
}
880616
def transpose(self):
        """"""
        ma4 = Matrix4(self.get_col(0),
                      self.get_col(1),
                      self.get_col(2),
                      self.get_col(3))
        return ma4
139809
public static double dotInnerColumns( DMatrixSparseCSC A , int colA , DMatrixSparseCSC B , int colB ,
                                          IGrowArray gw , DGrowArray gx)
    {
        if( A.numRows != B.numRows )
            throw new IllegalArgumentException("Number of rows must match.");

        int w[] = adjust(gw,A.numRows);
        Arrays.fill(w,0,A.numRows,-1);
        double x[] = adjust(gx,A.numRows);

        int length = 0;

        int idx0 = A.col_idx[colA];
        int idx1 = A.col_idx[colA+1];
        for (int i = idx0; i < idx1; i++) {
            int row = A.nz_rows[i];
            x[length] = A.nz_values[i];
            w[row] = length++;
        }

        double dot = 0;

        idx0 = B.col_idx[colB];
        idx1 = B.col_idx[colB+1];
        for (int i = idx0; i < idx1; i++) {
            int row = B.nz_rows[i];
            if( w[row] != -1 ) {
                dot += x[w[row]]*B.nz_values[i];
            }
        }

        return dot;
    }
1200683
public void reshape(int newrows, int newcolumns) {
        if (((newrows == rows) && (newcolumns == columns)) || (newrows <= 0) || (newcolumns <= 0)) return;

        double[][] newrealmatrix = new double[newrows][newcolumns];
        double[][] newimagmatrix = new double[newrows][newcolumns];
        int minrows = Math.min(rows, newrows);
        int mincolumns = Math.min(columns, newcolumns);
        int i, j;
        for (i = 0; i < minrows; i++)
            for (j = 0; j < mincolumns; j++) {
                newrealmatrix[i][j] = realmatrix[i][j];
                newimagmatrix[i][j] = imagmatrix[i][j];
            }

        for (i = minrows; i < newrows; i++)
            for (j = 0; j < mincolumns; j++) {
                newrealmatrix[i][j] = 0d;
                newimagmatrix[i][j] = 0d;
            }

        for (i = 0; i < minrows; i++)
            for (j = mincolumns; j < newcolumns; j++) {
                newrealmatrix[i][j] = 0d;
                newimagmatrix[i][j] = 0d;
            }

        for (i = minrows; i < newrows; i++)
            for (j = mincolumns; j < newcolumns; j++) {
                newrealmatrix[i][j] = 0d;
                newimagmatrix[i][j] = 0d;
            }

        realmatrix = newrealmatrix;
        imagmatrix = newimagmatrix;
        rows = newrows;
        columns = newcolumns;
    }
728440
def Tmatrix(X):
    
    T = [[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]
    for row in X:
        for k in range(3):
            for l in range(3):
                T[k][l] += row[k] * row[l]
    return T
1343439
def _dcm_array_to_matrix3(self, dcm):
        
        assert(dcm.shape == (3, 3))
        a = Vector3(dcm[0][0], dcm[0][1], dcm[0][2])
        b = Vector3(dcm[1][0], dcm[1][1], dcm[1][2])
        c = Vector3(dcm[2][0], dcm[2][1], dcm[2][2])
        return Matrix3(a, b, c)
670637
def matrix_coords(rows, cols, rowh, colw, ox=0, oy=0):
    ""
    for i, f, c in rowmajor(rows, cols):
        x = ox + c * colw
        y = oy + f * rowh
        x1 = x + colw
        y1 = y + rowh
        yield (i, x, y, x1, y1)
231979
def flatten(self):
        
        blocksize = self.get_array()[0][0].get_width()
        width = self.get_width() * blocksize

        columnsNew = [[] for dummy in xrange(width)]

        for row in self.get_array():
            index = 0
            for submatrix in row:
                for column in submatrix.get_array(False):
                    columnsNew[index] += column
                    index += 1

        columnsFlat = sum(columnsNew, [])
        return Matrix(width, len(columnsNew[0]), columnsFlat, rowBased=False)
842881
public static DMatrix3 extractRow( DMatrix3x3 a , int row , DMatrix3 out ) {
        if( out == null) out = new DMatrix3();
        switch( row ) {
            case 0:
                out.a1 = a.a11;
                out.a2 = a.a12;
                out.a3 = a.a13;
            break;
            case 1:
                out.a1 = a.a21;
                out.a2 = a.a22;
                out.a3 = a.a23;
            break;
            case 2:
                out.a1 = a.a31;
                out.a2 = a.a32;
                out.a3 = a.a33;
            break;
            default:
                throw new IllegalArgumentException("Out of bounds row.  row = "+row);
        }
        return out;
    }
1000330
def dilate( n = 3 )
      filter = Hornetseye::lazy( *( [ n ] * dimension ) ) { 0 }
      table( filter ) { |a,b| a }.diagonal { |m,x| m.major x }
    end
4242
def column_vectors(self):
        """"""
        a, b, c, d, e, f, _, _, _ = self
        return (a, d), (b, e), (c, f)
115679
function Matrix(m) {
  m = m || [1, 0, 0, 1, 0, 0];
  this.m = [m[0], m[1], m[2], m[3], m[4], m[5]];
}
1145792
public static void multRow(Matrix A, int i, double c)
    {
        multRow(A, i, 0, A.cols(), c);
    }
416371
def aandb(a, b):
    """"""
    return matrix(np.logical_and(a, b).astype('float'), a.size)
1216686
function transpose(matrix) {
                var resultMatrix = new Array(matrix[0].length);
                for (var i = 0; i < resultMatrix.length; ++i) {
                    resultMatrix[i] = new Array(matrix.length);
                }

                for (i = 0; i < matrix.length; ++i) {
                    for (var j = 0; j < matrix[0].length; ++j) {
                        resultMatrix[j][i] = matrix[i][j];
                    }
                }

                return resultMatrix;
            }
913905
def matrix(self):
        """"""
        result = np.identity(4, float)
        result[0:3, 0:3] = self.r
        return result