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.

Return

void

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

  • outArray: The destination array (sized by the user!) we copy in to

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.

Return

void

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

  • outArray: The destination array (sized by the user!) we copy in to

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.

Return

void

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

  • outArray: The destination array (sized by the user!) we copy in to

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.

Return

Eigen::MatrixXd

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

  • outMat: The output Eigen matrix

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

Return

Eigen::Vector3d

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

  • outMat: The output Eigen matrix

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

Return

Eigen::Matrix3d

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

  • outMat: The output Eigen matrix

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.

Return

Eigen::Matrix3d

Parameters
  • angle: The input rotation angle

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.

Return

Eigen::Matrix3d

Parameters
  • angle: The input rotation angle

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.

Return

Eigen::Matrix3d

Parameters
  • angle: The input rotation angle

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

Return

Eigen::Matrix3d

Parameters
  • vec: The input vector

double newtonRaphsonSolve(double initialEstimate, double accuracy, std::function<double(double)> &f, 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

Return

double

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