Package linalg.util
Class LinAlgArrayUtils
java.lang.Object
linalg.util.LinAlgArrayUtils
Contains some utility functions to manipulate arrays.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CNumber[]static booleancontains(int[] arr, int value)static CNumber[][]extend2D(double[] arr, int axis)Extends a 1D array to 2D along a specified axis.static CNumber[][]extend2D(int[] arr, int axis)Extends a 1D array to 2D along a specified axis.static CNumber[][]Extends a 1D array to 2D along a specified axis.static CNumber[]static Stringstatic CNumber[][]getSection(CNumber[][] data, int rowStart, int rowEnd, int colStart, int colEnd)static CNumber[]static CNumberComputes norm of an array as if it was a vector.static voidstatic voidstatic CNumber[][]randn(int rows, int cols, boolean complex)static CNumber[][]random(int rows, int cols)static CNumber[][]random(int rows, int cols, double mag)static CNumber[][]random(int rows, int cols, double min, double max, boolean... magnitude_flag)static CNumber[][]randomComplex(int rows, int cols)static CNumber[][]zeros(int rows, int cols)
-
Method Details
-
random
public static CNumber[][] random(int rows, int cols, double min, double max, boolean... magnitude_flag) -
random
-
random
-
randomComplex
-
randn
-
printArr
-
printArr
-
getDims
-
zeros
-
abs
-
flatten
-
getSection
-
contains
public static boolean contains(int[] arr, int value) -
extend2D
Extends a 1D array to 2D along a specified axis.- Parameters:
arr- - array to extendaxis- - axis along which to extend.
If axis is 0 then a new dimension will be added along the rows and the entires of arr will become the column entries. This results in a1xarr.length2D array.
If axis is 1, then a new dimension will be added along the columns and the antries of arr will become the row entries. This results in aarr.lengthx12D array.- Returns:
- Array extended to 2D
-
extend2D
Extends a 1D array to 2D along a specified axis.- Parameters:
arr- - array to extendaxis- - axis along which to extend.
If axis is 0 then a new dimension will be added along the rows and the entires of arr will become the column entries. This results in a1xarr.length2D array.
If axis is 1, then a new dimension will be added along the columns and the antries of arr will become the row entries. This results in aarr.lengthx12D array.- Returns:
- Array extended to 2D
-
extend2D
Extends a 1D array to 2D along a specified axis.- Parameters:
arr- - array to extendaxis- - axis along which to extend.
If axis is 0 then a new dimension will be added along the rows and the entires of arr will become the column entries. This results in a1xarr.length2D array.
If axis is 1, then a new dimension will be added along the columns and the antries of arr will become the row entries. This results in aarr.lengthx12D array.- Returns:
- Array extended to 2D
-
norm
Computes norm of an array as if it was a vector.- Returns:
- Norm of array
-
group
-