Sentinel Sentinel - 1 year ago 121
C++ Question

Armadillo C++ Matrix Library - simplest way to initialize all values in a matrix to 999?

I'm very new to Armadillo but after searching around I can't find any answer to this. I need a matrix with all values initialized to a number like 999. Do I have to iterate through the whole thing and set them manually? Feel like there should be a better way.

Answer Source

According to documentation classes Mat, Col, Row, Cube have method fill.


mat A(5,5);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download