algebra.h File Reference IntroductionHeader of the lineal algebra routines used in the CuikSuite. This file includes high level routines which require LU or QR decompositions, and similar procedures.
Definition in file algebra.h.
Macro Definition Documentation◆ DAMPED_NEWTON
If 1, the Newton correction step is damped: it is multiplied by a factor alpha in [0,1] to reduce overshooting and to improve converged. The alpha factor is initialized to DN_F and increased towards DN_MF using the DN_W weight at each step. Only experimental. Not actually used. ◆ DN_F
◆ DN_MF
◆ DN_W
Function Documentation◆ MatrixDeterminantSgn()
Sign of the determinant of a squared matrix. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Referenced by GetChartDegree(). ◆ MatrixDeterminant()
Determinant of a squared matrix. This function must be used with caution (only for small matrices) since the determinant can easily overflow. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Referenced by CompareTangentSpaces(). ◆ MatrixExponential()
Computes the exponential of a matrix (at a given time step). For a constant matrix A, the error of this function grows with the time 't'. Use with caution for large t's (i.e., 5, 10, is already large).
Definition at line 1583 of file algebra.c. References dgpadm_(), IdentityMatrix(), and NEW. Referenced by dGt(), and LQRPolicy(). ◆ MatrixExponentialVector()
Computes the product of the exponential of a matrix with a vector at a given time step. For a constant matrix A, the error of this function grows with the time 't'. Use with caution for large t's because the error in this case scales much faster than when using MatrixExponential. In this case the error can be significative just for t=1. If accuracy is required (over speed) just use MatrixExponential and multiply the result by vector v.
◆ FindRank()
Determines the rank of a matrix, i.e. the dimension of the space spanned by the rows/column of the matrix. For a given problem, the number of variables minus the rank of the Jacobian gives the dimensionality of the solution space, assuming that the Jacobian is evaluated in a regular point. The dimensionality of the solution space is the same as that of its tangent space. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Definition at line 1724 of file algebra.c. References AnalyzeKernel(), FALSE, and TRUE. Referenced by ManifoldDimension(). ◆ FindKernel()
Defines a basis of the null space of a matrix. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Definition at line 1738 of file algebra.c. References AnalyzeKernel(), FALSE, and TRUE. Referenced by FindRightNullVector(), and RefineSingularPoint(). ◆ FindKernelAndRank()
Defines a basis of the null space of a matrix, without any clue about the dimension of this null space. The returne rank is actually the number of variables minus the dimension of such space. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Definition at line 1752 of file algebra.c. References AnalyzeKernel(), FALSE, and TRUE. ◆ FindKernelAndIndependentRows()
Defines a basis of the null space of a matrix and determines a subset of the rows of the matrix that are independent. This is useful because in our case most (all?) the matrices have redundancy (i.e., rows that are linearly dependent on other rows). However, for some purposes we need to determine a subset of the rows that are linearly independent. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Definition at line 1765 of file algebra.c. References AnalyzeKernel(), FALSE, and TRUE. Referenced by ComputeJacobianKernelBasis(). ◆ FindIndependentRows()
Determines a subset of the rows of a matrix that are independent. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Definition at line 1779 of file algebra.c. References AnalyzeKernel(), FALSE, and TRUE. Referenced by GetPositionJacobian(). ◆ InvertMatrix()
Computes the inverse of a matrix.
◆ InitNewton()
Initializes the structure to be used in a iterative Newton process. Note that the dimensionality of the solution set can be deduced at each Newton step (using the QR with pivoting) but it is more efficient if we know it beforehand.
Referenced by CuikNewtonInBox(), CuikNewtonSimp(), Newton2ManifoldPlane(), and RefineSingularPoint(). ◆ GetNewtonMatrixBuffer()
Buffer to store the Newton matrix. This buffer must be accessed using the RC2INDEX macro since the matrix can be stored row major or column major depending on the underlying lineal algebra library being used.
Definition at line 1794 of file algebra.c. Referenced by CuikNewtonInBox(), CuikNewtonSimp(), Newton2ManifoldPlane(), and RefineSingularPoint(). ◆ GetNewtonRHBuffer()
Buffer to store the Newton RH.
Definition at line 1799 of file algebra.c. Referenced by CuikNewtonInBox(), CuikNewtonSimp(), Newton2ManifoldPlane(), and RefineSingularPoint(). ◆ NewtonSetMatrix()
Sets one element of the matrix to be used in one Newton step. This matrix is typically initilized externally, but here we provide a mehtod to set it.
Definition at line 1804 of file algebra.c. References RC2INDEX. Referenced by CuikNewtonInBox(). ◆ NewtonSetRH()
Sets one element of the vector to be used in one Newton step. This vector is typically initilized externally, but here we provide a mehtod to set it.
Definition at line 1809 of file algebra.c. Referenced by CuikNewtonInBox(). ◆ NewtonStep()
Computes and applies the correction in one step of a Newton iteration. This function allows to easily apply Newton processes just defining the input data (A, b), setting the initial value for x, and allocating space for the process. The space for the process is not allocated inside this function to avoid continous malloc/free calls since this function is typically used many times in a row. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Referenced by CuikNewtonInBox(), CuikNewtonSimp(), Newton2ManifoldPlane(), and RefineSingularPoint(). ◆ DeleteNewton()
Releases the memory allocated for a Newton step.
Referenced by CuikNewtonInBox(), CuikNewtonSimp(), Newton2ManifoldPlane(), and RefineSingularPoint(). ◆ InitBroyden()
Initializes the structure to be used in a iterative Broyden process. Note that the dimensionality of the solution set can be deduced at each Broyden step (using the QR with pivoting) but it is more efficient if we know it beforehand.
Definition at line 1839 of file algebra.c. References Error(), GetLSMatrixBuffer(), GetLSRHBuffer(), GetLSSolutionBuffer(), InitLS(), and NEW. Referenced by InitDynamicSpace(). ◆ ResetBroyden()
Resets the Broyden structure (the internal iteration) without releasing memory.
Definition at line 1862 of file algebra.c. Referenced by NextDynamicState(). ◆ GetBroydenMatrixBuffer()
Buffer to store the Broyden matrix. This buffer must be accessed using the RC2INDEX macro since the matrix can be stored row major or column major depending on the underlying lineal algebra library being used.
Definition at line 1867 of file algebra.c. References Error(). Referenced by InitDynamicSpace(). ◆ GetBroydenRHBuffer()
Buffer to store the Broyden RH.
Definition at line 1874 of file algebra.c. Referenced by InitDynamicSpace(). ◆ BroydenStep()
Computes and applies the correction in one step of a Broyden iteration. Calls the Newton iteration with the current Jacobian matrix and updates this matrix. The result is stored in the right-hand side buffer.
Definition at line 1879 of file algebra.c. References LSSolve(), NEW, Norm(), PI2PI, PrintMatrix(), PrintVector(), and TOPOLOGY_S. Referenced by NextDynamicState(). ◆ BroydenUpdateJacobian()
Applies the Broyden's Jacobian update procedure. This can only be used after using BroydenStep at least once.
Definition at line 1952 of file algebra.c. References AccumulateVector(), DifferenceVector(), GeneralDotProduct(), MatrixVectorProduct(), and RankOneUpdate(). Referenced by NextDynamicState(). ◆ DeleteBroyden()
Releases the memory allocated for a Broyden step.
Definition at line 1987 of file algebra.c. References DeleteLS(). Referenced by DeleteDynamicSpace(). ◆ InitLS()
Initializes the structure to be used when solving a linear system.
Referenced by Chart2Manifold(), InitBroyden(), InitDynamicSpace(), and SetLinearizedDynamics(). ◆ GetLSMatrixBuffer()
Buffer to store the A matrix. This buffer must be accessed using the RC2INDEX macro since the matrix can be stored row major or column major depending on the underlying lineal algebra library being used.
Definition at line 1814 of file algebra.c. Referenced by Chart2Manifold(), InitBroyden(), InitDynamicSpace(), and SetLinearizedDynamics(). ◆ GetLSRHBuffer()
Buffer to store the linear system RH.
Definition at line 1819 of file algebra.c. Referenced by Chart2Manifold(), InitBroyden(), InitDynamicSpace(), and SetLinearizedDynamics(). ◆ GetLSSolutionBuffer()
Buffer to store the linear sytem solution. Note that this maybe the same as the buffer for the rhs.
Definition at line 1824 of file algebra.c. Referenced by Chart2Manifold(), ComputeAcceleration(), InitBroyden(), InitDynamicSpace(), and SetLinearizedDynamics(). ◆ LSSetMatrix()
◆ LSSetRH()
◆ LSSolve()
Computes the solution of a linear system. IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Referenced by BroydenStep(), Chart2Manifold(), ComputeAcceleration(), ComputeInverseDynamics(), and SetLinearizedDynamics(). ◆ LSSolveCond()
Computes the solution of a linear system only and returns the the reciprocal of the condition number of the system matrix. This provides information about the confidence in the solution (solutions with low condition number are not reliable). Since we compute 1 / ( norm(A) * norm(inv(A)) ), we only implement this option for squared systems (otherwise inv(A) would not be defined). IMPORTANT: The intput matrix may be modified inside this function. The caller CAN NOT assume that it remains unchanged.
Referenced by LQRComputePolicy(), and LQRComputePolicy_t(). ◆ DeleteLS()
Releases the memory allocated for a linear system.
Referenced by Chart2Manifold(), DeleteBroyden(), DeleteDynamicSpace(), and SetLinearizedDynamics(). |
Follow us!