|
Celeritas 0.7+d9d378c
|
Math functions using celeritas::Span. More...
#include <cstddef>#include "corecel/cont/Span.hh"#include "ArrayUtils.hh"#include "detail/SpanUtilsImpl.hh"Functions | |
| template<class T , std::size_t N> | |
| void | celeritas::copy (Span< T const, N > src, Span< T, N > dst) |
| Copy all elements from src to dst. | |
| template<class T , std::size_t N> | |
| void | celeritas::fill (T value, Span< T, N > dst) |
| Fill all elements of dst with a constant value. | |
| template<class T , std::size_t N> | |
| void | celeritas::axpy (T a, Span< T const, N > x, Span< T, N > y) |
| Increment a vector span by another vector span multiplied by a scalar. | |
| template<class T , std::size_t N> | |
| T | celeritas::dot_product (Span< T const, N > x, Span< T const, N > y) |
| Dot product of two vector spans. | |
| template<class T > | |
| void | celeritas::cross_product (Span< T const, 3 > x, Span< T const, 3 > y, Span< T, 3 > dst) |
| Cross product of two space vector spans, written into dst. | |
| template<class T , std::size_t N> | |
| T | celeritas::norm (Span< T const, N > v) |
| Calculate the Euclidean (2) norm of a vector span. | |
| template<class T , std::size_t N> | |
| void | celeritas::make_unit_vector (Span< T const, N > v, Span< T, N > dst) |
| Write a unit-magnitude version of v into dst. | |
| template<class T , std::size_t N> | |
| void | celeritas::make_orthogonal (Span< T const, N > x, Span< T const, N > y, Span< T, N > dst) |
| Write the component of x orthogonal to the unit vector y into dst. | |
| template<class T , std::size_t N> | |
| bool | celeritas::is_soft_orthogonal (Span< T const, N > x, Span< T const, N > y) |
| Check whether two unit vector spans are approximately orthogonal. | |
| template<class T , std::size_t N> | |
| bool | celeritas::is_soft_collinear (Span< T const, N > x, Span< T const, N > y) |
| Check whether two unit vector spans are approximately collinear. | |
| template<class T , std::size_t N> | |
| T | celeritas::distance (Span< T const, N > x, Span< T const, N > y) |
| Calculate the Euclidean (2) distance between two point spans. | |
| template<class T > | |
| void | celeritas::from_spherical (T costheta, T phi, Span< T, 3 > dst) |
| Write a Cartesian unit vector from spherical coordinates into dst. | |
| template<class T > | |
| void | celeritas::rotate (Span< T const, 3 > dir, Span< T const, 3 > rot, Span< T, 3 > dst) |
| Rotate a direction span by the rotation defined by rot, writing to dst. | |
Math functions using celeritas::Span.
|
inline |
Increment a vector span by another vector span multiplied by a scalar.
\[ y \gets \alpha x + y \]
|
inline |
Copy all elements from src to dst.
The current implementation does not take advantage of the lack of overlap.
|
inline |
Cross product of two space vector spans, written into dst.
Write a Cartesian unit vector from spherical coordinates into dst.
Theta is the angle between the z axis and the outgoing vector, and phi is the angle between the x axis and the projection onto the x-y plane.
|
inline |
Check whether two unit vector spans are approximately collinear.
|
inline |
Write the component of x orthogonal to the unit vector y into dst.
In this implementation, y must be normalized, and the result is not normalized.
\[ \mathbf{x}' \gets \mathbf{x} - (\mathbf{x} \cdot \mathbf{y}) \mathbf{y} \, , \quad \|\mathbf{y}\| = 1 \]
|
inline |
Write a unit-magnitude version of v into dst.
|
inline |
Rotate a direction span by the rotation defined by rot, writing to dst.