Chi-Tech
chi_math Namespace Reference

Namespaces

namespace  cell_mapping
 
namespace  finite_element
 
namespace  functions
 
namespace  PETScUtils
 
namespace  SimplifiedLDFESQ
 
namespace  spatial_discretization
 

Data Structures

class  AngularQuadrature
 
class  AngularQuadratureCustom
 
class  AngularQuadratureProdCustom
 
class  AngularQuadratureProdGL
 
class  AngularQuadratureProdGLC
 
class  AngularQuadratureProdGLL
 
class  CDFSampler
 
class  CellMapping
 
class  CrankNicolsonTimeIntegration
 
class  CurvilinearAngularQuadrature
 
class  CylindricalAngularQuadrature
 
class  DynamicMatrix
 
class  DynamicVector
 
class  FunctionDimAToDimB
 
class  GhostedParallelSTLVector
 
class  GolubFischer
 
class  ImplicitEulerTimeIntegration
 
class  LinearSolver
 
struct  LinearSolverContext
 
class  NonLinearFunction
 
class  NonLinearSolver
 
struct  NonLinearSolverContext
 
class  NonLinearSolverOptions
 
class  ParallelSTLVector
 
class  ParallelVector
 
class  PointQuadrature
 
struct  PreconditionerContext
 
class  ProductQuadrature
 
class  Quadrature
 
class  QuadratureConical
 
class  QuadratureGaussChebyshev
 
class  QuadratureGaussLegendre
 
class  QuadratureHexahedron
 
class  QuadratureJacobi
 
class  QuadratureLine
 
struct  QuadraturePointPhiTheta
 
class  QuadratureQuadrilateral
 
class  QuadratureTetrahedron
 
class  QuadratureTriangle
 
class  QuadratureWedge
 
class  RandomNumberGenerator
 
class  SparseMatrix
 
class  SpatialDiscretization
 
class  SphericalAngularQuadrature
 
struct  TensorRNX
 
struct  TensorRNX< 2, N, NumberFormat >
 
class  ThetaSchemeTimeIntegration
 
class  TimeIntegration
 
class  Unknown
 
class  UnknownManager
 
class  VectorGhostCommunicator
 
struct  VectorNX
 

Typedefs

typedef std::shared_ptr< AngularQuadratureAngularQuadraturePtr
 
typedef std::shared_ptr< SpatialDiscretizationSpatialDiscretizationPtr
 
template<int R, int N>
using TensorRN = TensorRNX< R, N, double >
 
template<int N>
using Tensor2N = TensorRNX< 2, N, double >
 
template<int N>
using VectorN = VectorNX< N, double >
 
using Vector2 = VectorN< 2 >
 
using Vector3 = VectorN< 3 >
 
typedef std::function< double(double)> ScalarScalarFunction
 
typedef std::function< double(double, double, double, double)> ScalarXYZTFunction
 
using NonLinearSolverPETSc = NonLinearSolver< Mat, Vec, SNES >
 
typedef chi_mesh::Vector3 QuadraturePointXYZ
 
typedef std::shared_ptr< SpatialDiscretizationSDMPtr
 

Enumerations

enum class  CoordinateSystemType { UNDEFINED = 0 , CARTESIAN = 1 , CYLINDRICAL = 2 , SPHERICAL = 3 }
 
enum class  SpatialDiscretizationType {
  UNDEFINED = 0 , FINITE_VOLUME = 1 , PIECEWISE_LINEAR_CONTINUOUS = 2 , PIECEWISE_LINEAR_DISCONTINUOUS = 3 ,
  LAGRANGE_CONTINUOUS = 4 , LAGRANGE_DISCONTINUOUS = 5
}
 
enum class  NormType : int { L1_NORM = 1 , L2_NORM = 2 , LINF_NORM = 3 }
 
enum class  SteppingMethod {
  NONE = 0 , EXPLICIT_EULER = 1 , IMPLICIT_EULER = 2 , CRANK_NICOLSON = 3 ,
  THETA_SCHEME = 4
}
 
enum class  ResidualScaleType { NONE = 0 , RHS_NORM = 1 , RHS_PRECONDITIONED_NORM = 2 , CUSTOM_SCALE = 3 }
 
enum class  VecOpType : short { SET_VALUE = 1 , ADD_VALUE = 2 }
 
enum class  ProductQuadratureType {
  UNKNOWN = 0 , GAUSS_LEGENDRE = 1 , GAUSS_CHEBYSHEV = 2 , GAUSS_LEGENDRE_LEGENDRE = 3 ,
  GAUSS_LEGENDRE_CHEBYSHEV = 4 , CUSTOM_QUADRATURE = 5
}
 
enum class  AngularQuadratureType { Arbitrary = 1 , ProductQuadrature = 2 , SLDFESQ = 3 }
 
enum class  QuadratureOrder : int {
  CONSTANT = 0 , FIRST = 1 , SECOND = 2 , THIRD = 3 ,
  FOURTH = 4 , FIFTH = 5 , SIXTH = 6 , SEVENTH = 7 ,
  EIGHTH = 8 , NINTH = 9 , TENTH = 10 , ELEVENTH = 11 ,
  TWELFTH = 12 , THIRTEENTH = 13 , FOURTEENTH = 14 , FIFTEENTH = 15 ,
  SIXTEENTH = 16 , SEVENTEENTH = 17 , EIGHTTEENTH = 18 , NINETEENTH = 19 ,
  TWENTIETH = 20 , TWENTYFIRST = 21 , TWENTYSECOND = 22 , TWENTYTHIRD = 23 ,
  TWENTYFOURTH = 24 , TWENTYFIFTH = 25 , TWENTYSIXTH = 26 , TWENTYSEVENTH = 27 ,
  TWENTYEIGHTH = 28 , TWENTYNINTH = 29 , THIRTIETH = 30 , THIRTYFIRST = 31 ,
  THIRTYSECOND = 32 , THIRTYTHIRD = 33 , THIRTYFOURTH = 34 , THIRTYFIFTH = 35 ,
  THIRTYSIXTH = 36 , THIRTYSEVENTH = 37 , THIRTYEIGHTH = 38 , THIRTYNINTH = 39 ,
  FORTIETH = 40 , FORTYFIRST = 41 , FORTYSECOND = 42 , FORTYTHIRD = 43 ,
  INVALID_ORDER
}
 
enum class  UnknownType {
  SCALAR = 1 , VECTOR_2 = 2 , VECTOR_3 = 3 , VECTOR_N = 4 ,
  TENSOR = 5
}
 
enum class  UnknownStorageType { NODAL = 1 , BLOCK = 2 }
 

Functions

int SampleCDF (double x, std::vector< double > cdf_bin)
 
double Factorial (int x)
 
std::pair< double, double > OmegaToPhiThetaSafe (const chi_mesh::Vector3 &omega)
 
void PrintVector (const VecDbl &x)
 
void Scale (VecDbl &x, const double &val)
 
void Set (VecDbl &x, const double &val)
 
VecDbl VecMul (const VecDbl &x, const double &val)
 
double Vec1Norm (const VecDbl &x)
 
double Vec2Norm (const VecDbl &x)
 
double VecInfinityNorm (const VecDbl &x)
 
double VecPNorm (const VecDbl &x, const double &p)
 
double Dot (const VecDbl &x, const VecDbl &y)
 
VecDbl operator+ (const VecDbl &a, const VecDbl &b)
 
VecDbl operator- (const VecDbl &a, const VecDbl &b)
 
void PrintMatrix (const MatDbl &A)
 
void Scale (MatDbl &A, const double &val)
 
void Set (MatDbl &A, const double &val)
 
MatDbl Transpose (const MatDbl &A)
 
void SwapRow (size_t r1, size_t r2, MatDbl &A)
 
void SwapColumn (size_t c1, size_t c2, MatDbl &A)
 
MatDbl MatMul (const MatDbl &A, const double c)
 
VecDbl MatMul (const MatDbl &A, const VecDbl &x)
 
MatDbl MatMul (const MatDbl &A, const MatDbl &B)
 
MatDbl MatAdd (const MatDbl &A, const MatDbl &B)
 
MatDbl MatSubtract (const MatDbl &A, const MatDbl &B)
 
double Determinant (const MatDbl &A)
 
MatDbl SubMatrix (const size_t r, const size_t c, const MatDbl &A)
 
void GaussElimination (MatDbl &A, VecDbl &b, int n)
 
MatDbl InverseGEPivoting (const MatDbl &A)
 
MatDbl Inverse (const MatDbl &A)
 
double PowerIteration (const MatDbl &A, VecDbl &e_vec, int max_it=2000, double tol=1.0e-13)
 
double Vec2NormMPI (const VecDbl &x, MPI_Comm comm)
 
template<typename T , typename D = int>
std::vector< T > Range (T start, T end, D delta=1)
 
std::string SteppingMethodStringName (SteppingMethod method)
 
SteppingMethod SteppingMethodFromString (const std::string &name)
 
template<>
int LinearSolverMatrixAction (Mat matrix, Vec vector, Vec action)
 
template<class MatType , class VecType >
int LinearSolverMatrixAction (MatType matrix, VecType vector, VecType action)
 
template<>
int PreconditionerApplication (PC pc, Vec vector, Vec action)
 
template<class PCType , class VecType >
int PreconditionerApplication (PCType pc, VecType vector, VecType action)
 
 RegisterChiObjectParametersOnly (chi_math, NonLinearSolverOptions)
 
double Legendre (int N, double x)
 
double dLegendredx (int N, double x)
 
double d2Legendredx2 (int N, double x)
 
double AssocLegendre (unsigned int ell, int m, double x)
 
double Ylm (unsigned int ell, int m, double varphi, double theta)
 
chi::InputParameters GetSyntax_Get1DQuadratureData ()
 
chi::ParameterBlock Get1DQuadratureData (const chi::InputParameters &params)
 
 RegisterWrapperFunction (chi_math, Get1DQuadratureData, GetSyntax_Get1DQuadratureData, Get1DQuadratureData)
 
 RegisterChiObject (chi_math, QuadratureGaussChebyshev)
 
 RegisterChiObject (chi_math, QuadratureGaussLegendre)
 
VecDbl NewtonIteration (const NonLinearFunction &non_linear_function, const VecDbl &x_0, unsigned int max_iters, double epsilon, bool verbose=false)
 
 RegisterChiObject (chi_math, CrankNicolsonTimeIntegration)
 
 RegisterChiObject (chi_math, ImplicitEulerTimeIntegration)
 
 RegisterChiObject (chi_math, ThetaSchemeTimeIntegration)
 

Detailed Description

Container object for functions relating to Legendre polynomials.

Typedef Documentation

◆ AngularQuadraturePtr

Definition at line 46 of file chi_runtime.h.

◆ NonLinearSolverPETSc

Definition at line 11 of file NonLinearSolverPETSc.h.

◆ QuadraturePointXYZ

Definition at line 27 of file quadrature.h.

◆ ScalarScalarFunction

typedef std::function<double(double)> chi_math::ScalarScalarFunction

Definition at line 9 of file function_dimA_to_dimB.h.

◆ ScalarXYZTFunction

typedef std::function<double(double, double, double, double)> chi_math::ScalarXYZTFunction

Definition at line 11 of file function_dimA_to_dimB.h.

◆ SDMPtr

typedef std::shared_ptr< SpatialDiscretization > chi_math::SDMPtr

Definition at line 20 of file fieldfunction_gridbased.h.

◆ SpatialDiscretizationPtr

Definition at line 47 of file chi_runtime.h.

◆ Tensor2N

template<int N>
using chi_math::Tensor2N = typedef TensorRNX<2,N,double>

Definition at line 330 of file chi_math_tensorRNX.h.

◆ TensorRN

template<int R, int N>
using chi_math::TensorRN = typedef TensorRNX<R,N,double>

Definition at line 327 of file chi_math_tensorRNX.h.

◆ Vector2

using chi_math::Vector2 = typedef VectorN<2>

Definition at line 473 of file chi_math_vectorNX.h.

◆ Vector3

using chi_math::Vector3 = typedef VectorN<3>

Definition at line 474 of file chi_math_vectorNX.h.

◆ VectorN

template<int N>
using chi_math::VectorN = typedef VectorNX<N,double>

Definition at line 471 of file chi_math_vectorNX.h.

Enumeration Type Documentation

◆ AngularQuadratureType

Enumerator
Arbitrary 
ProductQuadrature 
SLDFESQ 

Definition at line 12 of file angular_quadrature_base.h.

◆ CoordinateSystemType

enum class chi_math::CoordinateSystemType
strong

Coordinate system type.

Enumerator
UNDEFINED 
CARTESIAN 
CYLINDRICAL 
SPHERICAL 

Definition at line 28 of file chi_math.h.

◆ NormType

enum class chi_math::NormType : int
strong
Enumerator
L1_NORM 
L2_NORM 
LINF_NORM 

Definition at line 46 of file chi_math.h.

◆ ProductQuadratureType

Enumerator
UNKNOWN 
GAUSS_LEGENDRE 
GAUSS_CHEBYSHEV 
GAUSS_LEGENDRE_LEGENDRE 
GAUSS_LEGENDRE_CHEBYSHEV 
CUSTOM_QUADRATURE 

Definition at line 11 of file angular_product_quadrature.h.

◆ QuadratureOrder

enum class chi_math::QuadratureOrder : int
strong
Enumerator
CONSTANT 
FIRST 
SECOND 
THIRD 
FOURTH 
FIFTH 
SIXTH 
SEVENTH 
EIGHTH 
NINTH 
TENTH 
ELEVENTH 
TWELFTH 
THIRTEENTH 
FOURTEENTH 
FIFTEENTH 
SIXTEENTH 
SEVENTEENTH 
EIGHTTEENTH 
NINETEENTH 
TWENTIETH 
TWENTYFIRST 
TWENTYSECOND 
TWENTYTHIRD 
TWENTYFOURTH 
TWENTYFIFTH 
TWENTYSIXTH 
TWENTYSEVENTH 
TWENTYEIGHTH 
TWENTYNINTH 
THIRTIETH 
THIRTYFIRST 
THIRTYSECOND 
THIRTYTHIRD 
THIRTYFOURTH 
THIRTYFIFTH 
THIRTYSIXTH 
THIRTYSEVENTH 
THIRTYEIGHTH 
THIRTYNINTH 
FORTIETH 
FORTYFIRST 
FORTYSECOND 
FORTYTHIRD 
INVALID_ORDER 

Definition at line 12 of file quadrature.h.

◆ ResidualScaleType

enum class chi_math::ResidualScaleType
strong
Enumerator
NONE 
RHS_NORM 
RHS_PRECONDITIONED_NORM 
CUSTOM_SCALE 

Definition at line 6 of file linear_solver_context.h.

◆ SpatialDiscretizationType

Spatial discretization type.

Enumerator
UNDEFINED 
FINITE_VOLUME 
PIECEWISE_LINEAR_CONTINUOUS 
PIECEWISE_LINEAR_DISCONTINUOUS 
LAGRANGE_CONTINUOUS 
LAGRANGE_DISCONTINUOUS 

Definition at line 36 of file chi_math.h.

◆ SteppingMethod

enum class chi_math::SteppingMethod
strong
Enumerator
NONE 
EXPLICIT_EULER 
IMPLICIT_EULER 
CRANK_NICOLSON 
THETA_SCHEME 

Definition at line 9 of file chi_math_time_stepping.h.

◆ UnknownStorageType

enum class chi_math::UnknownStorageType
strong

Nodal variable storage format.

Enumerator
NODAL 
BLOCK 

Definition at line 23 of file unknown_manager.h.

◆ UnknownType

enum class chi_math::UnknownType
strong

Different types of variables.

Enumerator
SCALAR 
VECTOR_2 
VECTOR_3 
VECTOR_N 
TENSOR 

Definition at line 13 of file unknown_manager.h.

◆ VecOpType

enum class chi_math::VecOpType : short
strong
Enumerator
SET_VALUE 
ADD_VALUE 

Definition at line 12 of file ParallelVector.h.

Function Documentation

◆ AssocLegendre()

double chi_math::AssocLegendre ( unsigned int  ell,
int  m,
double  x 
)

Provides the function evaluation of the associated Legendre polynomial at value x.

This code has a whitepaper associated with it Spherical Harmonics

Parameters
ellint The ell order of the polynomial.
mint The m-th moment of the polynomial
xdouble The evaluation point.

Definition at line 16 of file assoc_legendrepoly.cc.

◆ d2Legendredx2()

double chi_math::d2Legendredx2 ( int  N,
double  x 
)

Provides the function evaluation of the second derivative of Pn at value x

Parameters
Nint Order of the Legendre polynomial.
xdouble The evaluation point.

Definition at line 54 of file legendrepoly.cc.

◆ Determinant()

double chi_math::Determinant ( const MatDbl A)

Computes the determinant of a matrix.

Definition at line 211 of file chi_math_02_matrix_operations.cc.

◆ dLegendredx()

double chi_math::dLegendredx ( int  N,
double  x 
)

Provides the function evaluation of the derivative of Pn at value x

Parameters
Nint Order of the Legendre polynomial.
xdouble The evaluation point.

Definition at line 37 of file legendrepoly.cc.

◆ Dot()

double chi_math::Dot ( const VecDbl x,
const VecDbl y 
)

Computes the dot product of two vectors.

\[ \mathrm{a} \cdot \mathrm{b}=\sum_{i=1}^{n} a_{i} b_{i} \]

Definition at line 36 of file chi_math_03_vector_operations.cc.

◆ Factorial()

double chi_math::Factorial ( int  x)

Computes the factorial of an integer.

Definition at line 5 of file chi_math_01_utility.cc.

◆ GaussElimination()

void chi_math::GaussElimination ( MatDbl A,
VecDbl b,
int  n 
)

Gauss Elimination without pivoting.

Definition at line 286 of file chi_math_02_matrix_operations.cc.

◆ Get1DQuadratureData()

chi::ParameterBlock chi_math::Get1DQuadratureData ( const chi::InputParameters params)

Definition at line 31 of file quadrature.cc.

◆ GetSyntax_Get1DQuadratureData()

chi::InputParameters chi_math::GetSyntax_Get1DQuadratureData ( )

Definition at line 18 of file quadrature.cc.

◆ Inverse()

MatDbl chi_math::Inverse ( const MatDbl A)

Computes the inverse of a matrix.

Definition at line 379 of file chi_math_02_matrix_operations.cc.

◆ InverseGEPivoting()

MatDbl chi_math::InverseGEPivoting ( const MatDbl A)

Computes the inverse of a matrix using Gauss-Elimination with pivoting.

Definition at line 318 of file chi_math_02_matrix_operations.cc.

◆ Legendre()

double chi_math::Legendre ( int  N,
double  x 
)

Provides the function evaluation of the Legendre polynomial P_N at value x.

Parameters
Nint Order of the Legendre polynomial.
xdouble The evaluation point.

Definition at line 11 of file legendrepoly.cc.

◆ LinearSolverMatrixAction() [1/2]

template<>
int chi_math::LinearSolverMatrixAction ( Mat  matrix,
Vec  vector,
Vec  action 
)

Definition at line 11 of file linear_matrix_action_Ax.cc.

◆ LinearSolverMatrixAction() [2/2]

template<class MatType , class VecType >
int chi_math::LinearSolverMatrixAction ( MatType  matrix,
VecType  vector,
VecType  action 
)

◆ MatAdd()

MatDbl chi_math::MatAdd ( const MatDbl A,
const MatDbl B 
)

Adds two matrices and returns the result.

Definition at line 160 of file chi_math_02_matrix_operations.cc.

◆ MatMul() [1/3]

MatDbl chi_math::MatMul ( const MatDbl A,
const double  c 
)

Multiply matrix with a constant and return result.

Definition at line 96 of file chi_math_02_matrix_operations.cc.

◆ MatMul() [2/3]

MatDbl chi_math::MatMul ( const MatDbl A,
const MatDbl B 
)

Mutliply two matrices and return result.

Definition at line 133 of file chi_math_02_matrix_operations.cc.

◆ MatMul() [3/3]

VecDbl chi_math::MatMul ( const MatDbl A,
const VecDbl x 
)

Multiply matrix with a vector and return resulting vector

Definition at line 113 of file chi_math_02_matrix_operations.cc.

◆ MatSubtract()

MatDbl chi_math::MatSubtract ( const MatDbl A,
const MatDbl B 
)

Subtracts matrix A from B and returns the result.

Definition at line 185 of file chi_math_02_matrix_operations.cc.

◆ NewtonIteration()

VecDbl chi_math::NewtonIteration ( const NonLinearFunction non_linear_function,
const VecDbl x_0,
unsigned int  max_iters,
double  epsilon,
bool  verbose = false 
)

Newton iteration.

Definition at line 9 of file serial_newton_iteration.cc.

◆ OmegaToPhiThetaSafe()

std::pair< double, double > chi_math::OmegaToPhiThetaSafe ( const chi_mesh::Vector3 omega)

Determines the azimuthal- and polar-angle associated with the given direction vector. Returns a pair = [azimuthal-angle,polar-angle].

Definition at line 18 of file chi_math_01_utility.cc.

◆ operator+()

VecDbl chi_math::operator+ ( const VecDbl a,
const VecDbl b 
)

Adds two vectors component-wise.

Definition at line 144 of file chi_math_03_vector_operations.cc.

◆ operator-()

VecDbl chi_math::operator- ( const VecDbl a,
const VecDbl b 
)

Subtracts two vectors component-wise.

Definition at line 156 of file chi_math_03_vector_operations.cc.

◆ PowerIteration()

double chi_math::PowerIteration ( const MatDbl A,
VecDbl e_vec,
int  max_it = 2000,
double  tol = 1.0e-13 
)

Performs power iteration to obtain the fundamental eigen mode. The eigen-value of the fundamental mode is return whilst the eigen-vector is return via reference.

Definition at line 454 of file chi_math_02_matrix_operations.cc.

◆ PreconditionerApplication() [1/2]

template<>
int chi_math::PreconditionerApplication ( PC  pc,
Vec  vector,
Vec  action 
)

Definition at line 11 of file preconditioner_apply.cc.

◆ PreconditionerApplication() [2/2]

template<class PCType , class VecType >
int chi_math::PreconditionerApplication ( PCType  pc,
VecType  vector,
VecType  action 
)

◆ PrintMatrix()

void chi_math::PrintMatrix ( const MatDbl A)

Prints the contents of a matrix.

Definition at line 6 of file chi_math_02_matrix_operations.cc.

◆ PrintVector()

void chi_math::PrintVector ( const VecDbl x)

Prints the Vector.

Definition at line 6 of file chi_math_03_vector_operations.cc.

◆ Range()

template<typename T , typename D = int>
std::vector< T > chi_math::Range ( start,
end,
delta = 1 
)

Returns a range of number according to the logic of the parameters.

Parameters
startFirst number in the sequence.
endTermination criteria. If the delta is positive then the sequence will terminate if i>=end, otherwise if the delta is negative the sequence will terminate if i<=end
deltaCannot be 0. Default 1. Can be negative.

Definition at line 18 of file chi_math_range.h.

◆ RegisterChiObject() [1/5]

chi_math::RegisterChiObject ( chi_math  ,
CrankNicolsonTimeIntegration   
)

◆ RegisterChiObject() [2/5]

chi_math::RegisterChiObject ( chi_math  ,
ImplicitEulerTimeIntegration   
)

◆ RegisterChiObject() [3/5]

chi_math::RegisterChiObject ( chi_math  ,
QuadratureGaussChebyshev   
)

◆ RegisterChiObject() [4/5]

chi_math::RegisterChiObject ( chi_math  ,
QuadratureGaussLegendre   
)

◆ RegisterChiObject() [5/5]

chi_math::RegisterChiObject ( chi_math  ,
ThetaSchemeTimeIntegration   
)

◆ RegisterChiObjectParametersOnly()

chi_math::RegisterChiObjectParametersOnly ( chi_math  ,
NonLinearSolverOptions   
)

◆ RegisterWrapperFunction()

chi_math::RegisterWrapperFunction ( chi_math  ,
Get1DQuadratureData  ,
GetSyntax_Get1DQuadratureData  ,
Get1DQuadratureData   
)

◆ SampleCDF()

int chi_math::SampleCDF ( double  x,
std::vector< double >  cdf_bin 
)

Sample a Cumulative Distribution Function (CDF) given a probability.

The supplied vector should contain the upper bin boundary for each bin and will return the bin associated with the bin that brackets the supplied probability.

Example: Suppose we sample bins 0-9. Suppose also that the probalities for each bin is as follows:

  • 0.1 bin 0
  • 0.1 bin 1
  • 0.5 bin 5
  • 0.3 bin 8

The CDF for this probability distribution will look like this

  • bin 0 = 0.1
  • bin 1 = 0.2
  • bin 2 = 0.2
  • bin 3 = 0.2
  • bin 4 = 0.2
  • bin 5 = 0.7
  • bin 6 = 0.7
  • bin 7 = 0.7
  • bin 8 = 1.0
  • bin 9 = 1.0

Supplying a random number between 0 and 1 should indicate sampling one of the bins 0,1,5 or 8. The most inefficient way to do this is to linearly loop through the cdf and check $ cdf_{i-1} \ge \theta < cdf_i $. An optimized version of this sampling would be to perform a recursive block search which starts with a course view of the cdf and then gradually refines the view until the final linear search can be performed.

Definition at line 272 of file cdfsampler.cc.

◆ Scale() [1/2]

void chi_math::Scale ( MatDbl A,
const double &  val 
)

Scales the matrix by a constant value.

Definition at line 27 of file chi_math_02_matrix_operations.cc.

◆ Scale() [2/2]

void chi_math::Scale ( VecDbl x,
const double &  val 
)

Scales a vector in place by constant.

Definition at line 15 of file chi_math_03_vector_operations.cc.

◆ Set() [1/2]

void chi_math::Set ( MatDbl A,
const double &  val 
)

Sets all the entries of the matrix to a constant value.

Definition at line 36 of file chi_math_02_matrix_operations.cc.

◆ Set() [2/2]

void chi_math::Set ( VecDbl x,
const double &  val 
)

Sets a constant value to a vector.

Definition at line 23 of file chi_math_03_vector_operations.cc.

◆ SteppingMethodFromString()

SteppingMethod chi_math::SteppingMethodFromString ( const std::string &  name)

◆ SteppingMethodStringName()

std::string chi_math::SteppingMethodStringName ( SteppingMethod  method)

Returns the string name of a time stepping method.

Definition at line 11 of file chi_math_time_stepping.cc.

◆ SubMatrix()

MatDbl chi_math::SubMatrix ( const size_t  r,
const size_t  c,
const MatDbl A 
)

Returns a sub-matrix.

Definition at line 254 of file chi_math_02_matrix_operations.cc.

◆ SwapColumn()

void chi_math::SwapColumn ( size_t  c1,
size_t  c2,
MatDbl A 
)

Swaps two columns of a matrix.

Definition at line 81 of file chi_math_02_matrix_operations.cc.

◆ SwapRow()

void chi_math::SwapRow ( size_t  r1,
size_t  r2,
MatDbl A 
)

Swaps two rows of a matrix.

Definition at line 63 of file chi_math_02_matrix_operations.cc.

◆ Transpose()

MatDbl chi_math::Transpose ( const MatDbl A)

Returns the transpose of a matrix.

Definition at line 45 of file chi_math_02_matrix_operations.cc.

◆ Vec1Norm()

double chi_math::Vec1Norm ( const VecDbl x)

Returns the 1-norm. Also known as the Taxicab or Manhattan norm.

\[ \|\boldsymbol{x}\|_{1}=\sum_{i=1}^{n}\left|x_{i}\right| \]

Definition at line 73 of file chi_math_03_vector_operations.cc.

◆ Vec2Norm()

double chi_math::Vec2Norm ( const VecDbl x)

Returns the 2-norm. Also known as the Euclidian or Frobenius norm.

\[ \|\boldsymbol{x}\|_{2}=\sqrt{x_{1}^{2}+\cdots+x_{n}^{2}} \]

Definition at line 93 of file chi_math_03_vector_operations.cc.

◆ Vec2NormMPI()

double chi_math::Vec2NormMPI ( const VecDbl x,
MPI_Comm  comm 
)

Computes a global L2-norm

Definition at line 9 of file chi_math_mpi_03_vecops.cc.

◆ VecInfinityNorm()

double chi_math::VecInfinityNorm ( const VecDbl x)

Returns the infinity-norm.

\[ \|\mathbf{x}\|_{\infty}=\max \left(\left|x_{1}\right|, \ldots,\left|x_{n}\right|\right) \]

Definition at line 112 of file chi_math_03_vector_operations.cc.

◆ VecMul()

VecDbl chi_math::VecMul ( const VecDbl x,
const double &  val 
)

Multiplies the vector with a constant and returns result.

Definition at line 54 of file chi_math_03_vector_operations.cc.

◆ VecPNorm()

double chi_math::VecPNorm ( const VecDbl x,
const double &  p 
)

Returns the p-norm.

\[ \|\mathbf{x}\|_{p}=\left(\sum_{i=1}^{n}\left|x_{i}\right|^{p}\right)^{1 / p} \]

Definition at line 131 of file chi_math_03_vector_operations.cc.

◆ Ylm()

double chi_math::Ylm ( unsigned int  ell,
int  m,
double  varphi,
double  theta 
)

Implementation of the tesseral spherical harmonics.

This code has a whitepaper associated with it Spherical Harmonics

Definition at line 12 of file spherical_harmonics.cc.