这两天在用c++写数值计算,手残选了个蛋疼的Boost库。boost的好处在于通用性,缺点……原型实在是太长了,make一下只要出一个error就被刷屏了(偶17寸屏幕18号字,谁让我是瞎子)。
首先简单介绍一下boost::numeric::ublas。
vector对象有vector;切片(用过matlab的都懂,不懂你就out了)vector_range >, vector_slice >.
matrix对象有matrix,官方解释如下点击打开链接http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/matrix.htm#matrix_
Parameter
Description
Default
T
The type of object stored in the matrix.
F
Functor describing the storage organization. [1]
row_major
A
The type of the Storage array. [2]
unbounded_array 此外还有matrix_row<...>,matrix_column<...>等等不再赘述。
上回折腾boost::bindings::lapack (肯定不是这个路径,大意如此)的时候就是,只要解线性系统就需要用matrix来声明矩阵,亲测用"row_major"(就是默认的那个)不好使。这些都是题外话。
这回我用到向量场(函数),原型vector Fooo(vector) ,Fooo就是那个函数名(老外都喜欢用Foo,我就就