kir*_*gum 3 boost numeric operator-overloading numerical-methods
有一些在boost.odeint 中使用任意精度和矩阵的例子(boost普通微分方程求解器).
我想在不同类型的坐标(笛卡尔,极坐标或动作角度)中使用odeint原子.
我应该为原子重载哪些操作?+, - ,min,max,pow?
我可以在哪个文件中查找odeint使用的操作?
从默认代数更新(1),它看起来需要"+","*"和abs(),max()
很抱歉有一个相当冗长的答案,但我觉得某种澄清会有所帮助:
通常,在odeint中有两种专门化类型的方法.
一种方法是专门被认为代数以适应如何一个迭代的容器或收集,如std::vector,std::array,ublas::matrix,等.odeint一些预定义的代数存在:
range_algebra 适用于所有容器,满足boost.range的范围概念fusion_algebra 用于编译时序列vector_space_algebra 它将迭代指向操作.thrust_algebra 与推力一起使用 - 一种类似STL的CUDA框架适应特殊类型的第二种可能性是允许您指定如何对容器元素执行基本操作的操作.这里存在一些预定义的操作
default_operations这对大多数类型,如工作double,float,std::complex<>,... default_operations只能假设运营商+, - ,*,/被定义以及像的基本功能abs,max.thrust_operation 用于推力如果我正确理解了您的问题,您可以使用一种或多种类型的点,它们可以存在于不同的坐标系中,因此此类型的运算符必须适用于odeint.在这种情况下,您可以range_algebra结合使用'default_operations':假设您的类型被调用point_type,它基本上由双浮点类型(主浮点类型)组成.为了使用您需要的'default_operations'
point_type operator+( point_type , double );point_type operator+( double , point_type );point_type operator+( point_type , point_type );point_type operator*( point_type , double );point_type operator*( double , point_type );point_type operator/( point_type , double );double abs( point_type );我认为这就是所需要的.然后,你应该能够使用您的point_type像集装箱vector,array等等.还有一个例子odeint,展示了如何适应特殊点类型:太阳系与点类型.如果您使用Boost.Operators库,这很容易.
编辑:修正了一些拼写错误.
| 归档时间: |
|
| 查看次数: |
285 次 |
| 最近记录: |