avsEigenSupport

Functions

void eigenMatrixXd2CArray(Eigen::MatrixXd inMat, double *outArray)

General conversion between any Eigen matrix and output array.

This function provides a general conversion between an Eigen matrix and an output C array. Note that this routine would convert an inbound type to a MatrixXd and then transpose the matrix which would be inefficient in a lot of cases.

Parameters:
  • inMat – The source Eigen matrix that we are converting

  • outArray – The destination array (sized by the user!) we copy into

Returns:

void

void eigenMatrixXi2CArray(Eigen::MatrixXi inMat, int *outArray)

General conversion between any Eigen matrix and output array.

This function provides a general conversion between an Eigen matrix and an output C array. Note that this routine would convert an inbound type to a MatrixXd and then transpose the matrix which would be inefficient in a lot of cases.

Parameters:
  • inMat – The source Eigen matrix that we are converting

  • outArray – The destination array (sized by the user!) we copy into

Returns:

void

void eigenVector3d2CArray(Eigen::Vector3d &inMat, double *outArray)

Rapid conversion between 3-vector and output array.

This function provides a direct conversion between a 3-vector and an output C array. We are providing this function to save on the inline conversion and the transpose that would have been performed by the general case.

Parameters:
  • inMat – The source Eigen matrix that we are converting

  • outArray – The destination array we copy into

Returns:

void

void eigenMRPd2CArray(Eigen::Vector3d &inMat, double *outArray)

Rapid conversion between MRP and output array.

This function provides a direct conversion between an MRP and an output C array. We are providing this function to save on the inline conversion and the transpose that would have been performed by the general case.

Parameters:
  • inMat – The source Eigen MRP that we are converting

  • outArray – The destination array we copy into

Returns:

void

void eigenMatrix3d2CArray(Eigen::Matrix3d &inMat, double *outArray)

Rapid conversion between 3x3 matrix and output array.

This function provides a direct conversion between a 3x3 matrix and an output C array. We are providing this function to save on the inline conversion that would have been performed by the general case.

Parameters:
  • inMat – The source Eigen matrix that we are converting

  • outArray – The destination array we copy into

Returns:

void

Eigen::MatrixXd cArray2EigenMatrixXd(double *inArray, int nRows, int nCols)

General conversion between a C array and an Eigen matrix.

This function performs the general conversion between an input C array and an Eigen matrix. Note that to use this function the user MUST size the Eigen matrix ahead of time so that the internal map call has enough information to ingest the C array.

Parameters:
  • inArray – The input array (row-major)

  • nRows

  • nCols

Returns:

Eigen::MatrixXd

Eigen::Vector3d cArray2EigenVector3d(double *inArray)

Specific conversion between a C array and an Eigen 3-vector.

This function performs the conversion between an input C array 3-vector and an output Eigen vector3d. This function is provided in order to save an unnecessary conversion between types.

Parameters:

inArray – The input array (row-major)

Returns:

Eigen::Vector3d

Eigen::MRPd cArray2EigenMRPd(double *inArray)

Specific conversion between a C array and an Eigen MRPs.

This function performs the conversion between an input C array 3-vector and an output Eigen MRPd. This function is provided in order to save an unnecessary conversion between types.

Parameters:

inArray – The input array (row-major)

Returns:

Eigen::MRPd

Eigen::Matrix3d cArray2EigenMatrix3d(double *inArray)

Specfici conversion between a C array and an Eigen 3x3 matrix.

This function performs the conversion between an input C array 3x3-matrix and an output Eigen vector3d. This function is provided in order to save an unnecessary conversion between types.

Parameters:

inArray – The input array (row-major)

Returns:

Eigen::Matrix3d

Eigen::Matrix3d c2DArray2EigenMatrix3d(double in2DArray[3][3])

Specfici conversion between a C 2D array and an Eigen 3x3 matrix.

This function performs the conversion between an input C 3x3 2D-array and an output Eigen vector3d. This function is provided in order to save an unnecessary conversion between types

Parameters:

in2DArray – The input 2D-array

Returns:

Eigen::Matrix3d

Eigen::Matrix3d eigenM1(double angle)

returns the first axis DCM with the input angle

This function returns the Eigen DCM that corresponds to a 1-axis rotation by the angle theta. The DCM is the positive theta rotation from the original frame to the final frame.

Parameters:

angle – The input rotation angle

Returns:

Eigen::Matrix3d

Eigen::Matrix3d eigenM2(double angle)

returns the second axis DCM with the input angle

This function returns the Eigen DCM that corresponds to a 2-axis rotation by the angle theta. The DCM is the positive theta rotation from the original frame to the final frame.

Parameters:

angle – The input rotation angle

Returns:

Eigen::Matrix3d

Eigen::Matrix3d eigenM3(double angle)

returns the third axis DCM with the input angle

This function returns the Eigen DCM that corresponds to a 3-axis rotation by the angle theta. The DCM is the positive theta rotation from the original frame to the final frame.

Parameters:

angle – The input rotation angle

Returns:

Eigen::Matrix3d

Eigen::Matrix3d eigenTilde(Eigen::Vector3d vec)

returns the tilde matrix representation of a vector (equivalent to a vector cross product)

This function returns the tilde matrix version of a vector. The tilde matrix is the matrixi equivalent of a vector cross product, where [tilde_a] b == a x b

Parameters:

vec – The input vector

Returns:

Eigen::Matrix3d

Eigen::Vector3d eigenMRPd2Vector3d(Eigen::MRPd vec)

converts MRPd to an Vector3d variable

This function converts the Eigen MRPd to Vector3d

Parameters:

mrp – The input Vector3d variable

Returns:

Eigen::Vector3d

Eigen::MRPd eigenC2MRP(Eigen::Matrix3d)

maps the DCM to MRPs using Eigen variables

This function converts the Eigen DCM to an Eigen MRPd

Parameters:

dcm_Eigen – The input DCM

Returns:

Eigen::MRPd

double newtonRaphsonSolve(const double &initialEstimate, const double &accuracy, const std::function<double(double)> &f, const std::function<double(double)> &fPrime)

solves for the zero of the provided function

This function solves for the zero of the passed function using the Newton Raphson Method

Parameters:
  • initialEstimate – The initial value to use for newton-raphson

  • accuracy – The desired upper bound for the error

  • f – Function to find the zero of

  • fPrime – First derivative of the function

Returns:

double