SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
Cuchulainn
Topic Author
Posts: 57284
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Inserting code into posts

November 27th, 2018, 8:05 pm

 
User avatar
Cuchulainn
Topic Author
Posts: 57284
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Inserting code into posts

November 27th, 2018, 8:06 pm

Just like that, not like that
ublas::matrix<W> d = ...
 std::size_t n = ...

 for (std::size_t v = 0; v < n; ++v)
 {
 d(v, v) = 0.0;
 }

 for (std::size_t k = 0; k < n; ++k)
 {
 for (std::size_t i = 0; i < n; ++i)
 {
 for (std::size_t j = 0; j < n; ++j)
 {
 d(i, j) = std::min<W>(d(i, j), d(i, k) + d(k,j));
 }
 }
 }
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On