1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | vxd::t v(3); v << 1, 0, 0; //transition matrix mxd::t m(3,3); m << .4 , .3, .1, .4 , .3, .6, .2 , .4, .3; //if today is sunny : what is the probability of the weather a week later? for(z::t i(0) ; i < 7 ; ++i){ v = m * v; } co(v); | cs |
1 2 3 4 | output = 0.263175 0.42105 0.315775 | cs |