Skip to content

Commit

Permalink
rename the single file tomsolver.hpp to tomsolver.h
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwillow committed Nov 13, 2024
1 parent e49a7fa commit 25b753b
Show file tree
Hide file tree
Showing 10 changed files with 4,631 additions and 78 deletions.
64 changes: 32 additions & 32 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,38 @@ origin: https://github.com/tomwillow/tomsolver
**Contributors:**

* Tom Willow (https://github.com/tomwillow)
* lizho (https://github.com/lizho)
- Tom Willow (https://github.com/tomwillow)
- lizho (https://github.com/lizho)

# Features

* Simple! Simple! If you know how to use fsolve, you will use this!
* Single header file, just include it!
- Simple! Simple! If you know how to use fsolve, you will use this!
- Single header file, just include it!

# Functions

* Solving nonlinear equations (Newton-Raphson method, LM method)
* Solving linear equations (Gaussian-column pivot iteration method, inverse matrix)
* Matrix and vector operations (matrix inversion, vector cross multiplication, etc.)
* "Pseudo" symbolic operations (derivatives of expressions, Jacobian matrices of symbolic matrices)
- Solving nonlinear equations (Newton-Raphson method, LM method)
- Solving linear equations (Gaussian-column pivot iteration method, inverse matrix)
- Matrix and vector operations (matrix inversion, vector cross multiplication, etc.)
- "Pseudo" symbolic operations (derivatives of expressions, Jacobian matrices of symbolic matrices)

# Supported Platforms

Tested at:

* Linux: ubuntu 22.04 x86_64 gcc 11.3.0
* Windows: windows10 x64 Visual Studio 2019
- Linux: ubuntu 22.04 x86_64 gcc 11.3.0
- Windows: windows10 x64 Visual Studio 2019

Tested at Github Actions:

* Linux-latest gcc Debug&Release
* Linux-latest clang Debug&Release
* Windows-latest msvc Debug&Release
- Linux-latest gcc Debug&Release
- Linux-latest clang Debug&Release
- Windows-latest msvc Debug&Release

# Example

```C++
#include <tomsolver/tomsolver.hpp>
#include <tomsolver/tomsolver.h>

using namespace tomsolver;

Expand Down Expand Up @@ -97,7 +97,7 @@ int main() {
## 1. Header-Only usage

Just include a single header file:
`single/include/tomsolver/tomsolver.hpp`
`single/include/tomsolver/tomsolver.h`

## 2. Binary Library + Header Files usage

Expand All @@ -113,36 +113,36 @@ Then add the include directory and link to the library file.

# Directory Structure

* **src**: source files
* **tests**: unit tests
* **single/include**: the folder where the header-only tomsolver.hpp is located
* **single/test**: All unit tests are integrated into one .cpp file to test whether tomsolver.hpp is correct.
* **scripts**: used to generate single-file header files and single-file tests under single
- **src**: source files
- **tests**: unit tests
- **single/include**: the folder where the header-only tomsolver.h is located
- **single/test**: All unit tests are integrated into one .cpp file to test whether tomsolver.h is correct.
- **scripts**: used to generate single-file header files and single-file tests under single

### examples

* **examples/solve**: Example of solving nonlinear equations, demonstrating basic usage and how to set a unified initial value
* **examples/solve2**: Example of solving nonlinear equations, demonstrating how to switch solution methods and replace known quantities in the equation
* **examples/diff_machine**: Derivator, input a line of expression and output the derivation result of this expression
- **examples/solve**: Example of solving nonlinear equations, demonstrating basic usage and how to set a unified initial value
- **examples/solve2**: Example of solving nonlinear equations, demonstrating how to switch solution methods and replace known quantities in the equation
- **examples/diff_machine**: Derivator, input a line of expression and output the derivation result of this expression

# Development Plan

* add doxygen comments + tutorial document (CN+EN)
* add benchmark tests
* add an option to use Eigen library as matrix library
* aim at Matlab fsolve, add more solving methods of nonlinear equations
* add an optional Config parameter in Solve() function
- add doxygen comments + tutorial document (CN+EN)
- add benchmark tests
- add an option to use Eigen library as matrix library
- aim at Matlab fsolve, add more solving methods of nonlinear equations
- add an optional Config parameter in Solve() function
(similar to Matlab fsolve's option)
* add support for binary/multivariate functions, such as pow(x, y)
* the current Simplify function is still very simple, modify Simplify to be better
* add LaTeX format formula output
- add support for binary/multivariate functions, such as pow(x, y)
- the current Simplify function is still very simple, modify Simplify to be better
- add LaTeX format formula output

# Thanks

https://github.com/taehwan642

# WeChat group

If you have any questions, want to communicate, want to participate in development, or want to contact the authors, you are welcome to add the WeChat *tomwillow*.
If you have any questions, want to communicate, want to participate in development, or want to contact the authors, you are welcome to add the WeChat _tomwillow_.

If you think this repository is good, please give it a star!
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,44 @@

C++14 极简非线性方程组求解器

> 让C++求解非线性方程组像Matlab fsolve一样简单
> 让 C++求解非线性方程组像 Matlab fsolve 一样简单
地址: https://github.com/tomwillow/tomsolver

**Contributors:**

* Tom Willow (https://github.com/tomwillow)
* lizho (https://github.com/lizho)
- Tom Willow (https://github.com/tomwillow)
- lizho (https://github.com/lizho)

# 特点

* 简单!简单!会用fsolve就会用这个
* 单头文件,直接include完事儿
- 简单!简单!会用 fsolve 就会用这个
- 单头文件,直接 include 完事儿

# 功能

* 非线性方程组求解(牛顿-拉夫森法、LM方法
* 线性方程组求解(高斯-列主元迭代法、逆矩阵)
* 矩阵、向量运算(矩阵求逆、向量叉乘等)
* “伪”符号运算(对表达式求导、对符号矩阵求雅可比矩阵)
- 非线性方程组求解(牛顿-拉夫森法、LM 方法
- 线性方程组求解(高斯-列主元迭代法、逆矩阵)
- 矩阵、向量运算(矩阵求逆、向量叉乘等)
- “伪”符号运算(对表达式求导、对符号矩阵求雅可比矩阵)

# 跨平台支持

测试环境:

* Linux: ubuntu 22.04 x86_64 gcc 11.3.0
* Windows: windows10 x64 Visual Studio 2019
- Linux: ubuntu 22.04 x86_64 gcc 11.3.0
- Windows: windows10 x64 Visual Studio 2019

Github Actions自动测试
Github Actions 自动测试

* Linux-latest gcc Debug&Release
* Linux-latest clang Debug&Release
* Windows-latest msvc Debug&Release
- Linux-latest gcc Debug&Release
- Linux-latest clang Debug&Release
- Windows-latest msvc Debug&Release

# 例子

```C++
#include <tomsolver/tomsolver.hpp>
#include <tomsolver/tomsolver.h>

using namespace tomsolver;

Expand Down Expand Up @@ -94,10 +94,10 @@ int main() {

# 用法

## 1. header-only用法
## 1. header-only 用法

仅需要包含一个单头文件即可:
`single/include/tomsolver/tomsolver.hpp`
`single/include/tomsolver/tomsolver.h`

## 2. 二进制库+头文件用法

Expand All @@ -109,40 +109,40 @@ $ cmake ../tomsolver
$ cmake --build . --target INSTALL
```

然后添加include目录,并链接到库文件。
然后添加 include 目录,并链接到库文件。

# 目录结构

* **src**: 源文件
* **tests**: 单元测试
* **single/include**: header-only的tomsolver.hpp所在的文件夹
* **single/test**: 所有单元测试整合为一个.cpp文件,用于测试tomsolver.hpp是否正确
* **scripts**: 用于生成single下面的单文件头文件和单文件测试
- **src**: 源文件
- **tests**: 单元测试
- **single/include**: header-only 的 tomsolver.h 所在的文件夹
- **single/test**: 所有单元测试整合为一个.cpp 文件,用于测试 tomsolver.h 是否正确
- **scripts**: 用于生成 single 下面的单文件头文件和单文件测试

### 例子

* **examples/solve**: 解非线性方程的例子,演示基本用法和怎么设置统一的初值
* **examples/solve2**: 解非线性方程的例子,演示怎么切换解法和怎么替换方程中的已知量
* **examples/diff_machine**: 求导器,输入一行表达式,输出这个表达式的求导结果
- **examples/solve**: 解非线性方程的例子,演示基本用法和怎么设置统一的初值
- **examples/solve2**: 解非线性方程的例子,演示怎么切换解法和怎么替换方程中的已知量
- **examples/diff_machine**: 求导器,输入一行表达式,输出这个表达式的求导结果

# 开发计划

* 增加doxygen注释+教程文档(CN+EN)
* 增加benchmark测速
* 增加使用Eigen库作为内置矩阵库的可选项
* 对标Matlab fsolve,增加更多非线性方程组解法
* 在Solve函数中增加可选的Config参数,可以使用非全局的Config进行求解
类似于Matlab fsolve的options
* 增加对二元/多元函数的支持,例如pow(x, y)
* 现在的Simplify函数还很朴素,把Simplify修改得更好
* 增加LaTeX格式的公式输出
- 增加 doxygen 注释+教程文档(CN+EN)
- 增加 benchmark 测速
- 增加使用 Eigen 库作为内置矩阵库的可选项
- 对标 Matlab fsolve,增加更多非线性方程组解法
- 在 Solve 函数中增加可选的 Config 参数,可以使用非全局的 Config 进行求解
类似于 Matlab fsolve 的 options
- 增加对二元/多元函数的支持,例如 pow(x, y)
- 现在的 Simplify 函数还很朴素,把 Simplify 修改得更好
- 增加 LaTeX 格式的公式输出

# Thanks

https://github.com/taehwan642

# 微信交流群

如果有问题想要交流或者想参与开发,或者想与作者联系,欢迎加微信tomwillow。备注tomsolver按照指引进群
如果有问题想要交流或者想参与开发,或者想与作者联系,欢迎加微信 tomwillow。备注 tomsolver 按照指引进群

如果您觉得此项目不错,请赏颗星吧!
2 changes: 1 addition & 1 deletion examples/diff_machine/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tomsolver/tomsolver.hpp>
#include <tomsolver/tomsolver.h>

using std::cerr;
using std::cin;
Expand Down
2 changes: 1 addition & 1 deletion examples/solve/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tomsolver/tomsolver.hpp>
#include <tomsolver/tomsolver.h>

using namespace tomsolver;

Expand Down
2 changes: 1 addition & 1 deletion examples/solve2/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tomsolver/tomsolver.hpp>
#include <tomsolver/tomsolver.h>

using namespace tomsolver;

Expand Down
7 changes: 4 additions & 3 deletions scripts/all_tests_preheader.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "tomsolver/tomsolver.hpp"
#include "tomsolver/tomsolver.h"

#include <gtest/gtest.h>

#include <cmath>
#include <random>
#include <chrono>
#include <cmath>
#include <deque>
#include <random>


using namespace tomsolver;

Expand Down
2 changes: 1 addition & 1 deletion scripts/combine_src_to_header_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if __name__ == "__main__":
# 输出目标的include目录
target_dir = os.path.join(root_dir, "single/include/tomsolver")
output_filename = f"{target_dir}/tomsolver.hpp"
output_filename = f"{target_dir}/tomsolver.h"

srcFilenames = []
for path in util.findAllFile(f"{root_dir}/src"):
Expand Down
Loading

0 comments on commit 25b753b

Please sign in to comment.