|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.jhmi.rad.medic.utilities.NumericsPublic
public class NumericsPublic
This class computes various basic numerical functions.
Includes min, max, gaussian random numbers, special functions, mathematical constants. This duplicates some of Java's Math functions where these have limited type support (e.g. double, but not float) or perform multiple casting operations (slow).
Field Summary | |
---|---|
static float |
INF
mathematical constants |
static float |
PI
mathematical constants |
static float |
ZERO
mathematical constants |
Constructor Summary | |
---|---|
NumericsPublic()
|
Method Summary | |
---|---|
static double |
abs(double a)
|
static float |
abs(float a)
|
static int |
abs(int a)
|
static int |
argmax(double a,
double b,
double c)
gives the position of the highest value |
static int |
argmax(float a,
float b,
float c)
gives the position of the highest value |
static void |
bestIndex(byte[] id,
float[] bestval,
float[] val,
int num)
find the indices of the num largest values in val (any sign) |
static void |
bestIndex(byte[] id,
float[] bestval,
float[] val,
int num,
byte first)
find the indices of the num largest values in val (>=0) |
static void |
bestIndex(byte[] id,
float[] val,
int num)
find the indices of the num largest values in val (>=0) |
static byte |
bestIndex(float[] val)
find the index of the largest values in val (>=0) |
static byte[] |
bestIndex(float[] val,
int num)
find the indices of the num largest values in val (>=0) |
static void |
bestIndex(short[] id,
float[] bestval,
float[] val,
int num)
find the indices of the num largest values in val (any sign) |
static byte |
bin(boolean val)
boolean to number value |
static double |
bounded(double x,
double a,
double b)
|
static float |
bounded(float x,
float a,
float b)
|
static int |
bounded(int x,
int a,
int b)
|
static int |
ceil(double num)
|
static int |
ceil(float num)
|
static float |
determinant3D(float[][] m)
Close-form 3D matrix determinant |
static double[] |
eigenvalues3D(double[][] m)
Close-form 3D matrix eigenvalues. |
static float[] |
eigenvalues3D(float[][] m)
Close-form 3D matrix eigenvalues. |
static double[][] |
eigenvectors3D(double[][] m,
double[] values)
Simple geometric technique to get eigenvectors of 3D matrices. |
static float[][] |
eigenvectors3D(float[][] m,
float[] values)
Simple geometric technique to get eigenvectors of 3D matrices. |
static int |
floor(double num)
|
static int |
floor(float num)
|
static void |
invert3Dmatrix(float[][] m)
Close-form 3D matrix inversion |
static float |
invertMatrix(float[][] m,
float[][] inverse,
int nColumn)
This method compute the inverse of a matrix |
static void |
main(java.lang.String[] args)
for testing purposes |
static float |
mapped(float x,
float a,
float b)
returns x in [a,b] linearly mapped to [0,1] |
static double |
max(double a,
double b)
|
static float |
max(float[] val)
|
static float |
max(float[] val,
int first,
int last)
|
static float |
max(float a,
float b)
|
static float |
max(float a,
float b,
float c)
|
static int |
max(int a,
int b)
|
static int |
max(int a,
int b,
int c)
|
static float |
maxmag(float a,
float b)
|
static double |
min(double a,
double b)
|
static float |
min(float a,
float b)
|
static float |
min(float a,
float b,
float c)
|
static int |
min(int a,
int b)
|
static long |
min(long a,
long b)
|
static float |
minmag(float a,
float b)
|
static float |
pow(float a,
float b)
|
static double |
randomGaussian()
Gaussian random numbers (from the Box-Muller method, as in NRC) mean 0, variance 1 |
static double |
randomT3(double sigma)
Student T 3rd order random numbers mean 0, variance given note: the formula should be the inverse of the probability integral (wrong here!) |
static int |
round(double num)
|
static int |
round(float num)
rounding function (faster than regular Java) |
static int |
sign(double a)
|
static int |
sign(float a)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float ZERO
public static final float INF
public static final float PI
Constructor Detail |
---|
public NumericsPublic()
Method Detail |
---|
public static final double randomGaussian()
public static final double randomT3(double sigma)
public static final float determinant3D(float[][] m)
public static final void invert3Dmatrix(float[][] m)
public static final float invertMatrix(float[][] m, float[][] inverse, int nColumn)
m
- : the given matrix which should be a square array of floatsinverse
- : is the result of inversionnColumn
- : number of coulmn of squared aaray
public static final float[] eigenvalues3D(float[][] m)
This may not work well all the time with arbitrary matrices.
public static final float[][] eigenvectors3D(float[][] m, float[] values)
This may not work well all the time: sometimes you have a 2 or 3D sub-space with one eigenvalue. We assume here that the highest eigenvalues give the most reliable directions, and lesser eigenvectors are projected on orthogonal subspaces (seems wrong: to check). We also assume ordered, positive eigenvalues.
public static final double[] eigenvalues3D(double[][] m)
This may not work well all the time with arbitrary matrices.
public static final double[][] eigenvectors3D(double[][] m, double[] values)
This may not work well all the time: sometimes you have a 2 or 3D sub-space with one eigenvalue. We assume here that the highest eigenvalues give the most reliable directions, and lesser eigenvectors are projected on orthogonal subspaces. We also assume ordered, positive eigenvalues.
public static final int round(float num)
public static final int floor(float num)
public static final int ceil(float num)
public static final int round(double num)
public static final int floor(double num)
public static final int ceil(double num)
public static final float min(float a, float b)
public static final double min(double a, double b)
public static final int min(int a, int b)
public static final long min(long a, long b)
public static final float min(float a, float b, float c)
public static final float max(float a, float b)
public static final double max(double a, double b)
public static final int max(int a, int b)
public static final int max(int a, int b, int c)
public static final float max(float a, float b, float c)
public static final float max(float[] val)
public static final float max(float[] val, int first, int last)
public static final int bounded(int x, int a, int b)
public static final float bounded(float x, float a, float b)
public static final double bounded(double x, double a, double b)
public static final float minmag(float a, float b)
public static final float maxmag(float a, float b)
public static final float mapped(float x, float a, float b)
public static final float abs(float a)
public static final double abs(double a)
public static final int abs(int a)
public static final int sign(float a)
public static final int sign(double a)
public static final float pow(float a, float b)
public static final byte bestIndex(float[] val)
public static final byte[] bestIndex(float[] val, int num)
public static final void bestIndex(byte[] id, float[] val, int num)
public static final void bestIndex(byte[] id, float[] bestval, float[] val, int num)
public static final void bestIndex(short[] id, float[] bestval, float[] val, int num)
public static final void bestIndex(byte[] id, float[] bestval, float[] val, int num, byte first)
public static final int argmax(float a, float b, float c)
public static final int argmax(double a, double b, double c)
public static final byte bin(boolean val)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |