C++中实现动态多维数组模板的分析-01 - 悲催的科学匠人 - 冷水's blog

C++中实现动态多维数组模板的分析-01

冷水 posted @ 2010年11月30日 10:26 in C++ , 1473 阅读

C++原生多维数组与FORTRAN原生数组功能差远了。不明白为什么不在标准中把多维数组加强一些,本来这也不是什么难事。如果说用stl::vector可以实现就不做了,那也太差强人意了。boost::multiarray采用了一些高级技术,使得访问方式和原生数组一致。但是性能不佳,比原生数组性能第一个量级,完全无法接收。

在早期的FORTRAN中,动态多维数组采取一维化分配,然后映射为多维数组。一些C编写的数值计算程序也采取类似的方法。这样做能够保证性能,但是C中使用起来不方便。

我希望依然沿用一维化方式,但是采用C++封装内部的映射和指标转化算法,使得使用简便。我不追求与原生数组一致的[]访问方式,因为这样会为了表观的完美而引入复杂的机制,而本末倒置的降低性能。

 

 

  • 无匹配
  • 无匹配
Avatar_small
civaget 说:
2023年12月10日 08:06

The cornerstone of 구글 seo lies in meticulous keyword research, the compass that guides your content toward the coveted top positions on Google's SERPs.

Avatar_small
civaget 说:
2023年12月20日 02:06

천안출장마사지 has become my regular escape from stress. It's simply wonderful.

Avatar_small
civaget 说:
2023年12月25日 02:17

With 오피타임, reservations are a breeze, thanks to its user-friendly interface.

Avatar_small
civaget 说:
2023年12月27日 02:29

스포츠중계 is my passport to sports from around the world.

Avatar_small
civaget 说:
2023年12月31日 00:36

I'm excited about 강남하이퍼블릭! The personalized service and immersive technology promise an unforgettable experience.

Avatar_small
civaget 说:
2024年1月09日 00:21


강남오피: Where luxury meets well-being. A perfect combination!


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee