|
7 | 7 | </a>
|
8 | 8 |
|
9 | 9 | ### Update log:
|
10 |
| -* Framework version: 1.27 - 1.28 |
11 |
| -* New component for calculating fraction operands, supporting the creation and calculation of fraction operands |
| 10 | +* Framework version: 1.28 - 1.29 |
| 11 | +* Fix the issue of incorrect printed data when performing non copy inversion operations in vectors. This is because the |
| 12 | + data inside the vector is not automatically refreshed. Version 1.29 has resolved this issue! |
12 | 13 |
|
13 | 14 | ```java
|
14 |
| -package zhao.algorithmMagic; |
| 15 | +package com.zhao; |
15 | 16 |
|
16 | 17 | import zhao.algorithmMagic.core.AlgorithmStar;
|
17 |
| -import zhao.algorithmMagic.core.FractionFactory; |
18 |
| -import zhao.algorithmMagic.operands.fraction.Fraction; |
| 18 | +import zhao.algorithmMagic.core.VectorFactory; |
| 19 | +import zhao.algorithmMagic.operands.vector.IntegerVector; |
19 | 20 |
|
20 |
| -public class MAIN1 { |
| 21 | +public class MAIN { |
21 | 22 | public static void main(String[] args) {
|
22 |
| - // 获取分数操作数工厂 |
23 |
| - final FractionFactory fractionFactory = AlgorithmStar.fractionFactory(); |
24 |
| - // 准备三个操作数 |
25 |
| - final Fraction parse1 = fractionFactory.parse(1, 2); |
26 |
| - final Fraction parse2 = fractionFactory.parse(2); |
27 |
| - final Fraction parse3 = fractionFactory.parse("1 / 2"); |
28 |
| - |
29 |
| - System.out.println("打印三个分数"); |
30 |
| - System.out.println(parse1); |
31 |
| - System.out.println(parse2); |
32 |
| - System.out.println(parse3); |
| 23 | + // 创建向量对象 |
| 24 | + final VectorFactory vectorFactory = AlgorithmStar.vectorFactory(); |
| 25 | + final IntegerVector integerVector = vectorFactory.parseVector(1, 2, 43, 4); |
| 26 | + // 向量整体反转 这里的参数代表的就是是否需要在拷贝的新向量中进行转换 1.28 以及 1.28 之前的版本 |
| 27 | + // 打印出的字符串不太正确 1.29版本中会修复此问题 |
| 28 | + System.out.println(integerVector.reverseLR(false)); |
| 29 | + } |
| 30 | +} |
| 31 | +``` |
33 | 32 |
|
34 |
| - System.out.println("全部通分 分别将分母变为 10 5 1 在这里我们将第一个分数保存一下 稍后用于约分"); |
35 |
| - final Fraction cf1 = parse1.cf(10); |
36 |
| - System.out.println(cf1); |
37 |
| - System.out.println(parse2.cf(5)); |
38 |
| - System.out.println(parse3.cf(1)); |
| 33 | +* For matrix factories, some creation methods have been added, allowing you to directly parse sparse matrices through |
| 34 | + the factory class. Of course, this operation is also supported in versions before 1.29!!! |
39 | 35 |
|
40 |
| - System.out.println("将被通分的 cf1 进行约分 不出意外的话 这里打印的值为 1 / 2"); |
41 |
| - System.out.println(cf1.simplify()); |
| 36 | +```java |
| 37 | +package zhao.algorithmMagic; |
42 | 38 |
|
43 |
| - System.out.println("在这里将 parse1 以及 parse2 进行加减乘除计算"); |
44 |
| - System.out.println(parse1.add(parse2)); |
45 |
| - System.out.println(parse1.diff(parse2)); |
46 |
| - System.out.println(parse1.multiply(parse2)); |
47 |
| - System.out.println(parse1.divide(parse2)); |
| 39 | +import zhao.algorithmMagic.core.AlgorithmStar; |
| 40 | +import zhao.algorithmMagic.core.MatrixFactory; |
| 41 | +import zhao.algorithmMagic.operands.matrix.DoubleMatrix; |
| 42 | +import zhao.algorithmMagic.operands.matrix.IntegerMatrix; |
48 | 43 |
|
49 |
| - System.out.println("在这里将 parse1 做为Java中的数值类型进行使用"); |
50 |
| - System.out.println(parse1.doubleValue()); |
| 44 | +public class MAIN1 { |
| 45 | + public static void main(String[] args) { |
| 46 | + final MatrixFactory matrixFactory = AlgorithmStar.matrixFactory(); |
| 47 | + // 通过 工厂类 以及稀疏矩阵的方式创建两个矩阵 |
| 48 | + final IntegerMatrix integerMatrix = matrixFactory.sparseMatrix( |
| 49 | + // 在坐标 (2,3) 的位置创建一个元素 1 |
| 50 | + new int[]{1, 2, 3}, |
| 51 | + // 在坐标 (1,2) 的位置创建一个元素 2 |
| 52 | + new int[]{2, 1, 2} |
| 53 | + ); |
| 54 | + final DoubleMatrix doubleMatrix = matrixFactory.sparseMatrix( |
| 55 | + // 在坐标 (2,3) 的位置创建一个元素 1 |
| 56 | + new double[]{1, 2, 3}, |
| 57 | + // 在坐标 (1,2) 的位置创建一个元素 2 |
| 58 | + new double[]{2, 1, 2} |
| 59 | + ); |
| 60 | + System.out.println(integerMatrix); |
| 61 | + System.out.println(doubleMatrix); |
51 | 62 | }
|
52 | 63 | }
|
53 | 64 | ```
|
54 | 65 |
|
55 |
| -* To obtain new help information, you can directly obtain the help document through the following methods, which |
56 |
| - includes more comprehensive API instructions |
| 66 | +* You can also use a matrix factory to fill and randomly create a matrix. |
57 | 67 |
|
58 | 68 | ```java
|
59 | 69 | package zhao.algorithmMagic;
|
60 | 70 |
|
61 | 71 | import zhao.algorithmMagic.core.AlgorithmStar;
|
62 |
| -import zhao.algorithmMagic.core.HelpFactory; |
| 72 | +import zhao.algorithmMagic.core.MatrixFactory; |
| 73 | +import zhao.algorithmMagic.operands.matrix.DoubleMatrix; |
| 74 | +import zhao.algorithmMagic.operands.matrix.IntegerMatrix; |
63 | 75 |
|
64 | 76 | public class MAIN1 {
|
65 | 77 | public static void main(String[] args) {
|
66 |
| - // 获取帮助信息工厂类 |
67 |
| - final HelpFactory helpFactory = AlgorithmStar.helpFactory(); |
68 |
| - // 下载帮助文档 到 C:\Users\zhao\Desktop\fsdownload 目录中 |
69 |
| - final String path = helpFactory.saveHelpFile( |
70 |
| - HelpFactory.ALL, |
71 |
| - "C:\\Users\\zhao\\Desktop\\fsdownload" |
72 |
| - ); |
73 |
| - System.out.println("文件已保存到:" + path); |
| 78 | + final MatrixFactory matrixFactory = AlgorithmStar.matrixFactory(); |
| 79 | + // 通过 工厂类 以及稀疏矩阵的方式创建两个矩阵 4行5列 元素全是 2 |
| 80 | + final IntegerMatrix integerMatrix = matrixFactory.fill(2, 4, 5); |
| 81 | + final DoubleMatrix doubleMatrix = matrixFactory.fill(2.0, 4, 5); |
| 82 | + System.out.println(integerMatrix); |
| 83 | + System.out.println(doubleMatrix); |
| 84 | + // 使用随机的方式创建矩阵 |
| 85 | + final IntegerMatrix integerMatrix1 = matrixFactory.randomGetInt(4, 5, 100); |
| 86 | + final DoubleMatrix doubleMatrix1 = matrixFactory.randomGetDouble(4, 5, 100); |
| 87 | + System.out.println(integerMatrix1); |
| 88 | + System.out.println(doubleMatrix1); |
74 | 89 | }
|
75 | 90 | }
|
| 91 | + |
76 | 92 | ```
|
77 | 93 |
|
78 |
| -### Version update date : 2024-01-09 |
| 94 | +### Version update date : 2024-01-13 |
0 commit comments