Implementation of core functions.
More...
#include <sas_core/sas_core.hpp>
#include <mutex>
|
| VectorXd | sas::concatenate (const VectorXd &a, const VectorXd &b) |
| | Concatenate two vectors by appending b after a.
|
| VectorXd | sas::concatenate (const std::vector< VectorXd > &as) |
| | Concatenate a list of vectors into a single vector.
|
| MatrixXd | sas::vstack (const MatrixXd &A, const MatrixXd &B) |
| | Stack two matrices vertically (A above B).
|
| MatrixXd | sas::block_diag (const std::vector< MatrixXd > &As) |
| | Create a block-diagonal matrix from a list of matrices.
|
| std::vector< VectorXd > | sas::split (const VectorXd &a, const std::vector< int > &ns) |
| | Split a vector into pieces with sizes specified by ns.
|
Implementation of core functions.
◆ block_diag()
| MatrixXd sas::block_diag |
( |
const std::vector< MatrixXd > & | As | ) |
|
Create a block-diagonal matrix from a list of matrices.
block_diag creates a block diagonal matrix using an input of std::vector<MatrixXd>. e.g. if As= [A, B, C], then block_diag(As) = |A 0 0| |0 B 0| |0 0 C|
- Parameters
-
| As | Vector of matrices to place on the block diagonal. |
- Returns
- Block-diagonal matrix containing the input matrices along its diagonal.
- Parameters
-
| As | the std::vector<MatrixXd> contaning the matrix to form the block diagonal matrix. |
- Returns
- the block diagonal matrix.
◆ concatenate() [1/2]
| VectorXd sas::concatenate |
( |
const std::vector< VectorXd > & | as | ) |
|
Concatenate a list of vectors into a single vector.
concatenate a std::vector of VectorXd.
- Parameters
-
| as | Vector of vectors to concatenate in order. |
- Returns
- Concatenated vector containing the elements of each input vector in order.
- Parameters
-
| a | an std::vector of VectorXd. |
- Returns
- the result of the concatenated vectors.
◆ concatenate() [2/2]
| VectorXd sas::concatenate |
( |
const VectorXd & | a, |
|
|
const VectorXd & | b ) |
Concatenate two vectors by appending b after a.
concatenate two VectorXd.
- Parameters
-
| a | First vector. |
| b | Second vector. |
- Returns
- Concatenated vector containing all elements of a followed by b.
- Parameters
-
| a | a VectorXd. |
| b | a VectorXd. |
- Returns
- the result of the concatenated vectors.
◆ split()
| std::vector< VectorXd > sas::split |
( |
const VectorXd & | a, |
|
|
const std::vector< int > & | ns ) |
Split a vector into pieces with sizes specified by ns.
split splits the input VectorXd as into a set of subvectors defined by ns.
- Parameters
-
| a | Vector to split. |
| ns | Sizes of each piece; their sum must equal a.size(). |
- Returns
- Vector containing the split VectorXd pieces.
- Parameters
-
| as | the VectorXd to be split. |
| ns | the sizes of the subvectors. |
- Returns
- an std::vector<VectorXd> of the splitted vectors.
◆ vstack()
| MatrixXd sas::vstack |
( |
const MatrixXd & | A, |
|
|
const MatrixXd & | B ) |
Stack two matrices vertically (A above B).
vstack vertically (row-wise) stack two MatrixXd.
- Parameters
-
| A | Top matrix. |
| B | Bottom matrix. |
- Returns
- Matrix formed by stacking A on top of B. Columns must match.
- Exceptions
-
| std::range_error | if A and B have different numbers of columns. |
- Parameters
-
| A | the first MatrixXd. |
| B | the second MatrixXd. |
- Returns
- the vstacked MatrixXd.
- Exceptions
-
| a | std::range_error if A and B don't have the same number of columns. |
- Note
- returns an empty matrix if both arguments are empty or return the other argument of only one of the arguments is empty.