Multiply a matrix by one column.
515302
def multiply(a, col):
    """"""
    a = a.reshape(4, 4, 4)
    col = col.reshape(4, 8)
    return fcat(
        rowxcol(a[0], col),
        rowxcol(a[1], col),
        rowxcol(a[2], col),
        rowxcol(a[3], col),
    )
796806
public static void divRow(Matrix A, int i, double c)
    {
        divRow(A, i, 0, A.cols(), c);
    }
1064542
function(mtx) {
            mtx = (mtx instanceof Matrix) ? mtx.mtx : mtx;
            return new Matrix(this.mtx && this.mtx.multiply(mtx));
        }
852039
def calculate_columns(self):
        """"""

        self.cols = int(math.ceil(len(self.elements) / float(self.rows)))
57888
public Frame mult(Frame y) {
    int xrows = (int)_x.numRows();
    int xcols =      _x.numCols();
    int yrows = (int) y.numRows();
    int ycols =       y.numCols();
    if(xcols != yrows)
      throw new IllegalArgumentException("Matrices are not compatible for multiplication: ["+xrows+"x"+xcols+"] * ["+yrows+"x"+ycols+"]. Requires [n x m] * [m x p]");

    Vec[] x_vecs = _x.vecs();
    Vec[] y_vecs =  y.vecs();
    for(int k = 0; k < xcols; k++) {
      if(x_vecs[k].isEnum())
        throw new IllegalArgumentException("Multiplication not meaningful for factor column "+k);
    }
    for(int j = 0; j < ycols; j++) {
      if(y_vecs[j].isEnum())
        throw new IllegalArgumentException("Multiplication not meaningful for factor column "+j);
    }

    Vec[] output = new Vec[ycols];
    for(int j = 0; j < ycols; j++)
      output[j] = Vec.makeSeq(xrows);

    for(int i = 0; i < xrows; i++) {
      for(int j = 0; j < ycols; j++) {
        Vec yvec = y_vecs[j];
        double d = 0;
        for(int k = 0; k < xcols; k++)
          d += x_vecs[k].at(i) * yvec.at(k);
        output[j].set(i, d);
      }
    }
    return new Frame(y._names,output);
  }
63714
public static void multLowerTranB( DMatrixRMaj mat ) {
        int m = mat.numCols;
        double[] L = mat.data;
        for( int i = 0; i < m; i++ ) {
            for( int j = m-1; j >= i; j-- ) {
                double val = 0;
                for( int k = 0; k <= i; k++ ) {
                    val += L[ i*m + k] * L[ j*m + k ];
                }
                L[ i*m + j ] = val;
            }
        }
        // copy the results into the lower portion
        for( int i = 0; i < m; i++ ) {
            for (int j = 0; j < i; j++) {
                L[i*m+j] = L[j*m+i];
            }
        }
    }
582198
def +(matrix)
    result = @v
    if have_the_same_dimensions matrix
      @lines.times do |x|
        @columns.times do |y|
          result[x][y] += matrix.v[x][y]
        end
      end
    elsif matrix.is_a?Numeric
      @lines.times do |x|
        @columns.times do |y|
          result[x][y] += matrix
        end
      end
    else
      Error.call "Matrix::+ : Impossible de calculer cela", Error::ERR_HIGH
    end
    Matrix.new result
  end
73307
public static void addCol(Matrix A, int j, double c)
    {
        addCol(A, j, 0, A.rows(), c);
    }
646285
def matrix_multiply(m0, m1):
    new_matrix = numpy.zeros((m0.shape[0],m1.shape[1]))
    ""
    for i in xrange(m0.shape[0]):
        for j in xrange(m1.shape[1]):
            r=0
            for k in xrange(m1.shape[0]):
                r += m0[i,k]*m1[k,j]
            new_matrix[i,j]=r
    return new_matrix
1087512
public static DMatrixRMaj[] splitIntoVectors(DMatrix1Row A , boolean column )
    {
        int w = column ? A.numCols : A.numRows;

        int M = column ? A.numRows : 1;
        int N = column ? 1 : A.numCols;

        int o = Math.max(M,N);

        DMatrixRMaj[] ret  = new DMatrixRMaj[w];

        for( int i = 0; i < w; i++ ) {
            DMatrixRMaj a = new DMatrixRMaj(M,N);

            if( column )
                subvector(A,0,i,o,false,0,a);
            else
                subvector(A,i,0,o,true,0,a);

            ret[i] = a;
        }

        return ret;
    }
471485
def multiply(self, other):
        
        res = Matrix()
        cairo.cairo_matrix_multiply(
            res._pointer, self._pointer, other._pointer)
        return res
416371
def aandb(a, b):
    """"""
    return matrix(np.logical_and(a, b).astype('float'), a.size)
182717
public ColumnVector multiply(ColumnVector cv)
        throws MatrixException
    {
        // Validate cv's size.
        if (nRows != cv.nRows) {
            throw new MatrixException(
                                MatrixException.INVALID_DIMENSIONS);
        }

        double pv[] = new double[nRows];   // product values

        // Compute the values of the product.
        for (int r = 0; r < nRows; ++r) {
            double dot = 0;
            for (int c = 0; c < nCols; ++c) {
                dot += values[r][c] * cv.values[c][0];
            }
            pv[r] = dot;
        }

        return new ColumnVector(pv);
    }
827776
def aorb(a, b):
    """"""
    return matrix(np.logical_or(a, b).astype('float'), a.size)
73970
public void sub(IMatrix b, IMatrix result) {
        if ((b == null) || (rows != b.rows) || (columns != b.columns)) return;

        if ((result.rows != rows) || (result.columns != columns)) result.reshape(rows, columns);

        int i, j;
        for (i = 0; i < rows; i++)
            for (j = 0; j < columns; j++) {
                result.realmatrix[i][j] = realmatrix[i][j] - b.realmatrix[i][j];
                result.imagmatrix[i][j] = imagmatrix[i][j] - b.imagmatrix[i][j];
            }
    }
404270
def cast(keys, data):
        """"""
        matrix = Matrix()
        matrix.keys = keys
        matrix.data = data
        return matrix
456285
protected double multiply(double[][] mat, double[] in, double[] out) {
    double l = 0.;
    // Matrix multiplication:
    for(int d1 = 0; d1 < in.length; d1++) {
      final double[] row = mat[d1];
      double t = 0.;
      for(int d2 = 0; d2 < in.length; d2++) {
        t += row[d2] * in[d2];
      }
      out[d1] = t;
      l += t * t;
    }
    return l > 0 ? FastMath.sqrt(l) : 0.;
  }