Skip to content

Commit 0d0a64c

Browse files
committed
NEW
1 parent e64254e commit 0d0a64c

File tree

30 files changed

+1269
-302
lines changed

30 files changed

+1269
-302
lines changed

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/workspace.xml

Lines changed: 0 additions & 95 deletions
This file was deleted.

src/pkg/MatPly_Dart/doc/API/Dart/constructor.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
```text
55
MatrixType(
66
List<List<double>> data, {
7+
int? row,
8+
int? column,
79
bool identityMatrix = false,
810
bool principalDiagonalMatrix = false,
911
bool subDiagonalMatrix = false,
@@ -12,8 +14,9 @@ MatrixType(
1214
bool singularMatrix = false
1315
})
1416
```
17+
> 1. 默认构造函数必须传入一个二维数组,并接受指定一些矩阵的特殊性质,对于该特殊性质并未做出任何操作,考虑到一些矩阵的特殊性质——如对角方阵可以以O(n)的复杂度求解行列式值,该性质可以视为做出简易计算的接口。
18+
> 2. 注:自**V1.0.8**开始,基本构造函数添加了选择性传入形状(如果已知,但必须保证正整数,不做检查),则免去了计算机自动计算形状。
1519
16-
> 默认构造函数必须传入一个二维数组,并接受指定一些矩阵的特殊性质,对于该特殊性质并未做出任何操作,考虑到一些矩阵的特殊性质——如对角方阵可以以O(n)的复杂度求解行列式值,该性质可以视为做出简易计算的接口。
1720

1821
### example
1922
```dart
@@ -440,10 +443,11 @@ class _MyHomePageState extends State<MyHomePage> {
440443

441444
## 指向C语言生成矩阵对象指针
442445
```text
443-
MatrixType.__fromPointer(this.self, this.shape)
446+
MatrixType.fromPointer(this.self, this.shape)
444447
```
445448

446-
> Warning :不建议在Dart使用指针类,因此我设置了此构造函数为私有方法
449+
> 注:
450+
> V1.0.8开始,fromPointer从__fromPointer设置为公有方法
447451
448452
## 工厂构造——深拷贝矩阵
449453
```text
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# CSV读取器[new from V1.0.8]
2+
3+
## properties
4+
```text
5+
late final String path; 文件路径
6+
List<String>? rowLabels; 行标签
7+
List<String>? colLabels; 列标签
8+
List<int>? shape; 形状(包含行标签)
9+
List<List<String>>? content; 初始读取的字符串数据
10+
List<List<double>>? data; 转换字符串数据到数字型数据
11+
```
12+
13+
## methods
14+
```text
15+
CSVReader(this.path)
16+
在构造时传入文件路径且必须保证文件路径存在
17+
```
18+
19+
```text
20+
Future<void> read_csv_async({
21+
bool first_col_is_labels = true,
22+
String loss_column_label = "Unnamed",
23+
Encoding encoding = utf8
24+
})
25+
26+
void read_csv_sync({
27+
bool first_col_is_labels = true,
28+
String loss_column_label = "Unnamed",
29+
Encoding encoding = utf8
30+
})
31+
异/同步读取方法。三个参数分别是第一列是否是列标签、在第一列不是标签的情况下替换方案、读取时编码格式。
32+
只有调用了read_csv_async或者read_csv_sync才能写入到rowLabels、colLabels、shape以及content
33+
```
34+
35+
```text
36+
Future<List<List<double>>> convertToNumberAsync({double replace = double.nan})
37+
38+
List<List<double>> convertToNumberSync({double replace = double.nan})
39+
将content属性转换生成data数据的方法,当数据不是数字型数据,可以使用replace替换
40+
```
41+
42+
# MatrixType拓展
43+
```text
44+
static Future<MatrixType> read_csv_async(
45+
String path, {
46+
bool first_col_is_labels = true,
47+
String loss_column_label = "Unnamed",
48+
Encoding encoding = utf8,
49+
double replace = double.nan
50+
})
51+
static MatrixType read_csv_sync(
52+
String path, {
53+
bool first_col_is_labels = true,
54+
String loss_column_label = "Unnamed",
55+
Encoding encoding = utf8,
56+
double replace = double.nan
57+
})
58+
注意:生成的MatrixType保留了第一行是行标签的替换(一般是NaN、NaN……)。
59+
```
60+
61+
62+
63+

src/pkg/MatPly_Dart/doc/API/Dart/global_methods.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@
2727

2828
## freeMp[new from V1.0.2]
2929
统一释放内存,防止内存泄漏
30+
> [new from V1.0.8]
31+
> * 添加了地址进制指定,hex为true打印十六进制地址否则打印十进制地址。另外从

src/pkg/MatPly_Dart/doc/API/Dart/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ main(){
1818
print(inf.isInfinite);
1919
print(negativeinf.isNegative);
2020
print(e * inf);
21+
print(euler); // [new from V1.0.8]
2122
}
2223
2324
/* outputs :
@@ -27,6 +28,7 @@ true
2728
true
2829
true
2930
Infinity
31+
0.5772156649015329
3032
* */
3133
```
3234

src/pkg/MatPly_Dart/doc/API/Dart/methods.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,37 +116,37 @@ dim=0时,按行排序;dim=1,按列排序;dim为其他整数则整体排
116116
## setMask
117117
设置矩阵nan和正负无穷大数据的替换值,会改变矩阵本身。
118118

119-
## toList[new from V1.0.2]
119+
## toList
120120
根据传入的类型,返回对应形状的二维列表。对于泊松分布这样的数据非常有用。
121121

122-
## std[new from V1.0.2]
122+
## std
123123
求解标准差,如果设置sample为true,则视为样本标准差
124124

125-
## variance[new from V1.0.2]
125+
## variance
126126
求解方差,,如果设置sample为true,则视为样本标准方差
127127

128-
## median[new from V1.0.2]
128+
## median
129129
求解中位数
130130

131-
## norm[new from V1.0.2]
131+
## norm
132132
求解矩阵范数。如果n==-2,则返回矩阵的负无穷范数;如果n==-1,则返回矩阵的正无穷范数;如果设置n==1,则返回矩阵的L1范数,如果n==0或者其他不小于2的正整数,则返回范数(包含行列向量的范数模型、矩阵范数模式),注意这里L0范数是一个整数返回值
133133

134-
## norm2[new from V1.0.2]
134+
## norm2
135135
L2范数。即欧氏距离
136136

137-
## norm_inf[new from V1.0.2]
137+
## norm_inf
138138
矩阵的正无穷范数
139139

140-
## norm_negainf[new from V1.0.2]
140+
## norm_negainf
141141
矩阵的负无穷范数
142142

143-
## norm_one[new from V1.0.2]
143+
## norm_one
144144
矩阵的L1范数
145145

146-
## norm_zero[new from V1.0.2]
146+
## norm_zero
147147
L0范数
148148

149-
## mode[new from V1.0.2]
149+
## mode
150150
求解众数(此方法没有基于C-API)
151151

152152
## argmax[new from V1.0.5]
@@ -260,3 +260,26 @@ clip_reverse的无返回值方式
260260

261261
## choice[new from V1.0.7]
262262
如果根据权重获取数据,权重可以是等列长一维列表,也可以是同形状矩阵。视行为样本。其中method方法分别为0、1、其他整数时,权重映射为原值、sigmoid函数值、绝对值;如果不传入权重,则按照等概率处理
263+
264+
265+
## concats[new from V1.0.8]
266+
concat函数的升级版本,可最多一次拼接四个矩阵
267+
268+
## split[new from V1.0.8]
269+
根据传入长度为n且严格递增的范围内正整数列表,获取被按照索引分成n+1份的矩阵列表
270+
271+
## split_equal[new from V1.0.8]
272+
按照步长均分矩阵得到矩阵列表。如果步长与所切分方向长度一样,则获取矩阵的深拷贝实例
273+
274+
## cover[new from V1.0.8]
275+
对某个矩阵从其内部某点开始用另一个矩阵覆盖,多余的数据排除,并返回一个新的矩阵
276+
277+
## stretch[new from V1.0.8]
278+
沿着横/竖方向对矩阵拉伸,method表示采用的策略——重复(0)、替换(1)、头部延展(2)、尾部延展(3)、镜像(4)、镜像的镜像(其他)
279+
280+
## diffCenter[new from V1.0.8]
281+
在某范围内,传入该范围内连续可导的函数(不做检查)实现求导,基于中心差分法,最后得到导数矩阵(梯度矩阵)
282+
> 注:该方法借鉴于GSL2.8的中心差分法
283+
284+
## get_range[new from V1.0.8]
285+
获取范围(只包含最小值和最大值)

src/pkg/MatPly_Dart/doc/API/Dart/properties.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ acos\asin\atan\cos\sin\tan\cosh\sinh\tanh\exp\log\log10\sqrt\ceil\fabs
6262

6363
在利用这些数学方法来处理矩阵中*正负无穷大**nan*数据时,可以使用*setMask*来处理这些数据的值变换,但这也会修改矩阵!因此,你可以采用矩阵深拷贝避免。
6464

65-
65+
## deepcopy[new from V1.0.8]
66+
提供实例的深拷贝方法
6667

6768

6869

0 commit comments

Comments
 (0)