C++ newbie here. Does anyone know how to define a matrix as a global variable in C++ when using Armadillo?
The code will look like:
#include <iostream>
#include "armadillo"
using namespace std;
using namespace arma;
#define mat *g
int main(){
extern mat *g;
mat g << 1.0 << 2.0 << endr
<< 3.0 << 4.0 << endr;
return;
}
A related question is what is the type of a mat variable when I pass it to a function? Should it be somefunction(mat *g)
?
I am using Microsoft Visual Studio 2012 on a Windows 7 computer.
Thanks!