Harshad Sahasrabudhe <[email protected]> writes: > Hi, > > Can we use the original Mat in Matconvert to store the converted matrix? > > E.g. MatConvert(A, MATDENSE, MAT_INITIAL_MATRIX, &A); > Or do I need MAT_REUSE_MATRIX flag instead of MAT_INITIAL_MATRIX?
Do this: MatConvert(A, MATDENSE, MAT_REUSE_MATRIX, &A); Note that conversion is not really "in place", it creates a new matrix and destroys the old one (all except the header). This is potentially dangerous if other components of your code hold references to the old matrix and do not expect its type to change. It does not use more memory to create a new matrix and eventually destroy the old one.
pgpg3Qn79Dsrt.pgp
Description: PGP signature
