$darkmode
DENOPTIM
denoptim.utils.MathUtils Class Reference

Some useful math operations. More...

Static Public Member Functions

static double calculateAngle (double[] a, double[] b)
 compute the angle between two vectors a & b of same length More...
 
static void norm (double[] d, double[] ret)
 Normalizes a vector. More...
 
static Vector3d normDist (Point3d p1, Point3d p2)
 Get normalized distance between two point. More...
 
static double[] scale (double[] d, double a)
 Scales a vector. More...
 
static void scalar (double[] d, double a, double[] ret)
 Scales a vector. More...
 
static double length (double[] v)
 Return the norm of a vector. More...
 
static double computeDotProduct (double[] v0, double[] v1)
 Compute the dot product (a scalar) between two vectors. More...
 
static double[] computeCrossProduct (double[] v0, double[] v1)
 Compute the cross product of two vectors. More...
 
static double[] subtract (double[] v0, double[] v1)
 Perform vector subtraction. More...
 
static double[] add (double[] v0, double[] v1)
 Perform vector addition. More...
 
static double computeDihedralAngle (Point3d p0, Point3d p1, Point3d p2, Point3d p3)
 Compute the dihedral angle. More...
 
static double computeDihedralAngle (double[] v0, double[] v1, double[] v2, double[] v3)
 Compute the dihedral angle. More...
 
static double log2 (double x)
 
static double roundValue (double val, int decimalPlaces)
 
static double angle (Point3d a, Point3d b, Point3d c)
 Calculate the angle between the 3 points. More...
 
static double getAngle (double[] A, double[] B, double[] C)
 Calculates angle (in degrees) between vectors BA and BC. More...
 
static double distance (Point3d a, Point3d b)
 Calculates distance between point a and point b. More...
 
static double torsion (Point3d p1, Point3d p2, Point3d p3, Point3d p4)
 Calculate the torsion angle between the 4 points. More...
 
static double sum (double[] a)
 Return sum of all values in array. More...
 
static double mean (double[] a)
 Calculate mean value. More...
 
static double mean (List< Double > vals)
 
static Vector3d getNormalDirection (Vector3d vecA)
 Generate a vector that is perpendicular to the given one. More...
 
static double[] centroidOf (Collection< double[]> points, int dimension)
 

Static Private Attributes

static final double[] tp1 = new double[3]
 
static final double[] tp2 = new double[3]
 
static final double[] tp3 = new double[3]
 
static final double[] tp4 = new double[3]
 

Detailed Description

Some useful math operations.

Author
Vishwesh Venkatraman
Marco Foscato

Definition at line 38 of file MathUtils.java.

Member Function Documentation

◆ add()

static double[] denoptim.utils.MathUtils.add ( double[]  v0,
double[]  v1 
)
static

Perform vector addition.

Parameters
v0First vector
v1Second vector
Returns
v0 + v1

Definition at line 198 of file MathUtils.java.

Referenced by denoptim.gui.FragmentViewPanel.updateAPsInJmolViewer().

Here is the caller graph for this function:

◆ angle()

static double denoptim.utils.MathUtils.angle ( Point3d  a,
Point3d  b,
Point3d  c 
)
static

Calculate the angle between the 3 points.

Parameters
a
b
c
Returns
angle calculated

Definition at line 284 of file MathUtils.java.

References denoptim.utils.MathUtils.angle(), and denoptim.constants.DENOPTIMConstants.FLOATCOMPARISONTOLERANCE.

Referenced by denoptim.utils.DummyAtomHandler.addDummiesOnLinearities(), denoptim.utils.MathUtils.angle(), denoptim.utils.MathUtils.calculateAngle(), denoptim.graph.rings.RingClosureFinder.evaluateClosability(), denoptim.integration.tinker.TinkerUtils.getICFromIAC(), and denoptim.integration.tinker.TinkerUtils.getThirdRefAtomId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateAngle()

static double denoptim.utils.MathUtils.calculateAngle ( double[]  a,
double[]  b 
)
static

compute the angle between two vectors a & b of same length

Parameters
a
b
Returns
angle in degrees

Definition at line 51 of file MathUtils.java.

References denoptim.utils.MathUtils.angle(), denoptim.utils.MathUtils.computeDotProduct(), and denoptim.utils.MathUtils.length().

Referenced by denoptim.utils.MathUtils.getAngle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ centroidOf()

static double[] denoptim.utils.MathUtils.centroidOf ( Collection< double[]>  points,
int  dimension 
)
static

Definition at line 457 of file MathUtils.java.

Referenced by denoptim.fragmenter.DynamicCentroidCluster.getCentroid(), and denoptim.fragmenter.FragmentClusterer.getRMSDStatsOfNoisyDistorsions().

Here is the caller graph for this function:

◆ computeCrossProduct()

static double[] denoptim.utils.MathUtils.computeCrossProduct ( double[]  v0,
double[]  v1 
)
static

Compute the cross product of two vectors.

Result is a vector

Parameters
v0First vector
v1Second vector
Returns
crossProduct Cross product of vectors [x,y,z].

Definition at line 162 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.computeDihedralAngle().

Here is the caller graph for this function:

◆ computeDihedralAngle() [1/2]

static double denoptim.utils.MathUtils.computeDihedralAngle ( double[]  v0,
double[]  v1,
double[]  v2,
double[]  v3 
)
static

Compute the dihedral angle.

Parameters
v03D coordinates
v13D coordinates
v23D coordinates
v33D coordinates
Returns
angle

Definition at line 241 of file MathUtils.java.

References denoptim.utils.MathUtils.computeCrossProduct(), denoptim.utils.MathUtils.computeDotProduct(), and denoptim.utils.MathUtils.subtract().

Here is the call graph for this function:

◆ computeDihedralAngle() [2/2]

static double denoptim.utils.MathUtils.computeDihedralAngle ( Point3d  p0,
Point3d  p1,
Point3d  p2,
Point3d  p3 
)
static

Compute the dihedral angle.

Parameters
p0point in 3D
p1point in 3D
p2point in 3D
p3point in 3D
Returns
angle

Definition at line 218 of file MathUtils.java.

References denoptim.utils.MathUtils.computeDihedralAngle().

Referenced by denoptim.utils.MathUtils.computeDihedralAngle(), denoptim.graph.rings.RingClosureFinder.evaluateClosability(), and denoptim.utils.MathUtils.torsion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeDotProduct()

static double denoptim.utils.MathUtils.computeDotProduct ( double[]  v0,
double[]  v1 
)
static

Compute the dot product (a scalar) between two vectors.

Parameters
v0First vector
v1Second vector
Returns
Dot product of given vectors.

Definition at line 148 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.calculateAngle(), and denoptim.utils.MathUtils.computeDihedralAngle().

Here is the caller graph for this function:

◆ distance()

static double denoptim.utils.MathUtils.distance ( Point3d  a,
Point3d  b 
)
static

Calculates distance between point a and point b.

Parameters
aPoint
bPoint
Returns
Distance between a and b

Definition at line 342 of file MathUtils.java.

Referenced by denoptim.graph.Fragment.is3D(), and denoptim.molecularmodeling.ChemicalObjectModel.updateXYZFromINT().

Here is the caller graph for this function:

◆ getAngle()

static double denoptim.utils.MathUtils.getAngle ( double[]  A,
double[]  B,
double[]  C 
)
static

Calculates angle (in degrees) between vectors BA and BC.

Parameters
APoint
BPoint
CPoint
Returns
Angle (degrees)

Definition at line 324 of file MathUtils.java.

References denoptim.utils.MathUtils.calculateAngle().

Here is the call graph for this function:

◆ getNormalDirection()

static Vector3d denoptim.utils.MathUtils.getNormalDirection ( Vector3d  vecA)
static

Generate a vector that is perpendicular to the given one.

No control over which perpendicular direction will be chosen.

Parameters
vecAinput vector
Returns
a normal vector

Definition at line 426 of file MathUtils.java.

Referenced by denoptim.molecularmodeling.ThreeDimTreeBuilder.append3DFragmentsViaEdges().

Here is the caller graph for this function:

◆ length()

static double denoptim.utils.MathUtils.length ( double[]  v)
static

Return the norm of a vector.

Parameters
vVector to compute length of.
Returns
Length of vector.

Definition at line 134 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.calculateAngle(), and denoptim.utils.MathUtils.norm().

Here is the caller graph for this function:

◆ log2()

static double denoptim.utils.MathUtils.log2 ( double  x)
static

Definition at line 260 of file MathUtils.java.

◆ mean() [1/2]

static double denoptim.utils.MathUtils.mean ( double[]  a)
static

Calculate mean value.

Parameters
aArray to calculate mean from.
Returns
mean value of array, NaN if empty array.

Definition at line 396 of file MathUtils.java.

References denoptim.utils.MathUtils.sum().

Referenced by denoptim.fitness.FitnessProvider.getFitness(), and denoptim.utils.MathUtils.mean().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mean() [2/2]

static double denoptim.utils.MathUtils.mean ( List< Double >  vals)
static

Definition at line 406 of file MathUtils.java.

References denoptim.utils.MathUtils.mean().

Here is the call graph for this function:

◆ norm()

static void denoptim.utils.MathUtils.norm ( double[]  d,
double[]  ret 
)
static

Normalizes a vector.

Parameters
dA vector to be normalized.
retThe normalized vector.

Definition at line 67 of file MathUtils.java.

References denoptim.utils.MathUtils.length().

Here is the call graph for this function:

◆ normDist()

static Vector3d denoptim.utils.MathUtils.normDist ( Point3d  p1,
Point3d  p2 
)
static

Get normalized distance between two point.

Parameters
p1the first point
p2the second point
Returns
the normalized vector

Definition at line 86 of file MathUtils.java.

Referenced by denoptim.molecularmodeling.ChemicalObjectModel.updateXYZFromINT().

Here is the caller graph for this function:

◆ roundValue()

static double denoptim.utils.MathUtils.roundValue ( double  val,
int  decimalPlaces 
)
static

Definition at line 268 of file MathUtils.java.

◆ scalar()

static void denoptim.utils.MathUtils.scalar ( double[]  d,
double  a,
double[]  ret 
)
static

Scales a vector.

Parameters
dA vector to be scaled
aA scaling value
retThe scaled vector

Definition at line 119 of file MathUtils.java.

◆ scale()

static double[] denoptim.utils.MathUtils.scale ( double[]  d,
double  a 
)
static

Scales a vector.

Parameters
dA vector to be scaled
aA scaling value

Definition at line 102 of file MathUtils.java.

Referenced by denoptim.gui.FragmentViewPanel.updateAPsInJmolViewer().

Here is the caller graph for this function:

◆ subtract()

static double[] denoptim.utils.MathUtils.subtract ( double[]  v0,
double[]  v1 
)
static

Perform vector subtraction.

Parameters
v0Vector to subtract from
v1Vector to subtract
Returns
v0 - v1

Definition at line 180 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.computeDihedralAngle(), and denoptim.gui.FragmentViewPanel.updateAPsInJmolViewer().

Here is the caller graph for this function:

◆ sum()

static double denoptim.utils.MathUtils.sum ( double[]  a)
static

Return sum of all values in array.

Parameters
aArray to sum elements of.
Returns
array sum.

Definition at line 380 of file MathUtils.java.

References denoptim.utils.MathUtils.sum().

Referenced by denoptim.utils.MathUtils.mean(), and denoptim.utils.MathUtils.sum().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ torsion()

static double denoptim.utils.MathUtils.torsion ( Point3d  p1,
Point3d  p2,
Point3d  p3,
Point3d  p4 
)
static

Calculate the torsion angle between the 4 points.

Parameters
p1Point
p2Point
p3Point
p4Point
Returns
Torsion between arguments

Definition at line 363 of file MathUtils.java.

References denoptim.utils.MathUtils.computeDihedralAngle(), denoptim.utils.MathUtils.tp1, denoptim.utils.MathUtils.tp2, denoptim.utils.MathUtils.tp3, and denoptim.utils.MathUtils.tp4.

Referenced by denoptim.integration.tinker.TinkerUtils.getICFromIAC().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ tp1

final double [] denoptim.utils.MathUtils.tp1 = new double[3]
staticprivate

Definition at line 350 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.torsion().

◆ tp2

final double [] denoptim.utils.MathUtils.tp2 = new double[3]
staticprivate

Definition at line 351 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.torsion().

◆ tp3

final double [] denoptim.utils.MathUtils.tp3 = new double[3]
staticprivate

Definition at line 352 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.torsion().

◆ tp4

final double [] denoptim.utils.MathUtils.tp4 = new double[3]
staticprivate

Definition at line 353 of file MathUtils.java.

Referenced by denoptim.utils.MathUtils.torsion().


The documentation for this class was generated from the following file: