Documentation of 'jdistlib.util.Utilities' Java class
Utilities
jdistlib.util

Class Utilities



  • public class Utilities
    extends java.lang.Object
    Utility functions to mimic R
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  Utilities.RankTies 
    • Constructor Summary

      Constructors 
      Constructor and Description
      Utilities() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean any(boolean... x) 
      static boolean anyNA(double... x) 
      static double[] c(double... x) 
      static double[] c(double[]... x) 
      static int[] c(int... x) 
      static int[] c(int[]... x) 
      static double[] colon(double from, double to) 
      static int[] colon(int from, int to) 
      static double[] index_min1(double[] x, int[] idx)
      Mimic x[idx] behavior of R
      static double[] index(double[] x, int[] idx)
      Mimic x[idx] behavior of R
      static boolean[] is_duplicated(double[] e) 
      static <S> boolean[] is_duplicated(S[] e) 
      static int[] match(double[] x, double[] y)
      Mimic the behavior of match function in R.
      static int[] match(int[] x, int[] y) 
      static <S> int[] match(S[] x, S[] y) 
      static int[] order(double[] e)
      Returns the order of the elements of array e
      static void permute(double[] e)
      Permute the array e
      static void permute(double[] e, RandomEngine random)
      Permute the array e
      static void print(double... val) 
      static void print(java.lang.String format, double... val) 
      static double[] rank(double[] e)
      Returns the ranks of the elements of array e, resolve ties by averaging
      static double[] rank(double[] e, Utilities.RankTies ties)
      Returns the ranks of the elements of array e.
      static double[] rec(double[] e) 
      static double[] rep_each(double[] v, int n) 
      static int[] rep_each(int[] v, int n) 
      static double[] rep(double[] v, int n) 
      static double[] rep(double v, int n) 
      static double[] rev(double[] e) 
      static double[][] rle(double[] e)
      Compute RLE
      static double[] sample_int(int n, int s)
      Sample from 1 to n, with size s, without replacement---with default random engine
      static double[] sample_int(int n, int s, RandomEngine random)
      Sample from 1 to n, with size s, without replacement
      static int[] seq_along(double[] z) 
      static double[] seq_int(double from, double to, int length_out) 
      static double[] seq(double from, double to, double by) 
      static int[] seq(int from, int to, int by) 
      static void sort(double[] data)
      Sort data using radix sort
      static void sort(double[] data, int[] idx)
      Sort using radix sort
      static <T> void sort(double[] data, T[] obj)
      Sort using radix sort
      static void sort(int[] a)
      Radix sort
      static void sort(int[] data, int[] idx) 
      static <T> void sort(int[] data, T[] idx) 
      static void sort(long[] a)
      Radix sort
      static void sort(long[] data, int[] idx) 
      static <T> void sort(long[] data, T[] idx) 
      static int[] tabulate(int[] x, int n)
      Mimic the tabulate function in R
      static double[] to_double_array(java.util.Collection<java.lang.Double> s) 
      static double[] to_double(int[] e)
      Converts the integer array e into a double array
      static int[] to_int_array(java.util.Collection<java.lang.Integer> s) 
      static double[] unique(double[] e) 
      static <S> S[] unique(S[] e) 
      static int[] which(boolean[] e) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utilities

        public Utilities()
    • Method Detail

      • colon

        public static final int[] colon(int from,
                                        int to)
      • colon

        public static final double[] colon(double from,
                                           double to)
      • seq

        public static final int[] seq(int from,
                                      int to,
                                      int by)
      • seq_int

        public static final double[] seq_int(double from,
                                             double to,
                                             int length_out)
      • seq

        public static final double[] seq(double from,
                                         double to,
                                         double by)
      • c

        public static final int[] c(int[]... x)
      • c

        public static final int[] c(int... x)
      • c

        public static final double[] c(double[]... x)
      • c

        public static final double[] c(double... x)
      • rep

        public static final double[] rep(double v,
                                         int n)
      • rep

        public static final double[] rep(double[] v,
                                         int n)
      • rep_each

        public static final double[] rep_each(double[] v,
                                              int n)
      • rep_each

        public static final int[] rep_each(int[] v,
                                           int n)
      • rec

        public static final double[] rec(double[] e)
      • rev

        public static final double[] rev(double[] e)
      • print

        public static final void print(double... val)
      • print

        public static final void print(java.lang.String format,
                                       double... val)
      • sort

        public static final void sort(double[] data)
        Sort data using radix sort
        Parameters:
        data -
      • sort

        public static final void sort(double[] data,
                                      int[] idx)
        Sort using radix sort
        Parameters:
        data -
        idx - an index of data, of the same length, useful to sort an entire table
      • sort

        public static final <T> void sort(double[] data,
                                          T[] obj)
        Sort using radix sort
        Parameters:
        data -
        obj - an auxiliary array of objects
      • sort

        public static final void sort(int[] a)
        Radix sort
        Parameters:
        a -
      • sort

        public static final void sort(int[] data,
                                      int[] idx)
      • sort

        public static final <T> void sort(int[] data,
                                          T[] idx)
      • sort

        public static final void sort(long[] a)
        Radix sort
        Parameters:
        a -
      • sort

        public static final void sort(long[] data,
                                      int[] idx)
      • sort

        public static final <T> void sort(long[] data,
                                          T[] idx)
      • to_double

        public static final double[] to_double(int[] e)
        Converts the integer array e into a double array
        Parameters:
        e -
        Returns:
        a double array
      • order

        public static final int[] order(double[] e)
        Returns the order of the elements of array e
        Parameters:
        e -
      • rank

        public static final double[] rank(double[] e)
        Returns the ranks of the elements of array e, resolve ties by averaging
        Parameters:
        e -
      • rank

        public static final double[] rank(double[] e,
                                          Utilities.RankTies ties)
        Returns the ranks of the elements of array e.
        Parameters:
        e -
        ties - Ties resolution: Average, Min, or Max
        Returns:
        NOTE: Rank is index 1-based!
      • permute

        public static final void permute(double[] e)
        Permute the array e
        Parameters:
        e -
      • permute

        public static final void permute(double[] e,
                                         RandomEngine random)
        Permute the array e
        Parameters:
        e -
        random -
      • sample_int

        public static final double[] sample_int(int n,
                                                int s)
        Sample from 1 to n, with size s, without replacement---with default random engine
        Parameters:
        n -
        s -
        Returns:
        a sampled array of size s
      • sample_int

        public static final double[] sample_int(int n,
                                                int s,
                                                RandomEngine random)
        Sample from 1 to n, with size s, without replacement
        Parameters:
        n -
        s -
        random - random engine
        Returns:
        a sampled array of size s
      • unique

        public static final double[] unique(double[] e)
      • unique

        public static final <S> S[] unique(S[] e)
      • is_duplicated

        public static final boolean[] is_duplicated(double[] e)
      • is_duplicated

        public static final <S> boolean[] is_duplicated(S[] e)
      • which

        public static final int[] which(boolean[] e)
      • rle

        public static final double[][] rle(double[] e)
        Compute RLE
        Parameters:
        e -
        Returns:
        Double dimension array of 2 x e.length. The first contains the values. The second contains the lengths.
      • match

        public static final int[] match(double[] x,
                                        double[] y)
        Mimic the behavior of match function in R.
        Parameters:
        x -
        y -
        Returns:
        match index
      • match

        public static final int[] match(int[] x,
                                        int[] y)
      • match

        public static final <S> int[] match(S[] x,
                                            S[] y)
      • tabulate

        public static final int[] tabulate(int[] x,
                                           int n)
        Mimic the tabulate function in R
        Parameters:
        x -
        n -
        Returns:
        tabulate
      • seq_along

        public static final int[] seq_along(double[] z)
      • index

        public static final double[] index(double[] x,
                                           int[] idx)
        Mimic x[idx] behavior of R
        Parameters:
        x -
        idx -
        Returns:
        array
      • index_min1

        public static final double[] index_min1(double[] x,
                                                int[] idx)
        Mimic x[idx] behavior of R
        Parameters:
        x -
        idx -
        Returns:
        array
      • to_int_array

        public static final int[] to_int_array(java.util.Collection<java.lang.Integer> s)
      • to_double_array

        public static final double[] to_double_array(java.util.Collection<java.lang.Double> s)
      • any

        public static final boolean any(boolean... x)
      • anyNA

        public static final boolean anyNA(double... x)

DMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.