Package org.la4j

Class Matrices


  • public final class Matrices
    extends java.lang.Object
    • Constructor Detail

      • Matrices

        public Matrices()
    • Method Detail

      • asConstFunction

        public static MatrixFunction asConstFunction​(double arg)
        Creates a const function that evaluates it's argument to given value.
        Parameters:
        arg - a const value
        Returns:
        a closure object that does _
      • asPlusFunction

        public static MatrixFunction asPlusFunction​(double arg)
        Creates a plus function that adds given value to it's argument.
        Parameters:
        arg - a value to be added to function's argument
        Returns:
        a closure object that does _ + _
      • asMinusFunction

        public static MatrixFunction asMinusFunction​(double arg)
        Creates a minus function that subtracts given value from it's argument.
        Parameters:
        arg - a value to be subtracted from function's argument
        Returns:
        a closure that does _ - _
      • asMulFunction

        public static MatrixFunction asMulFunction​(double arg)
        Creates a mul function that multiplies given value by it's argument.
        Parameters:
        arg - a value to be multiplied by function's argument
        Returns:
        a closure that does _ * _
      • asDivFunction

        public static MatrixFunction asDivFunction​(double arg)
        Creates a div function that divides it's argument by given value.
        Parameters:
        arg - a divisor value
        Returns:
        a closure that does _ / _
      • asModFunction

        public static MatrixFunction asModFunction​(double arg)
        Creates a mod function that calculates the modulus of it's argument and given value.
        Parameters:
        arg - a divisor value
        Returns:
        a closure that does _ % _
      • mkMinAccumulator

        public static MatrixAccumulator mkMinAccumulator()
        Makes a minimum matrix accumulator that accumulates the minimum of matrix elements.
        Returns:
        a minimum vector accumulator
      • mkMaxAccumulator

        public static MatrixAccumulator mkMaxAccumulator()
        Makes a maximum matrix accumulator that accumulates the maximum of matrix elements.
        Returns:
        a maximum vector accumulator
      • asSumAccumulator

        public static MatrixAccumulator asSumAccumulator​(double neutral)
        Creates a sum matrix accumulator that calculates the sum of all elements in the matrix.
        Parameters:
        neutral - the neutral value
        Returns:
        a sum accumulator
      • asProductAccumulator

        public static MatrixAccumulator asProductAccumulator​(double neutral)
        Creates a product matrix accumulator that calculates the product of all elements in the matrix.
        Parameters:
        neutral - the neutral value
        Returns:
        a product accumulator
      • asSumFunctionAccumulator

        public static MatrixAccumulator asSumFunctionAccumulator​(double neutral,
                                                                 MatrixFunction function)
        Creates a sum function accumulator, that calculates the sum of all elements in the matrix after applying given function to each of them.
        Parameters:
        neutral - the neutral value
        function - the matrix function
        Returns:
        a sum function accumulator
      • asProductFunctionAccumulator

        public static MatrixAccumulator asProductFunctionAccumulator​(double neutral,
                                                                     MatrixFunction function)
        Creates a product function accumulator, that calculates the product of all elements in the matrix after applying given function to each of them.
        Parameters:
        neutral - the neutral value
        function - the matrix function
        Returns:
        a product function accumulator
      • asAccumulatorProcedure

        public static MatrixProcedure asAccumulatorProcedure​(MatrixAccumulator accumulator)
        Creates an accumulator procedure that adapts a matrix accumulator for procedure interface. This is useful for reusing a single accumulator for multiple fold operations in multiple matrices.
        Parameters:
        accumulator - the matrix accumulator
        Returns:
        an accumulator procedure