[英]Compare values with a static and global table in C++
I am working on statistical analyses in my field, and using c++.我正在我的领域进行统计分析,并使用 C++。 I am implementing several tests, and some of them need to compare the calculated value with a table, say a distribution table for example, like this one.我正在实施几个测试,其中一些需要将计算出的值与表格进行比较,例如分布表,例如这个。
I want my different functions in my different classes to be able to access a specific value, to evaluate the significance of my result, for example something like this:我希望不同类中的不同函数能够访问特定值,以评估结果的重要性,例如这样的:
float F = fisherTest(serie1, serie2);
auto tableValue = findValue(serie1.size(), serie2.size());
if(tableValue < F) {
cout << "Not significant";
return -1;
}
This is just an example, as this test actually makes no sense.这只是一个例子,因为这个测试实际上没有意义。 But I just want to be able to read values from a predefined table.但我只想能够从预定义的表中读取值。
Do you have an idea of how I can achieve this?你知道我如何实现这一目标吗? Can I store this in a "resource file"?我可以将其存储在“资源文件”中吗?
I hope my question is clear!我希望我的问题很清楚! Thank you.谢谢你。
You can have some data files and pass a configuration during startup (eg commandline) to the application so it can find the files and read them.您可以拥有一些数据文件并在启动期间将配置(例如命令行)传递给应用程序,以便它可以找到这些文件并读取它们。 The data structure can then be fed to the test.然后可以将数据结构提供给测试。
It is possible to get the predefined data from several sources:可以从多个来源获取预定义数据:
You and your team need to decide which makes the most sense for your application.您和您的团队需要决定哪个对您的应用程序最有意义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.