# Construct a Mat of pointers to a Mat

Hi all!

I've tried to google this a lot - but without any luck. Hope you can help!

Basically I want to construct the following cyclic matrix

M =
|a *b *c|
|
b c *a|
|
c *a *b|

where the elements are pointers to a 1D Mat

v = (a b c)

Such that whenever I change a value in the vector the matrix is then updated accordingly, and I can multiply the matrix M with another matrix for instance.

Am I supposed to use something like Ptr<mat> to initialise M? And how do I assign pointers to this matrix? I'm using C++.

Best Al

edit retag close merge delete

since constructing a new Mat like: Mat_<float> m(3,3); m<<a,c,b,b,c,a,c,a,b; is so easy, i would not even bother to go 'artistic' here.