HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImathRoots.h File Reference
#include "ImathMath.h"
#include "ImathNamespace.h"
#include <complex>
+ Include dependency graph for ImathRoots.h:

Go to the source code of this file.

Functions

template<class T >
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 int 
solveLinear (T a, T b, T &x)
 
template<class T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 int 
solveQuadratic (T a, T b, T c, T x[2])
 
template<class T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 int 
solveNormalizedCubic (T r, T s, T t, T x[3])
 
template<class T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 int 
solveCubic (T a, T b, T c, T d, T x[3])
 
template<class T >
IMATH_CONSTEXPR14 int solveLinear (T a, T b, T &x)
 
template<class T >
IMATH_CONSTEXPR14 int solveQuadratic (T a, T b, T c, T x[2])
 
template<class T >
IMATH_CONSTEXPR14 int solveNormalizedCubic (T r, T s, T t, T x[3])
 
template<class T >
IMATH_CONSTEXPR14 int solveCubic (T a, T b, T c, T d, T x[3])
 

Function Documentation

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveCubic ( a,
b,
c,
d,
x[3] 
)

Solve for x in the cubic equation:

a * x*x*x + b * x*x + c * x + d == 0

The equation is solved using Cardano's Formula; even though only real solutions are produced, some intermediate results are complex (std::complex<T>).

Returns
0 if there is no solution, and -1 if all real numbers are solutions, otherwise return the number of solutions.

Definition at line 197 of file ImathRoots.h.

template<class T >
IMATH_CONSTEXPR14 int solveCubic ( a,
b,
c,
d,
x[3] 
)

Solve for x in the cubic equation:

a * x*x*x + b * x*x + c * x + d == 0

The equation is solved using Cardano's Formula; even though only real solutions are produced, some intermediate results are complex (std::complex<T>).

Returns
0 if there is no solution, and -1 if all real numbers are solutions, otherwise return the number of solutions.

Definition at line 197 of file ImathRoots.h.

template<class T >
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveLinear ( a,
b,
T &  x 
)

Solve for x in the linear equation:

a * x + b == 0
Returns
1 if the equation has a solution, 0 if there is no solution, and -1 if all real numbers are solutions.

Definition at line 88 of file ImathRoots.h.

template<class T >
IMATH_CONSTEXPR14 int solveLinear ( a,
b,
T &  x 
)

Solve for x in the linear equation:

a * x + b == 0
Returns
1 if the equation has a solution, 0 if there is no solution, and -1 if all real numbers are solutions.

Definition at line 88 of file ImathRoots.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveNormalizedCubic ( r,
s,
t,
x[3] 
)

Solve for x in the normalized cubic equation:

x*x*x + r * x*x + s * x + t == 0

The equation is solved using Cardano's Formula; even though only real solutions are produced, some intermediate results are complex (std::complex<T>).

Returns
0 if there is no solution, and -1 if all real numbers are solutions, otherwise return the number of solutions.

Definition at line 140 of file ImathRoots.h.

template<class T >
IMATH_CONSTEXPR14 int solveNormalizedCubic ( r,
s,
t,
x[3] 
)

Solve for x in the normalized cubic equation:

x*x*x + r * x*x + s * x + t == 0

The equation is solved using Cardano's Formula; even though only real solutions are produced, some intermediate results are complex (std::complex<T>).

Returns
0 if there is no solution, and -1 if all real numbers are solutions, otherwise return the number of solutions.

Definition at line 140 of file ImathRoots.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveQuadratic ( a,
b,
c,
x[2] 
)

Solve for x in the quadratic equation:

a * x*x + b * x + c == 0
Returns
2 if the equation has two solutions, 1 if the equation has a single solution, 0 if there is no solution, and -1 if all real numbers are solutions.

Definition at line 107 of file ImathRoots.h.

template<class T >
IMATH_CONSTEXPR14 int solveQuadratic ( a,
b,
c,
x[2] 
)

Solve for x in the quadratic equation:

a * x*x + b * x + c == 0
Returns
2 if the equation has two solutions, 1 if the equation has a single solution, 0 if there is no solution, and -1 if all real numbers are solutions.

Definition at line 107 of file ImathRoots.h.