public class ArrayUtils
extends java.lang.Object
a[i][2 * j] = Re[i][j],
a[i][2 * j + 1] = Im[i][j]; 0 <= i < M, 0 <= j < N
Modifier and Type | Method and Description |
---|---|
static double[][] |
complexAmplitude(double[][] phase,
double amp)
Creates a complex array pointwise.
|
static double[][] |
complexAmplitude(double[][] phase,
double[][] amp)
Creates a complex array pointwise.
|
static double[][] |
complexAmplitude(double phase,
double[][] amp)
Creates a complex array pointwise.
|
static float[][] |
complexAmplitude(float[][] phase,
float amp)
Creates a complex array element by element.
|
static float[][] |
complexAmplitude(float[][] phase,
float[][] amp)
Creates a complex array pointwise.
|
static float[][] |
complexAmplitude(float phase,
float[][] amp)
Creates a complex array pointwise.
|
static double[][] |
complexAmplitude2(double[][] real,
double[][] imaginary)
Takes the real and imaginary parts and returns a complex array.
|
static float[][] |
complexAmplitude2(float[][] real,
float[][] imaginary)
Takes the real and imaginary parts and returns a complex array.
|
static double[][] |
complexMultiplication(double[][] a,
double[][] b)
Computes the pointwise complex multiplication of 2 arrays.
|
static float[][] |
complexMultiplication(float[][] a,
float[][] b)
Computes the pointwise complex multiplication of 2 arrays.
|
static void |
complexMultiplication2(double[][] a,
double[][] b)
Computes the pointwise complex multiplication of 2 arrays leaving the
result in
a . |
static void |
complexMultiplication2(float[][] a,
float[][] b)
Computes the pointwise complex multiplication of 2 arrays leaving the
result in
a . |
static void |
complexShift(double[][] a)
Performs the circular shifting of a complex array, leaving the result in
a . |
static void |
complexShift(float[][] a)
Performs the circular shifting of a complex array, leaving the result in
a . |
static void |
divide(double[][] a,
double num)
Computes the pointwise division of an array by
num , leaving the
result in a . |
static void |
divide(float[][] a,
float num)
Computes the pointwise division of an array by
num , leaving the
result in a . |
static double[][] |
imaginary(double[][] a)
Extracts the imaginary part of a complex array.
|
static float[][] |
imaginary(float[][] a)
Extracts the imaginary part of a complex array.
|
static java.lang.String |
jDiffractionVersion()
Returns the library version as a String.
|
static double[][] |
log10(double[][] a)
Computes log10 of a real array.
|
static float[][] |
log10(float[][] a)
Computes log10 of a real array.
|
static void |
matrixToVectorArray(int M,
int N,
double[][] a,
double[] b)
Converts a 2D array into a 1D array leaving the result in
b . |
static void |
matrixToVectorArray(int M,
int N,
float[][] a,
float[] b)
Converts a 2D array into a 1D array leaving the result in
b . |
static double |
max(double[][] a)
Gets the max value of a real array.
|
static float |
max(float[][] a)
Gets the max value of a real array.
|
static double |
min(double[][] a)
Gets the min value of a real array.
|
static float |
min(float[][] a)
Gets the min value of a real array.
|
static double[][] |
modulus(double[][] a)
Computes the modulus of a complex array.
|
static float[][] |
modulus(float[][] a)
Computes the modulus of a complex array.
|
static double[][] |
modulusSq(double[][] a)
Computes the squared modulus of a complex array.
|
static float[][] |
modulusSq(float[][] a)
Computes the squared modulus of a complex array.
|
static void |
multiply(double[][] a,
double num)
Computes the pointwise multiplication of an array by
num , leaving
the result in a . |
static void |
multiply(float[][] a,
float num)
Computes the pointwise multiplication of an array by
num , leaving
the result in a . |
static double[][] |
phase(double[][] a)
Computes the phase (angle) of a complex array.
|
static float[][] |
phase(float[][] a)
Computes the phase (angle) of a complex array.
|
static double[][] |
real(double[][] a)
Extracts the real part of a complex array.
|
static float[][] |
real(float[][] a)
Extracts the real part of a complex array.
|
static void |
realShift(double[][] a)
Performs the circular shifting of a real array, leaving the result in
a . |
static void |
realShift(float[][] a)
Performs the circular shifting of a real array, leaving the result in
a . |
static double[][] |
scale(double[][] a,
double maxScale)
Scales a real array to
[0, maxScale] . |
static double[][] |
scale(double[][] a,
double max,
double min,
double maxScale)
Scales a real array to
[0, maxScale] . |
static float[][] |
scale(float[][] a,
float maxScale)
Scales a real array to
[0, maxScale] . |
static float[][] |
scale(float[][] a,
float max,
float min,
float maxScale)
Scales a real array to
[0, maxScale] . |
static void |
scale2(double[][] a,
double maxScale)
Scales a real array to
[0, maxScale] leaving the result in
a . |
static void |
scale2(double[][] a,
double max,
double min,
double maxScale)
Scales a real array to
[0, maxScale] leaving the result in
a . |
static void |
scale2(float[][] a,
float maxScale)
Scales a real array to
[0, maxScale] leaving the result in
a . |
static void |
scale2(float[][] a,
float max,
float min,
float maxScale)
Scales a real array to
[0, maxScale] leaving the result in
a . |
static void |
vectorToMatrixArray(int M,
int N,
double[] a,
double[][] b)
Converts a 1D array into a 2D array leaving the result in
b . |
static void |
vectorToMatrixArray(int M,
int N,
float[] a,
float[][] b)
Converts a 1D array into a 2D array leaving the result in
b . |
public static java.lang.String jDiffractionVersion()
public static float[][] phase(float[][] a)
phase[i][j] = atan(Im[i][j] / Re[i][j])
a
- complex arraypublic static double[][] phase(double[][] a)
phase[i][j] = atan(Im[i][j] / Re[i][j])
a
- complex arraypublic static float[][] modulus(float[][] a)
modulus[i][j] = sqrt(Re[i][j]^2 + Im[i][j]^2)
a
- complex arraypublic static double[][] modulus(double[][] a)
modulus[i][j] = sqrt(Re[i][j]^2 + Im[i][j]^2)
a
- complex arraypublic static float[][] modulusSq(float[][] a)
modulusSq[i][j] = Re[i][j]^2 + Im[i][j]^2
a
- complex arraypublic static double[][] modulusSq(double[][] a)
modulusSq[i][j] = Re[i][j]^2 + Im[i][j]^2
a
- complex arraypublic static float[][] complexMultiplication(float[][] a, float[][] b)
a
- complex arrayb
- complex arraypublic static double[][] complexMultiplication(double[][] a, double[][] b)
a
- complex arrayb
- complex arraypublic static void complexMultiplication2(float[][] a, float[][] b)
a
.a
- complex arrayb
- complex arraypublic static void complexMultiplication2(double[][] a, double[][] b)
a
.a
- complex arrayb
- complex arraypublic static float[][] complexAmplitude(float[][] phase, float[][] amp)
amp * exp(i * phase)
.phase
- phase arrayamp
- amplitude arraypublic static double[][] complexAmplitude(double[][] phase, double[][] amp)
amp * exp(i * phase)
.phase
- phase arrayamp
- amplitude arraypublic static float[][] complexAmplitude(float[][] phase, float amp)
amp * exp(i * phase)
phase
- phase arrayamp
- amplitudepublic static double[][] complexAmplitude(double[][] phase, double amp)
amp * exp(i * phase)
.phase
- phase arrayamp
- amplitudepublic static float[][] complexAmplitude(float phase, float[][] amp)
amp * exp(i * phase)
.phase
- phaseamp
- amplitude arraypublic static double[][] complexAmplitude(double phase, double[][] amp)
amp * exp(i * phase)
.phase
- phaseamp
- amplitude arraypublic static float[][] complexAmplitude2(float[][] real, float[][] imaginary)
real
- real part arrayimaginary
- imaginary part arraypublic static double[][] complexAmplitude2(double[][] real, double[][] imaginary)
real
- real part arrayimaginary
- imaginary part arraypublic static float[][] real(float[][] a)
a
- complex arraypublic static double[][] real(double[][] a)
a
- complex arraypublic static float[][] imaginary(float[][] a)
a
- complex arraypublic static double[][] imaginary(double[][] a)
a
- complex arraypublic static void complexShift(float[][] a)
a
.
a b -> d c
c d b a
a
- complex arraypublic static void complexShift(double[][] a)
a
.
a b -> d c
c d b a
a
- complex arraypublic static void realShift(float[][] a)
a
.
a b -> d c
c d b a
a
- real arraypublic static void realShift(double[][] a)
a
.
a b -> d c
c d b a
a
- real arraypublic static void multiply(float[][] a, float num)
num
, leaving
the result in a
.a
- arraynum
- numberpublic static void multiply(double[][] a, double num)
num
, leaving
the result in a
.a
- arraynum
- numberpublic static void divide(float[][] a, float num)
num
, leaving the
result in a
.a
- arraynum
- numberpublic static void divide(double[][] a, double num)
num
, leaving the
result in a
.a
- arraynum
- numberpublic static float[][] log10(float[][] a)
a
- arraypublic static double[][] log10(double[][] a)
a
- arraypublic static float max(float[][] a)
a
- arraypublic static double max(double[][] a)
a
- arraypublic static float min(float[][] a)
a
- arraypublic static double min(double[][] a)
a
- arraypublic static float[][] scale(float[][] a, float max, float min, float maxScale)
[0, maxScale]
.a
- arraymax
- array's max valuemin
- array's min valuemaxScale
- max value of the output arraypublic static double[][] scale(double[][] a, double max, double min, double maxScale)
[0, maxScale]
.a
- arraymax
- array's max valuemin
- array's min valuemaxScale
- max value of the output arraypublic static float[][] scale(float[][] a, float maxScale)
[0, maxScale]
. Array's max and min values
are found using max(float[][])
and min(float[][])
.a
- arraymaxScale
- max value of the output arraypublic static double[][] scale(double[][] a, double maxScale)
[0, maxScale]
. Array's max and min values
are found using max(double[][])
and min(double[][])
.a
- arraymaxScale
- max value of the output arraypublic static void scale2(float[][] a, float max, float min, float maxScale)
[0, maxScale]
leaving the result in
a
.a
- arraymax
- array's max valuemin
- array's min valuemaxScale
- max value of the output arraypublic static void scale2(double[][] a, double max, double min, double maxScale)
[0, maxScale]
leaving the result in
a
.a
- arraymax
- array's max valuemin
- array's min valuemaxScale
- max value of the output arraypublic static void scale2(float[][] a, float maxScale)
[0, maxScale]
leaving the result in
a
. Array's max and min values are found using
max(float[][])
and min(float[][])
.a
- arraymaxScale
- max value of the output arraypublic static void scale2(double[][] a, double maxScale)
[0, maxScale]
leaving the result in
a
. Array's max and min values are found using
max(double[][])
and min(double[][])
.a
- arraymaxScale
- max value of the output arraypublic static void vectorToMatrixArray(int M, int N, float[] a, float[][] b)
b
. It
is assumed that the information on the 1D array is distributed as the
rows of the 2D array in sequence.M
- number of data points in x directionN
- number of data points in y directiona
- 1D arrayb
- 2D arraypublic static void vectorToMatrixArray(int M, int N, double[] a, double[][] b)
b
. It
is assumed that the information on the 1D array is distributed as the
rows of the 2D array in sequence.M
- number of data points in x directionN
- number of data points in y directiona
- 1D arrayb
- 2D arraypublic static void matrixToVectorArray(int M, int N, float[][] a, float[] b)
b
. The
information on the 1D array is distributed as the rows of the 2D array in
sequence.M
- number of data points in x directionN
- number of data points in y directiona
- 2D arrayb
- 1D arraypublic static void matrixToVectorArray(int M, int N, double[][] a, double[] b)
b
. The
information on the 1D array is distributed as the rows of the 2D array in
sequence.M
- number of data points in x directionN
- number of data points in y directiona
- 2D arrayb
- 1D array