Tomographer  v1.0a
Tomographer C++ Framework Documentation
Tomographer::SphCoords Namespace Reference

Functions

template<typename Der1 , typename Der2 >
void cart_to_sph (Eigen::MatrixBase< Der2 > &rtheta, const Eigen::MatrixBase< Der1 > &cart)
 Convert Cartesian coordinates to spherical coordinates in N dimensions. More...
 
template<typename Der1 , typename Der2 >
void sphsurf_to_cart (Eigen::MatrixBase< Der2 > &cart, const Eigen::MatrixBase< Der1 > &theta, const typename Eigen::MatrixBase< Der1 >::Scalar R=1.0)
 Convert spherical angles to Cartesian coordinates in N dimensions. More...
 
template<typename Der1 , typename Der2 >
void sph_to_cart (Eigen::MatrixBase< Der2 > &cart, const Eigen::MatrixBase< Der1 > &rtheta)
 Convert spherical coordinates to Cartesian coordinates in N dimensions. More...
 
template<typename Der1 >
Eigen::MatrixBase< Der1 >::Scalar cart_to_sph_jacobian (const Eigen::MatrixBase< Der1 > &rtheta)
 Volume element of the hypersphere. More...
 
template<typename Der1 >
Eigen::MatrixBase< Der1 >::Scalar surf_sph_jacobian (const Eigen::MatrixBase< Der1 > &theta)
 Surface element of the hypersphere. More...
 
template<typename Der1 , typename Der2 >
void sphsurf_diffjac (Eigen::ArrayBase< Der1 > &dxdtheta, const Eigen::MatrixBase< Der2 > &theta)
 The differential of passing from spherical to cartesian coordinates on the sphere of unit radius. More...
 
template<typename Der1 , typename Der2 >
void sphsurf_diffjac2 (Eigen::ArrayBase< Der1 > &ddxddtheta, const Eigen::MatrixBase< Der2 > &theta)
 The second order differential of passing from spherical to cartesian coordinates on the sphere of unit radius. More...
 

Detailed Description

Utilities for hyperspherical coordinates. See also the corresponding theory page Hyperspherical Coordinates.

Function Documentation

template<typename Der1 , typename Der2 >
void Tomographer::SphCoords::cart_to_sph ( Eigen::MatrixBase< Der2 > &  rtheta,
const Eigen::MatrixBase< Der1 > &  cart 
)

Convert Cartesian coordinates to spherical coordinates in N dimensions.

See Hyperspherical Coordinates for information about the conventions and ranges of the coordinates.

Parameters
rtheta(output), vector of N entries, will store the \( r\) and \(\theta_i\) values corresponding to the spherical coordinates representation of the point represented by cart. The value rtheta(0) is the \(r\) coordinate and rtheta(1),..,rtheta(N-1) are the angle coordinates, corresponding respectively to \(\theta_1\ldots\theta_{N-1}\). All \( \theta_i \) 's but the last range from \(0..\pi\), while \(\theta_{N-1}\) ranges from \(-\pi\) to \(+\pi\).
cartis a vector of N entries, corresponding to the cartesian coordinates of the point to transform.

Definition at line 64 of file sphcoords.h.

template<typename Der1 >
Eigen::MatrixBase<Der1>::Scalar Tomographer::SphCoords::cart_to_sph_jacobian ( const Eigen::MatrixBase< Der1 > &  rtheta)

Volume element of the hypersphere.

Calculates the volume element, or Jacobian, of the conversion from cartesian coordinates to spherical coordinates. More precisely, this function computes

\[ J = \left\vert\det \frac{\partial(x_i)}{\partial(r,\theta_j)}\right\vert = r^{N-1} \sin^{N-2}\left(\theta_1\right)\sin^{N-3}\left(\theta_2\right) \ldots\sin\left(\theta_{N-2}\right)\ , \]

where N is the dimension of the Euclidean space in which the N-1-sphere is embedded.

See Hyperspherical Coordinates for more info and conventions.

Definition at line 208 of file sphcoords.h.

template<typename Der1 , typename Der2 >
void Tomographer::SphCoords::sph_to_cart ( Eigen::MatrixBase< Der2 > &  cart,
const Eigen::MatrixBase< Der1 > &  rtheta 
)

Convert spherical coordinates to Cartesian coordinates in N dimensions.

See Hyperspherical Coordinates for information about the conventions and ranges of the coordinates.

Parameters
cart(output) is a vector of N entries, which will be set to the cartesian coordinates of the point represented by rtheta.
rthetavector of N entries which specifies the \(r\) and \(\theta_i\) spherical coordinates to transform. rtheta(0) is the \(r\) coordinate and rtheta(1),..,rtheta(N-1) are the angle coordinates, corresponding respectively to \(\theta_1\ldots\theta_{N-1}\).

Definition at line 174 of file sphcoords.h.

template<typename Der1 , typename Der2 >
void Tomographer::SphCoords::sphsurf_diffjac ( Eigen::ArrayBase< Der1 > &  dxdtheta,
const Eigen::MatrixBase< Der2 > &  theta 
)

The differential of passing from spherical to cartesian coordinates on the sphere of unit radius.

The input parameter theta is a list of spherical angles, with theta(i-1) (C/C++ offset) corresponding to \( \theta_i \). The coordinate \( r\) is set equal to one. The dimension N of the Euclidian space is given by the length of the theta vector plus one.

After this function returns, dxdtheta(k-1,i-1) (C/C++ offsets) is set to the value of

\[ \frac{\partial x_k}{\partial \theta_i} , \]

with k=1,...,N, and i=1,..,N-1.

Definition at line 274 of file sphcoords.h.

template<typename Der1 , typename Der2 >
void Tomographer::SphCoords::sphsurf_diffjac2 ( Eigen::ArrayBase< Der1 > &  ddxddtheta,
const Eigen::MatrixBase< Der2 > &  theta 
)

The second order differential of passing from spherical to cartesian coordinates on the sphere of unit radius.

The input parameter theta is a list of spherical angles, with theta(i-1) (C/C++ offset) corresponding to \( \theta_i \). The coordinate \( r\) is set equal to one. The dimension N of the Euclidian space is given by the length of the theta vector plus one.

After this function returns, ddxddtheta(k-1,(i-1)+(N-1)*(j-1)) (C/C++ offsets) is set to the value of

\[ \frac{\partial^2 x_k}{\partial \theta_i \partial \theta_j}\ , \]

with k = 1,...,N, and i,j = 1,..,N-1.

Definition at line 358 of file sphcoords.h.

template<typename Der1 , typename Der2 >
void Tomographer::SphCoords::sphsurf_to_cart ( Eigen::MatrixBase< Der2 > &  cart,
const Eigen::MatrixBase< Der1 > &  theta,
const typename Eigen::MatrixBase< Der1 >::Scalar  R = 1.0 
)
inline

Convert spherical angles to Cartesian coordinates in N dimensions.

See Hyperspherical Coordinates for information about the conventions and ranges of the coordinates.

This function behaves exactly like sph_to_cart(), but takes the theta arguments separately from the R argument. This is useful if you only have angle coordinates that parameterize a fixed-radius hypersphere.

Parameters
cart(output) is a vector of N entries, which will be set to the cartesian coordinates of the point represented by the spherical coordinates (R, theta).
thetavector of N-1 entries which specifies the \(\theta_i\) spherical coordinates to transform. The value theta(0) is \(\theta_1\), and so on.
Rthe radial coordinate part of the hyperspherical coordinates of the point to transform.

Definition at line 134 of file sphcoords.h.

template<typename Der1 >
Eigen::MatrixBase<Der1>::Scalar Tomographer::SphCoords::surf_sph_jacobian ( const Eigen::MatrixBase< Der1 > &  theta)

Surface element of the hypersphere.

Calculates the volume element, or Jacobian, of the conversion from cartesian coordinates to spherical coordinates on the surface of the hypersphere of fixed radius R=1. More precisely, this function computes

\[ \left\vert J\right\vert_{r=1} = \left\vert\det \frac{\partial(x_i)}{\partial(r,\theta_j)}\right\vert_{r=1} = \sin^{N-2}\left(\theta_1\right)\sin^{N-3}\left(\theta_2\right) \ldots\sin\left(\theta_{N-2}\right)\ , \]

where N is the dimension of the Euclidean space in which the N-1-sphere is embedded.

See Hyperspherical Coordinates for more info and conventions.

Parameters
thetais the vector of the N-1 spherical angles, \(\theta_1\ldots\theta_{N-1}\).

Definition at line 242 of file sphcoords.h.