Builds a new matrix by applying given {@code function} to each element of specified
column in this matrix.

@param j the column index
@param function the vector function

@return the transformed matrix
778694
public Matrix transformColumn(int j, VectorFunction function) {
        Matrix result = copy();
        VectorIterator it = result.iteratorOfColumn(j);

        while (it.hasNext()) {
            double x = it.next();
            int i = it.index();
            it.set(function.evaluate(i, x));
        }

        return result;
    }
278384
public static ReqlFunction1 buildFunction(final String colName, final Object obj, final String identifier)
    {
        return new ReqlFunction1()
        {

            @Override
            public Object apply(ReqlExpr row)
            {

                switch (identifier)
                {

                case "<":
                    return row.g(colName).lt(obj);

                case "<=":
                    return row.g(colName).le(obj);

                case ">":
                    return row.g(colName).gt(obj);
                case ">=":
                    return row.g(colName).ge(obj);

                case "=":
                    return row.g(colName).eq(obj);

                default:
                    logger.error("Operation not supported");
                    throw new KunderaException("Operation not supported");

                }
            }
        };
    }
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)])
934361
public static <R, C, V> Function<Table.Cell<R, C, V>, C> toColumnKeyFunction() {
    return new Function<Table.Cell<R, C, V>, C>() {
      @Override
      public C apply(final Table.Cell<R, C, V> input) {
        return input.getColumnKey();
      }
    };
  }
128684
function(fn) {
            	var elements = [];
            	this.each(function(x, i) {
            	    elements.push(fn(x, i));
            	});
            	return Vector.create(elements);
                }
1128948
public final <R> R map(Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> function) {
        return function.apply(v1, v2, v3, v4, v5);
    }
325179
function makeMatrix(n, m, x) {
  var matrix = [];
  for (var i = 0; i < n; i++) {
    matrix[i] = new Array(m);
    for (var j = 0; j < m; j++) {
      matrix[i][j] = x;
    }
  }

  return matrix;
}
764368
@Override
	public BarrierFunction createPhase1BarrierFunction(){
		List<double[][]> FiPh1MatrixList = new ArrayList<double[][]>();
		for(int i=0; i<this.Fi.length; i++){
			FiPh1MatrixList.add(FiPh1MatrixList.size(), this.Fi[i].getData());
		}
		FiPh1MatrixList.add(FiPh1MatrixList.size(), MatrixUtils.createRealIdentityMatrix(p).scalarMultiply(-1).getData());
		return new SDPLogarithmicBarrier(FiPh1MatrixList, this.G.getData());
	}
827711
public <T1, R> Function<T1, R>  function(Class<? extends Function<T1, R>> springBeanClass) {
        return new SpringFunction<>(springConfigurationClass, springBeanClass);
    }
1302699
public Matrix getMatrix(int[] r, int j0, int j1)
    {
        Matrix X = new Matrix(r.length, j1 - j0 + 1);
        double[][] B = X.getArray();
        try
        {
            for (int i = 0; i < r.length; i++)
            {
                for (int j = j0; j <= j1; j++)
                {
                    B[i][j - j0] = A[r[i]][j];
                }
            }
        }
        catch (ArrayIndexOutOfBoundsException e)
        {
            throw new ArrayIndexOutOfBoundsException("Submatrix indices");
        }
        return X;
    }
270641
function(fn) {
    var els = [], ni = this.elements.length, ki = ni, i, nj, kj = this.elements[0].length, j;
    do { i = ki - ni;
      nj = kj;
      els[i] = [];
      do { j = kj - nj;
        els[i][j] = fn(this.elements[i][j], i + 1, j + 1);
      } while (--nj);
    } while (--ni);
    return Matrix.create(els);
  }
582142
public Vector transform(VectorFunction function) {
        VectorIterator it = iterator();
        Vector result = blank();

        while (it.hasNext()) {
            double x = it.next();
            int i = it.index();
            result.set(i, function.evaluate(i, x));
        }

        return result;
    }
4857
public static MatrixFunction asConstFunction(final double arg) {
        return new MatrixFunction() {
            @Override
            public double evaluate(int i, int j, double value) {
                return arg;
            }
        };
    }
700412
public Matrix transformRow(int i, VectorFunction function) {
        Matrix result = copy();
        VectorIterator it = result.iteratorOfRow(i);

        while (it.hasNext()) {
            double x = it.next();
            int j = it.index();
            it.set(function.evaluate(j, x));
        }

        return result;
    }
905396
public static <T> TypedColumn<T, Double> avg(MapFunction<T, Double> f) {
    return new TypedAverage<T>(f).toColumnJava();
  }
843050
function(source, dimension) {
    // create the matrix
    var mat = {}
    // if dimension is an integer, the matrix is square
    if (_.isFunction(source)
        && _.isInteger(dimension) && dimension >= 0) {
          dimension = { x:dimension, y:dimension }
    }

    // source can be a 2-var predicate function or a line based matrix
    if (_.isFunction(source)
        && dimension
        && _.isInteger(dimension.x) && dimension.x >= 0
        && _.isInteger(dimension.y) && dimension.y >= 0) {
          // creating the matrix
          mat.x = dimension.x
          mat.y = dimension.y
          mat.data = []
          // populate
          for (var i = 0; i < mat.x; i++) {
            mat.data.push([])
            for (var j = 0; j < mat.y; j++) {
              if (source(i, j)) {
                mat.data[i].push(j)
              }
            }
          }
    } else if (_.isArray(source) && source[0] && _.isArray(source[0])) {
      // creating the matrix
      mat.x = source.length
      mat.y = source[0].length
      mat.data = []
      // populate
      for (var i = 0; i < mat.x; i++) {
        mat.data.push([])
        for (var j = 0; j < mat.y; j++) {
          if (source[i][j]) {
            mat.data[i].push(j)
          }
        }
      }
    }
    // return the matrix
    return mat
  }
205470
function transform(m) {
    // Identity matrix.
    if (m === undefined) {
        m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    } else {
        m = m.slice();
    }

    // Performs the 3x3 matrix multiplication of the current matrix with the input matrix a.
    function _mmult(a, m) {
        m = m.slice();

        var m0 = m[0];
        var m1 = m[1];
        var m2 = m[2];
        var m3 = m[3];
        var m4 = m[4];
        var m5 = m[5];
        var m6 = m[6];
        var m7 = m[7];
        var m8 = m[8];

        m[0] = a[0] * m0 + a[1] * m3;
        m[1] = a[0] * m1 + a[1] * m4;
        m[3] = a[3] * m0 + a[4] * m3;
        m[4] = a[3] * m1 + a[4] * m4;
        m[6] = a[6] * m0 + a[7] * m3 + m6;
        m[7] = a[6] * m1 + a[7] * m4 + m7;

        return transform(m);
    }

    return {
        matrix: function () {
            return m.slice();
        },

        clone: function () {
            return transform(m);
        },

        prepend: function (t) {
            if (t.matrix) {
                t = t.matrix();
            }
            return _mmult(m, t);
        },

        append: function (t) {
            if (t.matrix) {
                t = t.matrix();
            }
            return _mmult(t, m);
        },

        translate: function (x, y) {
            return _mmult([1, 0, 0, 0, 1, 0, x, y, 1], m);
        },

        scale: function (x, y) {
            if (y === undefined) {
                y = x;
            }
            return _mmult([x, 0, 0, 0, y, 0, 0, 0, 1], m);
        },

        skew: function (x, y) {
            if (y === undefined) {
                y = x;
            }
            var kx = Math.PI * x / 180.0;
            var ky = Math.PI * y / 180.0;
            return _mmult([1, Math.tan(ky), 0, -Math.tan(kx), 1, 0, 0, 0, 1], m);
        },

        rotate: function (angle) {
            var c = Math.cos(radians(angle));
            var s = Math.sin(radians(angle));
            return _mmult([c, s, 0, -s, c, 0, 0, 0, 1], m);
        },

        transformPoint: function (point) {
            var x = point.x;
            var y = point.y;
            return {x: x * m[0] + y * m[3] + m[6],
                y: x * m[1] + y * m[4] + m[7]};
        }
    };
}