Join matrices and vectors
Issue #186
duplicate
Hi,
I cannot find how to join several matrices or vectors into a new one.
My case is that I am programming a Newton-Raphson method and build the Jacobian, I need to create four sub-matrices (A, B, C, D) and then join them.
J = {{A, B}, {C, D}}
I also need to do this with vectors. Is this implemented?
Comments (2)
-
-
- changed status to duplicate
Duplicate of #149.
- Log in to comment
Hi Santiago!
Thanks for creating this issue. Blaze does not provide the syntax you suggest to join matrices or vectors. One of the reasons is that the elements in an
std::initializer_list
are copy-initialized, which in this case would result in a significant and unacceptable overhead. Instead you should use Subvectors and Submatrices to assign to a specific part of a vector or matrix, respectively. For instance, the followingjoin()
function uses submatrices to assignA
,B
,C
, andD
to the four parts of the given matrixT
:An alternative approach will be the block matrix view, which has been requested in issue #149. Please feel free to vote for this issue and to watch it if you are interested in the progress. Thanks again for creating this issue,
Best regards,
Klaus!