You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ff72b6f
Browse filesBrowse the repository at this point in the historyBrowse files
**Not silent: what compiled to a wrong value now gives the right one.** A scalar over a matrix that is an argument of the
1773
+
compiled function was compiled as the scalar over every element, where evaluation takes it as the scalar times the
1774
+
inverse. Since 2.6.0 it was refused while the inverse was not compiled
1775
+
([#2287](https://github.com/asc-community/AngouriMath/issues/2287)), and the inverse compiles now: a matrix over a matrix is the first times the inverse of the second, and a negative power
1776
+
is that power of the inverse, as evaluation has them. A singular matrix's inverse is NaN in every entry, as a compiled
1777
+
division by zero has no value. A matrix of `int`, `long` or `BigInteger` is not inverted: its inverse is not a matrix of
1778
+
whole numbers. A matrix written into the expression is inverted before it is compiled, as before.
1777
1779
1778
1780
| Input | Was (2.6.0) | Now |
1779
1781
|---|---|---|
1780
-
| `"x / A"`, compiled over `GenTensor<double>` and called at `A = [[1, 2], [3, 4]]`, `x = 2` | `[[2, 1], [0.667, 0.5]]` | throws `UncompilableNodeException` |
1782
+
| `"x / A"`, compiled over `GenTensor<double>` and called at `A = [[1, 2], [3, 4]]`, `x = 2` | `[[2, 1], [0.667, 0.5]]` | `[[-4, 2], [3, -1]]` |
1783
+
| `"A ^ (-1)"`, compiled over `GenTensor<double>` and called at `A = [[1, 2], [3, 4]]` | throws `NotSupportedException` when called | `[[-2, 1], [1.5, -0.5]]` |
1784
+
| `"A / B"`, compiled over `GenTensor<double>` | throws `UncompilableNodeException` | `A` times the inverse of `B` |
1785
+
1786
+
### A compiled matrix power is the matrix power of a whole exponent
1787
+
1788
+
**Silent: a matrix to a power that is not whole has no compiled value, where 2.6.0 compiled it entry by entry.** In 2.6.0
1789
+
simplification raised each entry to the power before compiling, so `[[x, 1], [0, y]] ^ x` compiled as `[[x ^ x, 1], [0,
1790
+
y ^ x]]`. Evaluation takes a power of a matrix as a matrix power since "A matrix is divided, raised to a power and compared
1791
+
as a matrix" above, and leaves one that is not whole unevaluated. The compiled delegate now takes the matrix power where the
1792
+
exponent is whole, and throws `InvalidMatrixOperationException` when called with one that is not; it no longer casts the
1793
+
exponent to `int`, which truncates. An exponent of type `Complex` compiles, and is whole where its imaginary part is zero and
1794
+
its real part is whole.
1795
+
1796
+
| Input | Was (2.6.0) | Now |
1797
+
|---|---|---|
1798
+
| `"[[x, 1], [0, y]] ^ x"`, compiled over `double` to `GenTensor<double>` and called at `(0.7, -1.3)` | `[[0.779, 1], [0, NaN]]`, each entry to the power | throws `InvalidMatrixOperationException` |
1799
+
| the same compiled over `Complex` to `GenTensor<Complex>` | throws `UncompilableNodeException` | a delegate; the matrix power at a whole `x`, and `InvalidMatrixOperationException` at any other |
1800
+
1801
+
### A power of a matrix that is not square is refused when compiling
1802
+
1803
+
**Not silent: what compiled to a wrong value now throws `InvalidMatrixOperationException`.** In 2.6.0 simplification
1804
+
squared `[[x, 1, y]]` entry by entry, and the delegate returned that. A matrix that is not square has no power, and
1805
+
evaluation leaves it written. Simplification also leaves written any operation on written matrices whose shapes do not
1806
+
fit, and `Compile` now refuses each of them, naming the shapes, rather than building a delegate that throws whenever it is
1807
+
called. A matrix argument's shape is known only when the delegate is called, and is checked then.
1808
+
1809
+
| Input | Was (2.6.0) | Now |
1810
+
|---|---|---|
1811
+
| `"[[x, 1, y]] ^ 2".ToEntity().Compile<Complex, Complex, GenTensor<Complex>>("x", "y")`, called at `(1, 2)` | `[[1, 1, 4]]` | throws `InvalidMatrixOperationException` when compiling |
1812
+
1813
+
### A compiled matrix is taken and given as a two-dimensional array, and FastExpression compiles a number made of matrices
1814
+
1815
+
**Addition, not silent.** Under the LINQ compiler `double[,]`, `Complex[,]`, `float[,]`, `int[,]`, `long[,]` and
1816
+
`BigInteger[,]` are matrices, as arguments and as the result, read into and out of the `GenTensor` the arithmetic runs
1817
+
on, so a caller need not know GenericTensor. FastExpression simplifies an expression with a matrix in it before
1818
+
compiling it, as the LINQ compiler does since [#425](https://github.com/asc-community/AngouriMath/issues/425), so one whose
1819
+
value is a number compiles. One whose value is a matrix is refused as before, and the message names the LINQ form.
0 commit comments