Package org.jblas.util
Class Permutations
java.lang.Object
org.jblas.util.Permutations
Functions which generate random permutations.
- Author:
- Mikio L. Braun
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DoubleMatrix
permutationDoubleMatrixFromPivotIndices
(int size, int[] ipiv) Create a permutation matrix from a LAPACK-style 'ipiv' vector.static FloatMatrix
permutationFloatMatrixFromPivotIndices
(int size, int[] ipiv) Create a permutation matrix from a LAPACK-style 'ipiv' vector.static int[]
randomPermutation
(int size) Create a random permutation of the numbers 0, ..., size - 1.static int[]
randomSubset
(int k, int n) Get a random sample of k out of n elements.
-
Constructor Details
-
Permutations
public Permutations()
-
-
Method Details
-
randomPermutation
Create a random permutation of the numbers 0, ..., size - 1. see Algorithm P, D.E. Knuth: The Art of Computer Programming, Vol. 2, p. 145 -
randomSubset
Get a random sample of k out of n elements. See Algorithm S, D. E. Knuth, The Art of Computer Programming, Vol. 2, p.142. -
permutationDoubleMatrixFromPivotIndices
Create a permutation matrix from a LAPACK-style 'ipiv' vector.- Parameters:
ipiv
- row i was interchanged with row ipiv[i]
-
permutationFloatMatrixFromPivotIndices
Create a permutation matrix from a LAPACK-style 'ipiv' vector.- Parameters:
ipiv
- row i was interchanged with row ipiv[i]
-