Example usage for org.apache.mahout.math.function Functions IDENTITY

List of usage examples for org.apache.mahout.math.function Functions IDENTITY

Introduction

In this page you can find the example usage for org.apache.mahout.math.function Functions IDENTITY.

Prototype

DoubleFunction IDENTITY

To view the source code for org.apache.mahout.math.function Functions IDENTITY.

Click Source Link

Document

Function that returns its argument.

Usage

From source file:org.carrot2.matrix.MatrixUtils.java

License:Open Source License

/**
 * Finds the first minimum element in each column of matrix A. When calculating
 * minimum values for each column this version should perform better than scanning
 * each column separately.//from w w  w  .j  a  v a2  s. co  m
 * 
 * @param indices an array of <code>A.columns()</code> integers in which indices of
 *            the first minimum element will be stored. If this parameter is
 *            <code>null</code> a new array will be allocated.
 * @param minValues an array of <code>A.columns()</code> doubles in which values of
 *            each column's minimum elements will be stored. If this parameter is
 *            <code>null</code> a new array will be allocated.
 * @return for each column of A the index of the minimum element
 */
public static int[] minInColumns(DoubleMatrix2D A, int[] indices, double[] minValues) {
    return inColumns(A, indices, minValues, DoubleComparators.REVERSED_ORDER, Functions.IDENTITY);
}

From source file:org.carrot2.matrix.MatrixUtils.java

License:Open Source License

/**
 * Finds the first maximum element in each column of matrix A. When calculating
 * maximum values for each column this version should perform better than scanning
 * each column separately.//from   w  ww .  j a  va 2  s . c  om
 * 
 * @param A
 * @param indices an array of <code>A.columns()</code> integers in which indices of
 *            the first maximum element will be stored. If this parameter is
 *            <code>null</code> a new array will be allocated.
 * @param maxValues an array of <code>A.columns()</code> doubles in which values of
 *            each column's maximum elements will be stored. If this parameter is
 *            <code>null</code> a new array will be 
 *            allocated.
 * @return for each column of A the index of the maximum element
 */
public static int[] maxInColumns(DoubleMatrix2D A, int[] indices, double[] maxValues) {
    return maxInColumns(A, indices, maxValues, Functions.IDENTITY);
}