📄 bes_05.cc
字号:
// file: $isip/class/numeric/Bessel/bes_05.cc// version: $Id: bes_05.cc,v 1.4 2001/07/04 23:44:38 picone Exp $//// isip include files//#include "Bessel.h"// method: compute//// arguments:// float& output: (output) computed value// float input: (input) independent variable// long order: (input) order of the Bessel function// long nterms: (input) number of terms in the approximation//// return: a boolean value indicating status//boolean Bessel::compute(float& output_a, float input_a, long order_a, long nterms_a) { // check the order // if (order_a != 0) { return Error::handle(name(), L"compute", ERR_UNSUPA, __FILE__, __LINE__); } else if (nterms_a < 0) { return Error::handle(name(), L"compute", Error::ARG, __FILE__, __LINE__); } // loop over all terms // output_a = 1.0; Float flt; for (long r = 1; r <= nterms_a; r++) { output_a += pow(pow(0.5 * input_a, r) / flt.factorial(r), 2.0); } // exit gracefully // return true;}// method: compute//// arguments:// VectorFloat& output: (output) computed values// const VectorFloat& input: (input) independent variables// long order: (input) order of the Bessel function// long nterms: (input) number of terms in the approximation//// return: a boolean value indicating status//boolean Bessel::compute(VectorFloat& output_a, const VectorFloat& input_a, long order_a, long nterms_a) { // create space in the output vector // if (!output_a.setLength(input_a.length())) { return false; } // loop over all elements // long len = input_a.length(); float tmp; for (long i = 0; i < len; i++) { if (!compute(tmp, input_a(i), order_a, nterms_a)) { return false; } output_a(i) = tmp; } // exit gracefully // return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -