Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Practical use of N-Dimensional Arrays,where (N>3)

I have been programming for the last 8 years and now I was just wondering that if there is any practical use of N-Dimensional array,where N>3.I can only visualize of a data structure that is less than or equal to 3 dimensions.Has any one used more than 3 dimensions in any program?Are there any practical uses of a N-D array which is beyond 3d?If so please post some samples.

like image 744
Emil Avatar asked Sep 04 '10 05:09

Emil


1 Answers

Take almost anything from physics, where tensors are common, for example general relativity, computational chemistry, quantum physics.

http://en.wikipedia.org/wiki/Tensor#Applications

Tensor with rank 4 is common for example.

http://www.oonumerics.org/FTensor/FTensor.pdf

http://mpqc.svn.sourceforge.net/viewvc/mpqc/trunk/mpqc/src/lib/chemistry/qc/lmp2/lmp2.cc?revision=9342&view=markup&pathrev=9492

333     double
334     LMP2::compute_ecorr_lmp2()
335     {
336     Timer tim("ecorr");
337     
338     sma2::Index r("r"), s("s");
339     sma2::Array<0> ecorr;
340     double ecorr_lmp2 = 0.0;
341     for (my_occ_pairs_t::const_iterator iter = my_occ_pairs_.begin();
342     iter != my_occ_pairs_.end();
343     iter++) {
344     sma2::Index i(iter->first-nfzc_);
345     sma2::Index j(iter->second-nfzc_);
346     if (j.value() > i.value()) continue;
347     double f;
348     if (i.value() != j.value()) f = 2.0;
349     else f = 1.0;
350     ecorr.zero();
351     ecorr() += f * 2.0 * K_2occ_(i,j,r,s) * T_local_(i,j,r,s);
352     ecorr() -= f * K_2occ_(i,j,s,r) * T_local_(i,j,r,s);
353     ecorr_lmp2 += ecorr.value();
354     }
355     
356     msg_->sum(ecorr_lmp2);
357     
358     return ecorr_lmp2;
359     } 
like image 65
Anycorn Avatar answered Oct 07 '22 05:10

Anycorn