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.
问问题
2943 次
4 回答
3
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
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 }
于 2010-09-04T05:21:19.203 回答
2
最明显的例子是体素空间列表...... 3 + 1 = 4 维:)
于 2010-09-04T05:28:04.183 回答
2
我记得唯一像样的例子是在 1982 年的文本中哦!帕斯卡!这让您了解在我的经验中它是多么罕见。
这个例子是一个库存系统,牛仔裤可以被索引
inventory[sex][size][length][color][fit] = number_received
这只是稍微做作。以这种方式构建的数据库没有问题,但它看起来像代码一样有趣。
于 2010-09-04T05:30:35.140 回答
2
包含 Ultima III 中所有地牢的数组在逻辑上将是一个 4 维数组。每个地牢都是一个由细胞组成的三维网格,它们的大小都相同。
于 2010-09-04T05:58:04.777 回答