Add tuples (val, row, col) to the Jacobian matrix ``m``

        Implemented in numpy.arrays for temporary storage.
350069
def add_jac(self, m, val, row, col):
        
        assert m in ('Fx', 'Fy', 'Gx', 'Gy', 'Fx0', 'Fy0', 'Gx0', 'Gy0'), \
            'Wrong Jacobian matrix name <{0}>'.format(m)

        if isinstance(val, (int, float)):
            val = val * ones(len(row), 1)

        self._temp[m]['I'] = matrix([self._temp[m]['I'], matrix(row)])
        self._temp[m]['J'] = matrix([self._temp[m]['J'], matrix(col)])
        self._temp[m]['V'] = matrix([self._temp[m]['V'], matrix(val)])
796322
public static void matrixFill(Object[][] matrix, Object val) {
        if (matrix != null) {
            for (int i = 0, n = matrix.length; i < n; i++) {
                if (matrix[i] != null) {
                    for (int j = 0, m = matrix[i].length; j < m; j++) {
                        matrix[i][j] = val;
                    }
                }
            }
        }
    }
786241
def mesh_axis_to_tensor_axis(self, mesh_ndims):
    
    ta2ma = self._tensor_axis_to_mesh_axis
    return tuple(
        [ta2ma.index(mesh_axis) if mesh_axis in ta2ma else None
         for mesh_axis in xrange(mesh_ndims)])
641217
def Jacobian_re_im(self, pars):
        
        """
        partials = []

        # partials.append(self.dre_dlog10rho0(pars)[:, np.newaxis, :])
        partials.append(self.dre_drho0(pars)[:, np.newaxis])
        partials.append(self.dre_dm(pars))
        # partials.append(self.dre_dlog10tau(pars))
        partials.append(self.dre_dtau(pars))
        partials.append(self.dre_dc(pars))
        # partials.append(self.dim_dlog10rho0(pars)[:, np.newaxis, :])
        partials.append(self.dim_drho0(pars)[:, np.newaxis])
        partials.append(self.dim_dm(pars))
        # partials.append(self.dim_dlog10tau(pars))
        partials.append(self.dim_dtau(pars))
        partials.append(self.dim_dc(pars))

        print('SHAPES')
        for x in partials:
            print(x.shape)

        J = np.concatenate(partials, axis=1)
        return J
1125824
public static void multRows(double[] values, DMatrixRMaj A) {
        if( values.length < A.numRows ) {
            throw new IllegalArgumentException("Not enough elements in values.");
        }

        int index = 0;
        for (int row = 0; row < A.numRows; row++) {
            double v = values[row];
            for (int col = 0; col < A.numCols; col++, index++) {
                A.data[index] *= v;
            }
        }
    }
224959
def as_pyemu_matrix(self,typ=Matrix):
        
        x = self.values.copy().astype(np.float)
        return typ(x=x,row_names=list(self.index),
                      col_names=list(self.columns))
1143022
def _init_matrix(self, data, index, columns, dtype=None):
        
        data = prep_ndarray(data, copy=False)
        index, columns = self._prep_index(data, index, columns)
        data = {idx: data[:, i] for i, idx in enumerate(columns)}
        return self._init_dict(data, index, columns, dtype)
422540
def to_dade_matrix(M, annotations="", filename=None):
    

    n, m = M.shape
    A = np.zeros((n + 1, m + 1))
    A[1:, 1:] = M
    if not annotations:
        annotations = np.array(["" for _ in n], dtype=str)
    A[0, :] = annotations
    A[:, 0] = annotations.T
    if filename:
        try:
            np.savetxt(filename, A, fmt='%i')
            print("I saved input matrix in dade format as " + str(filename))
        except ValueError as e:
            print("I couldn't save input matrix.")
            print(str(e))
        finally:
            return A

    return A
971577
protected void configure( DenseMatrix64F initParam , DenseMatrix64F X , DenseMatrix64F Y )
    {
        if( Y.getNumRows() != X.getNumRows() ) {
            throw new IllegalArgumentException("Different vector lengths");
        } else if( Y.getNumCols() != 1 /*|| X.getNumCols() != 1*/ ) {
            throw new IllegalArgumentException("Inputs must be a column vector");
        }

        int numParam = initParam.getNumElements();
        int numPoints = Y.getNumRows();

        if( param.getNumElements() != initParam.getNumElements() ) {
            // reshaping a matrix means that new memory is only declared when needed
            this.param.reshape(numParam,1, false);
            this.d.reshape(numParam,1, false);
            this.H.reshape(numParam,numParam, false);
            this.negDelta.reshape(numParam,1, false);
            this.tempParam.reshape(numParam,1, false);
            this.A.reshape(numParam,numParam, false);
        }

        param.set(initParam);

        // reshaping a matrix means that new memory is only declared when needed
        temp0.reshape(numPoints,1, false);
        temp1.reshape(numPoints,1, false);
        tempDH.reshape(numPoints,1, false);
        jacobian.reshape(numParam,numPoints, false);


    }
994844
private void addToJacobian(DMatrix tripplet, int col , double a[], double b[], DMatrixRMaj R ) {
		set(tripplet,jacRowX,col+0,a[0]*R.data[0] + a[1]*R.data[3] + a[2]*R.data[6]);
		set(tripplet,jacRowX,col+1,a[0]*R.data[1] + a[1]*R.data[4] + a[2]*R.data[7]);
		set(tripplet,jacRowX,col+2,a[0]*R.data[2] + a[1]*R.data[5] + a[2]*R.data[8]);

		set(tripplet,jacRowY,col+0,b[0]*R.data[0] + b[1]*R.data[3] + b[2]*R.data[6]);
		set(tripplet,jacRowY,col+1,b[0]*R.data[1] + b[1]*R.data[4] + b[2]*R.data[7]);
		set(tripplet,jacRowY,col+2,b[0]*R.data[2] + b[1]*R.data[5] + b[2]*R.data[8]);
	}
199133
public Matrix add(Matrix m) throws MatrixException
    {
        // Validate m's size.
        if ((nRows != m.nRows) && (nCols != m.nCols)) {
            throw new MatrixException(
                                MatrixException.INVALID_DIMENSIONS);
        }

        double sv[][] = new double[nRows][nCols]; // sum values

        // Compute values of the sum.
        for (int r = 0; r < nRows; ++r) {
            for (int c = 0; c < nCols; ++c) {
                sv[r][c] = values[r][c] + m.values[r][c];
            }
        }

        return new Matrix(sv);
    }
99352
def put(self, name, value):
        

        pm = ndarray_to_mxarray(self._libmx, value)

        self._libeng.engPutVariable(self._ep, name, pm)

        self._libmx.mxDestroyArray(pm)
733871
def __make_matrix(self, n, val):
        """"""
        matrix = []
        for i in range(n):
            matrix += [[val for j in range(n)]]
        return matrix
376786
def to_m(*attrs)
      m=Matrix.build(self.row_size, self.column_size){nil}
      self.each_with_index do |x, row, col|
        if attrs.size == 0 || attrs.nil?
          m[row, col] = x.value
        end
      end
      return m
    end
565436
def _build_matrix(p, q, deriv):
    """"""
    A = [([1 for _ in range(-p, q+1)])]
    for i in range(1, p + q + 1):
        A.append([j**i for j in range(-p, q+1)])
    return np.array(A)
968556
public static StatisticsMatrix wrap( DMatrixRMaj m ) {
        StatisticsMatrix ret = new StatisticsMatrix();
        ret.setMatrix( m );

        return ret;
    }
1210915
def _K(m):
    
    M = m*(m - 1)//2
    K = np.zeros((M, m**2), dtype=np.int64)
    row = 0
    for j in range(1, m):
        col = (j - 1)*m + j
        s = m - j
        K[row:(row+s), col:(col+s)] = np.eye(s)
        row += s
    return K