BSpline Finite Element Exterior Calculus
Loading...
Searching...
No Matches
m_common::sort Interface Reference

Sort an array of integers using the quicksort algorithm. More...

Public Member Functions

 sort_int
 
 sort_real
 

Detailed Description

Sort an array of integers using the quicksort algorithm.

Parameters
[in,out]arrayThe array of integers to be sorted
[in]inverse_(optional)_ If true, sort in descending order; otherwise, ascending order (default: false)

Sort an array of real numbers using the quicksort algorithm

Parameters
[in,out]arrayThe array of real numbers to be sorted
[in]inverse_(optional)_ If true, sort in descending order; otherwise, ascending order (default: false)
[in]sort_fun_(optional)_ A function to determine the sorting order

Compute the union of two sets of integers

Parameters
[out]unionThe resulting union of the two sets
[in]set1The first set of integers
[in]set2The second set of integers

Compute the prime factorization of an integer

Parameters
[in]nThe integer to factorize
[out]factorsArray containing the prime factors (with repetition)

Split an integer into two factors that are as close as possible

Given an integer N, find n1 and n2 such that N = n1 * n2 and |n1 - n2| is minimized. The result satisfies n1 <= n2.

Parameters
[in]nThe integer to split
[out]n1The smaller factor
[out]n2The larger factor

Split an integer into three factors that are as close as possible

Given an integer N, find n1, n2, and n3 such that N = n1 * n2 * n3 and the factors are as balanced as possible. The result satisfies n1 <= n2 <= n3.

Parameters
[in]nThe integer to split
[out]n1The smallest factor
[out]n2The middle factor
[out]n3The largest factor

Find a root of a function using Brent's method

Parameters
[in]funThe function for which to find a root
[in]xa_inThe lower bound of the interval
[in]xb_inThe upper bound of the interval
[in]x_tolThe tolerance for convergence
[in]max_iterThe maximum number of iterations to perform
[in]fa_in_(optional)_ The value of the function at xa_in (if not provided, it will be computed)
[in]fb_in_(optional)_ The value of the function at xb_in (if not provided, it will be computed)
[out]success_(optional)_ A logical flag indicating whether the method converged successfully
Returns
The estimated root of the function

Generic interface for sorting arrays


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