Compare commits

..

1722 Commits

Author SHA1 Message Date
ab16bd16ac Fix benchmark results script 2024-08-26 13:37:49 +03:00
222cdc2c14 Add unstable marker to eigenvalue decomposition 2024-08-21 12:06:00 +03:00
6c1a5e62bf Remove buildSrc 2024-08-21 11:56:05 +03:00
1619a49017 Add proper test for symmetric matrices eigenValueDecomposition 2024-08-18 22:45:33 +03:00
b818a8981f Eigenvalue decomposition API
Cosmetic change Double -> Float64
2024-08-17 21:11:13 +03:00
91513a1629 Reimplement random-forking chain 2024-08-14 19:20:05 +03:00
2becee7f59 Reimplement random-forking chain 2024-08-09 22:14:24 +03:00
6619db3f45 Reimplement random-forging chain 2024-08-09 10:22:37 +03:00
48d0ee8126 Add Metropolis-Hastings sampler.
Minor fixes.
2024-08-04 21:26:51 +03:00
57d1cd8c87 Add Metropolis-Hastings sampler.
Minor fixes.
2024-08-04 15:01:47 +03:00
SPC-code
e0997ccf9c
Merge pull request #533 from Vasilev-Ilya/STUD-7_metropolis_hastings_sampler
Draft: STUD-7: Metropolis-Hastings sampler implementation
2024-08-03 21:35:29 +03:00
3e8f44166c add Attributes minus 2024-07-07 11:14:11 +03:00
6e24b563b2 optimize attributes plus 2024-07-07 11:06:20 +03:00
2d309e050b Merge branch 'refs/heads/beta/kotlin2.0.0' into dev 2024-07-07 11:03:48 +03:00
c585c59552 2.0.0 2024-06-04 10:31:42 +03:00
vasilev.ilya
3417d8cdc1 Minor edits. Tests added. | STUD-7 2024-05-20 01:12:27 +03:00
1881feb5e2 Merge pull request 'Fix #532 by making ShapeND a non-value class' (!522) from bug/defaultStridesCache into dev
Reviewed-on: kscience/kmath#522
Reviewed-by: Alexander Nozik <altavir@gmail.com>
2024-05-09 09:16:52 +03:00
Gleb Minaev
201887187d Make ShapeND a usual non-value class. Implement its equals and hashCode methods. Deprecate contentEquals and contentHashCode. 2024-05-08 21:59:49 +03:00
c418607bf6 2.0.0-RC2 2024-04-30 19:41:34 +03:00
dbc5488eb2 Minor edits. Tests added. | STUD-7 2024-04-24 23:29:14 +03:00
d0d250c67f MHS first implementation | STUD-7 2024-04-22 22:01:15 +03:00
9518f16348 Merge branch 'refs/heads/dev' into beta/kotlin2.0.0
# Conflicts:
#	gradle.properties
2024-04-20 09:22:19 +03:00
fc0393436f Document ShapeND.asArray() 2024-04-15 18:01:58 +03:00
9228e6019c Update Attributes version 2024-04-15 17:57:00 +03:00
edbf8c05be cleanup Minuit 2024-04-15 17:52:15 +03:00
SPC-code
f335d63659
Update docs/buffers.md
Co-authored-by: Gleb Minaev <43728100+lounres@users.noreply.github.com>
2024-04-15 17:42:52 +03:00
SPC-code
c696a22f62
Update kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/GaussIntegrator.kt
Co-authored-by: Gleb Minaev <43728100+lounres@users.noreply.github.com>
2024-04-15 17:41:52 +03:00
2fe04040c6 Fix AttributeBuilder inlining 2024-03-27 09:58:28 +03:00
255d4ba6b7 Dump API. Update readme 2024-03-27 09:51:23 +03:00
48b334a2b6 Singleton implementation for Attributes.EMPTY 2024-03-27 09:45:56 +03:00
ac851bea62 Change logic of AttributesBuilder. It no longer exposes the constructor 2024-03-27 09:18:46 +03:00
3b74968f9a Change logic of AttributesBuilder. It no longer exposes the constructor 2024-03-27 09:11:35 +03:00
214467d21c Reformat code 2024-03-27 09:11:12 +03:00
ecb5d28110 Attributes modify->modified 2024-03-27 08:51:56 +03:00
ec88d6be9e Remove unnecessary reification 2024-03-27 08:19:22 +03:00
461e5a7c54 Refactor names for AttributesBuilder behavior 2024-03-27 08:12:39 +03:00
1be6a5ca0e LinearSpace.compute -> LinearSpace.withComputedAttribute 2024-03-27 07:45:57 +03:00
a67bda8a33 Adjust build 2024-03-27 07:44:53 +03:00
efef5996e1 Remove contracts 2024-03-27 07:44:33 +03:00
69b59b43f4 Mark polymorphic attribute getters and setters as unstable 2024-03-27 07:43:54 +03:00
0af8147be6 Remove unnecessary internal dependencies 2024-03-26 09:58:50 +03:00
bd9430bab4 Merge branch 'dev' into beta/kotlin2.0.0
# Conflicts:
#	gradle.properties
#	kmath-histograms/build.gradle.kts
#	kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt
2024-03-19 09:15:55 +03:00
82196250f6 Remove unnecessary internal dependencies 2024-03-17 09:42:50 +03:00
86324a9219 Add RingBuffer reset and capacity 2024-03-17 09:29:15 +03:00
203a350650 Merge remote-tracking branch 'github/dev' into dev 2024-03-08 10:19:20 +03:00
b076a6573a Update versions 2024-03-08 10:18:32 +03:00
SPC-code
e7d8b94889
Update attributes-kt/src/commonMain/kotlin/space/kscience/attributes/SafeType.kt
Co-authored-by: Gleb Minaev <43728100+lounres@users.noreply.github.com>
2024-03-08 10:07:54 +03:00
5dea38eef8 Merge remote-tracking branch 'github/dev' into dev 2024-03-08 10:07:28 +03:00
SPC-code
dcf5b19d80
Update attributes-kt/src/commonMain/kotlin/space/kscience/attributes/Attributes.kt
Co-authored-by: Gleb Minaev <43728100+lounres@users.noreply.github.com>
2024-03-08 10:06:30 +03:00
11722db3c8 Add Attributes container equality 2024-03-08 10:04:37 +03:00
fcb7e2fa7d Reverse types for buffers and typealiases for geometry. 2024-02-22 21:03:58 +03:00
dba001eff3 Fix types in geometry algebras 2024-02-20 20:39:57 +03:00
49f0d1fe7d Fix types in geometry algebras 2024-02-20 19:35:00 +03:00
ad66a63ac2 Merge remote-tracking branch 'github/dev' into dev 2024-02-20 19:05:58 +03:00
32c5b3c10d Add publishing to attributes-kt 2024-02-20 18:38:21 +03:00
SPC-code
bc1b75f79e
Merge branch 'master' into dev 2024-02-18 15:10:51 +03:00
fd9da63ef9 Prepare for 0.4.0 release 2024-02-18 15:05:56 +03:00
024e2a1a4f Add .kotlin to gitignore 2024-02-18 14:26:47 +03:00
41a325d428 fix dot bug introduced in the last refactor. Add test for parallel linear algebra. 2024-02-18 14:22:20 +03:00
79642a869d LUP cleanup 2024-02-18 14:00:38 +03:00
fbee95ab8b LUP cleanup 2024-02-18 13:32:22 +03:00
10739e0d04 Performance fixes 2024-02-18 12:27:46 +03:00
f8e91c2402 Finishing fixes 2024-02-17 21:32:26 +03:00
7d88fb0166 Merge branch 'dev' into dev-0.4
# Conflicts:
#	kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/_generated.kt
2024-02-16 18:57:57 +03:00
ca9df8a167 Add more corner cases for complex power 2024-02-08 18:06:06 +03:00
9e3fd240b8 Update versions 2024-02-08 17:39:19 +03:00
a526dcc16b Merge branch 'dev' into dev-0.4
# Conflicts:
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixFeatures.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/Featured.kt
#	kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/_generated.kt
#	kmath-memory/src/commonMain/kotlin/space/kscience/kmath/memory/MemoryBuffer.kt
#	kmath-optimization/src/commonMain/kotlin/space/kscience/kmath/optimization/OptimizationBuilder.kt
2024-02-07 21:53:49 +03:00
83d9e1f0af Merge remote-tracking branch 'github/dev' into dev 2024-02-07 21:42:49 +03:00
8a754ace19 Fixed GitHub #524 (Complex power of real-valued number 2024-02-07 21:18:47 +03:00
9f9c4a347b Fix all issues for 2.0.0 2024-01-28 18:35:47 +03:00
c6f6191ef1 Deprecate direct angle conversion 2024-01-28 18:15:33 +03:00
SPC-code
960a334b8e
Merge pull request #522 from SciProgCentre/copyright-upgrade
Update/Add copyright comments. Regenerate code for kmath-ejml.
2024-01-05 09:56:22 +03:00
Gleb Minaev
cc4159be67 Update/Add copyright comments. Regenerate code for kmath-ejml. 2024-01-05 01:50:27 +03:00
24b934eab7 Add Buffer.asList() 2023-11-22 14:32:56 +03:00
9e88bff668 Kotlin 2.0.0-Beta1 2023-11-22 09:22:28 +03:00
5c82a5e1fa 0.4 WIP 2023-11-18 22:29:59 +03:00
2f2f552648 0.4 WIP 2023-11-11 10:19:09 +03:00
2386ecba41 0.4 WIP 2023-11-04 11:49:31 +03:00
46eacbb750 0.4 WIP 2023-11-03 09:56:19 +03:00
ea887b8c72 0.4 WIP 2023-11-01 08:55:47 +03:00
544b8610e1 Merge branch 'dev' into dev-0.4
# Conflicts:
#	buildSrc/settings.gradle.kts
#	gradle.properties
#	gradle/wrapper/gradle-wrapper.properties
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Circle2D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float32Space2D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float64Space2D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/quaternionOperations.kt
2023-10-31 14:18:50 +03:00
a84f1e1500 Merge branch 'kotlin/1.9.20' into dev 2023-10-31 14:05:37 +03:00
328d45444c 1.9.20 finalization 2023-10-31 14:05:17 +03:00
1765f8cf8c Remove asPolynomial 2023-10-25 10:28:39 +03:00
bfb556b013 remove webpack and node version fixture 2023-10-03 19:33:39 +03:00
5129f29084 update geometry 2023-09-22 09:53:44 +03:00
56933ecff3 1.9.20-Beta2 2023-09-22 09:04:39 +03:00
12a02320ec Merge branch 'dev' into kotlin/1.9.20
# Conflicts:
#	build.gradle.kts
2023-09-22 08:33:40 +03:00
7a4e9e70f9 add some quaternion operations 2023-09-22 08:21:14 +03:00
23c0758ba6 Kotlin 1.9.20 2023-09-13 13:25:54 +03:00
dd3d38490a [WIP] refactor features to attributes 2023-09-13 09:00:56 +03:00
9da14089e0 Update integration to use Attributes 2023-08-14 10:06:23 +03:00
5196322b7a Update integration to use Attributes 2023-08-13 19:13:39 +03:00
eff70eb690 Refactor rotations. Add Rotation matrix to Euler conversion 2023-08-13 14:51:50 +03:00
67994d35d9 Merge branch 'dev' into dev-0.4
# Conflicts:
#	CHANGELOG.md
#	build.gradle.kts
#	examples/src/main/kotlin/space/kscience/kmath/operations/mixedNDOperations.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/linear/CMMatrix.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/Float64LinearSpace.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/LupDecomposition.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/Float64FieldND.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Circle2D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float64Space2D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean3d/Float64Space3D.kt
#	kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/vectorPrecision.kt
#	kmath-nd4j/src/main/kotlin/space/kscience/kmath/nd4j/Nd4jTensorAlgebra.kt
#	kmath-tensorflow/src/main/kotlin/space/kscience/kmath/tensorflow/DoubleTensorFlowAlgebra.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/DoubleTensorAlgebra.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/IntTensorAlgebra.kt
#	kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorFieldOpsND.kt
2023-08-12 21:38:43 +03:00
efb853c1bc Refactor geometry 2023-08-12 13:16:18 +03:00
19bebfd1ed Finish naming change 2023-08-12 11:21:59 +03:00
62f1c59d73 Fix Median statistics. Update algebra naming. Add integer fields 2023-08-12 10:46:43 +03:00
976714475e levenbergMarquardt cleanup 2023-07-28 20:56:31 +03:00
1e2a8a40e5 levenbergMarquardt cleanup 2023-07-28 20:39:05 +03:00
cfac7ecffc Merge branch 'dev' into dev-0.4 2023-07-28 12:02:17 +03:00
14f0fa1a6f Merge remote-tracking branch 'space/dev' into dev 2023-07-18 11:15:27 +03:00
a3c65e5b17 [WIP] Features to Attributes refactoring 2023-07-18 11:14:23 +03:00
4abe25c188 [WIP] Features to Attributes refactoring 2023-07-18 10:13:36 +03:00
6da51b7794 [WIP] Features to Attributes refactoring 2023-07-09 15:51:50 +03:00
a001c74025 1.9.0-RC 2023-06-22 08:49:51 +03:00
d3893ab7e6 [WIP] moving from features to attributes 2023-06-20 19:45:21 +03:00
SPC-code
7e46c7de4e
Merge pull request #513 from margarita0303/dev
Added Levenberg-Marquardt algorithm and svd Golub-Kahan
2023-06-19 16:11:56 +03:00
Gleb Minaev
e00c2a4e2b Fix version of matheclipse-core. 2023-06-16 16:00:48 +03:00
Margarita Lashina
5f2690309b fix mistake in streaming version 2023-06-13 03:06:55 +03:00
c0a7cff1d8 Merge branch 'dev' into dev-0.3.2
# Conflicts:
#	build.gradle.kts
#	gradle/wrapper/gradle-wrapper.properties
#	kmath-core/build.gradle.kts
#	kmath-tensors/build.gradle.kts
2023-06-11 09:10:31 +03:00
009f93adbb Add rotation coversion test for XYZ 2023-06-08 09:28:26 +03:00
Margarita Lashina
ef4335bc41 use function types for input func 2023-06-07 15:24:01 +03:00
1f6b7abf46 wasm test version 2023-06-07 15:16:58 +03:00
Margarita Lashina
f91b018d4f add assertEquals to middle and difficult test 2023-06-07 07:24:47 +03:00
Margarita Lashina
346e2e97f2 add minor fixes 2023-06-07 06:14:05 +03:00
Margarita Lashina
0655642933 add documentation to the main function levenbergMarquardt 2023-06-07 06:00:58 +03:00
Margarita Lashina
e8dafad6c5 the input data is placed in a separate class, to which the documentation is written 2023-06-07 05:25:32 +03:00
Margarita Lashina
162e37cb2f removed extra comments, unnecessary variables, renaming variables and secondary functions 2023-06-07 02:52:00 +03:00
Margarita Lashina
cac5b513f3 made class for settings private and removed settings as input from a custom function 2023-06-07 01:55:38 +03:00
Margarita Lashina
0c7f5697da add documentation for enum TypeOfConvergence 2023-06-07 00:50:27 +03:00
Margarita Lashina
1ed40cd8ce fix problem with imports 2023-06-06 20:43:59 +03:00
Margarita Lashina
29d392a8a0 fix problem with imports 2023-06-06 20:31:15 +03:00
Margarita Lashina
963e14b00a move enums 2023-06-06 20:07:42 +03:00
c940645e2e fix simja version 2023-06-06 17:43:38 +03:00
Margarita Lashina
c017d58265 Merge remote-tracking branch 'origin/dev' into dev 2023-06-06 01:42:57 +03:00
Margarita Lashina
8d81d2d8d5 move lm-algorithm from DoubleTensorAlgebra as extension 2023-06-06 01:41:08 +03:00
Margarita
f65a463773
Merge branch 'dev' into dev 2023-06-06 00:56:12 +03:00
Margarita
2ead722620
Merge pull request #4 from margarita0303/streaming_lm_algorithm
tests changed
2023-06-06 00:40:14 +03:00
Margarita Lashina
47600dff23 tests changed 2023-06-06 00:39:19 +03:00
Margarita
3a1817586f
Merge pull request #3 from margarita0303/streaming_lm_algorithm
Streaming lm algorithm, tests and examples
2023-05-29 15:15:02 +03:00
Margarita Lashina
1afb0d0a4c fixed time for js tests for lm 2023-05-29 15:13:13 +03:00
Margarita Lashina
33cb317cee added examples and tests 2023-05-28 23:07:01 +03:00
Margarita Lashina
20c20a30e8 y_dat added generation 2023-05-27 16:07:13 +03:00
Margarita Lashina
e738fbc86d typo fixed 2023-05-27 01:24:37 +03:00
Margarita Lashina
ce16946105 added streaming version of LM 2023-05-27 01:16:43 +03:00
Margarita Lashina
a18fa01100 added parameter check in tests 2023-05-26 21:53:50 +03:00
65c6962544 Update build tools 2023-05-26 16:46:18 +03:00
3e9d28be31 Update build tools 2023-05-26 11:38:50 +03:00
SPC-code
b5f85a6d86
Merge pull request #514 from SciProgCentre/dev
0.3.1
2023-05-12 22:19:48 +03:00
13d6ea2a16 Merge remote-tracking branch 'space/dev' into dev 2023-05-12 20:58:53 +03:00
378180ba09 Pre-release fixes 2023-05-12 20:57:55 +03:00
SPC-code
1c337789a5
Merge branch 'master' into dev 2023-05-10 16:06:34 +03:00
SPC-code
debcef4c9a
Update README.md
change space shield address
2023-05-09 20:34:29 +03:00
SPC-code
acff855c93
Merge branch 'dev' into dev 2023-05-09 20:32:46 +03:00
1222fd4617 Merge remote-tracking branch 'space/master' into dev 2023-05-09 20:14:28 +03:00
8cdbc8dbbe Add opt-ins 2023-05-09 20:12:18 +03:00
4ab2244ac9 update space automation 2023-05-09 19:44:39 +03:00
4ab1b7d0d4 update space automation 2023-05-09 19:28:38 +03:00
8eb25596a0 Variance test post-merge cleanup 2023-05-09 19:22:39 +03:00
4dbcaca87c Merge remote-tracking branch 'space/dev' into dev 2023-05-09 19:01:56 +03:00
1316e6548e Remove vector type from polygon 2023-05-09 19:01:37 +03:00
SPC-code
46b3773419
Merge pull request #511 from mrFendel/mrfendel
VarianceRatioTest implementation for Series
2023-05-09 19:00:21 +03:00
Margarita Lashina
cfe8e9bfee done TODOs, deleted prints and added type of convergence to output of lm 2023-05-07 21:34:20 +03:00
Margarita Lashina
64e563340a fixed error for chi_sq and added more complete output for lm 2023-05-07 17:26:59 +03:00
mrFendel
f44039e309 -- refactoring 2023-05-05 18:50:10 +03:00
mrFendel
16385b5f4e -- refactoring 2023-05-05 18:45:54 +03:00
Margarita Lashina
b526f9a476 added Levenberg-Marquardt algorithm + test 2023-05-04 20:05:32 +03:00
Margarita Lashina
89a5522144 added new svd algorithm (Golub Kahan) and used by default for svd 2023-05-04 00:44:18 +03:00
Margarita Lashina
19c1af1874 added helper functions for levenberg-marquardt algorithm 2023-05-03 21:25:30 +03:00
Margarita Lashina
10f84bd630 added function solve 2023-05-03 21:14:29 +03:00
40b3fa782c Merge remote-tracking branch 'space/master' into dev-0.3.2 2023-05-03 10:12:01 +03:00
Margarita Lashina
a02085918a Merge remote-tracking branch 'origin/dev' into dev 2023-05-02 23:16:31 +03:00
Margarita
a9627071ff
Merge branch 'SciProgCentre:dev' into dev 2023-05-02 23:16:01 +03:00
Margarita Lashina
a74a7808a2 Merge remote-tracking branch 'origin/dev' into dev 2023-05-02 23:14:37 +03:00
SPC-code
a7c54d3ffb
Merge pull request #512 from SciProgCentre/dependabot/github_actions/dot-github/workflows/gradle/gradle-build-action-2.4.2
Bump gradle/gradle-build-action from 2.1.5 to 2.4.2 in /.github/workflows
2023-05-01 16:54:09 +03:00
dependabot[bot]
0c565c6056
Bump gradle/gradle-build-action in /.github/workflows
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.1.5 to 2.4.2.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.1.5...v2.4.2)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-01 13:50:29 +00:00
f09371a3f9 Explicit mutability for StructureND builders 2023-04-22 09:13:06 +03:00
cdfddb7551 Explicit mutability for StructureND builders 2023-04-21 12:41:46 +03:00
8e281e8b0f Merge remote-tracking branch 'space/dev' into dev 2023-04-21 10:38:01 +03:00
mrFendel
1e27af9cf5 - Zelen-Severo CDF aproximation
- p-value for varianceRatioTest
2023-04-19 17:13:47 +03:00
mrFendel
0193349f94 requirements, default parameters, new Test for varianceRatioTest 2023-04-19 01:36:54 +03:00
mrFendel
98781c83ad fixed bug with heteroscedastic z-score in Variance Ratio Test 2023-04-18 19:16:10 +03:00
mrFendel
e6da61c52a refactoring 2023-04-18 01:53:07 +03:00
mrFendel
dababe3075 Merge remote-tracking branch 'kmath/dev' into mrfendel 2023-04-18 01:02:40 +03:00
Gleb Minaev
85395ff82e Add autodiff example 2023-04-14 21:17:44 +03:00
mrFendel
5b95923bb9 fixed zip in SereiesAlgebra + tests for VarianceRatio 2023-04-14 06:36:20 +03:00
mrFendel
a91b43a52d tests for varianceRatio 2023-04-13 17:52:14 +03:00
mrFendel
0ce1861ab4 refactoring 2023-04-13 03:47:36 +03:00
mrFendel
a68ebef26d zScore for variance Ratio Test 2023-04-13 03:38:10 +03:00
mrFendel
2b83560da8 Variance Ratio function 2023-04-12 22:24:48 +03:00
e76d8e0774 fix zipWithNextCircular on single element 2023-04-12 11:40:27 +03:00
875e32679b [WIP] geometry refactor 2023-04-12 11:39:28 +03:00
mrFendel
31d1cc774a added shiftOperartion and diff 2023-04-11 20:31:04 +03:00
mrFendel
a4ca6e3d58 Merge remote-tracking branch 'kmath/dev' into mrfendel 2023-04-10 19:13:38 +03:00
5965ca940b Merge remote-tracking branch 'space/master' into dev 2023-04-09 14:02:00 +03:00
e1d5409c0d Patch changelog 2023-04-09 11:12:04 +03:00
8ac7567afd Patch changelog 2023-04-09 11:08:39 +03:00
b2746e5c0e Wasm support 2023-04-09 10:55:58 +03:00
ce388fed44 Move annotations to base package. Fix series 2023-04-07 19:55:34 +03:00
mrFendel
4db091d898 deleted TimeSeriesAlgebra 2023-04-07 12:39:30 +03:00
mrFendel
165dfd6c5d Merge branch 'dev-local' into mrfendel
# Conflicts:
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/series/SeriesAlgebra.kt
2023-04-07 10:55:25 +03:00
mrFendel
ba26c7020e started TimeSeriesAlgebra 2023-04-06 17:58:29 +03:00
mrFendel
1d7f4ed538 shiftOp and diff in SeriesAlgebra 2023-04-06 03:17:01 +03:00
SPC-code
115736e98a
Merge pull request #510 from SciProgCentre/dev
0.3.1-dev-11
2023-04-05 18:46:35 +03:00
SPC-code
96554d2b0c
Merge branch 'master' into dev 2023-04-05 18:46:20 +03:00
7cc6a4be40 remove trajectory 2023-04-05 15:26:09 +03:00
00ce7d5a48 Obstacle avoidance finished 2023-04-05 13:30:13 +03:00
a0e2ef1afc refactor lines and segments 2023-04-04 19:33:43 +03:00
025cb58060 refactoring directions 2023-04-04 19:02:24 +03:00
639a255aaf refactoring directions 2023-04-04 18:50:17 +03:00
f5201b6be0 refactoring directions 2023-04-04 17:42:40 +03:00
1e46ffbd98 refactoring directions 2023-04-04 16:50:30 +03:00
fd35d7c614 [WIP] refactoring directions 2023-04-04 15:28:02 +03:00
109e050f03 Hieraechy for trajectory types 2023-04-04 15:16:33 +03:00
f809e40791 Disentangle obstacle code phase 1 2023-04-04 11:42:58 +03:00
d08424428e Merge remote-tracking branch 'space/dev' into artdegt 2023-04-04 11:42:22 +03:00
93bc15f346 Merge remote-tracking branch 'space/artdegt' into artdegt 2023-03-28 08:37:26 +03:00
Artyom Degtyarev
11dd4088d9 search for shortest path algorithm 2023-03-24 10:39:51 +03:00
Artyom Degtyarev
24c39c97cd search for shortest path algorithm 2023-03-24 10:30:13 +03:00
Artyom Degtyarev
ea5305c8d8 search for shortest path algorithm 2023-03-24 10:28:02 +03:00
SPC-code
d87eefcaa3
Add macOsArm64 to publish.yml 2023-03-22 18:04:16 +03:00
6d219341f9 Merge branch 'dev' into artdegt 2023-03-22 12:30:28 +03:00
56bba749c0 Update publishing 2023-03-22 10:54:24 +03:00
Artyom Degtyarev
81213eb943 search for shortest path algorithm 2023-03-21 12:04:27 +03:00
c442eb7e94 Fix publish task names 2023-03-19 19:41:31 +03:00
62c8610a9e Update publishing CD 2023-03-19 19:16:46 +03:00
c36af3515e Update trajectory description 2023-03-19 18:39:27 +03:00
ef336af87d Fix vector product 2023-03-16 09:37:03 +03:00
cd2ade881a Revert "Remove the choice of left-handed product. Refactor vectorProduct. Remove leviChivita function."
This reverts commit 28b85b0f53.
2023-03-16 09:33:17 +03:00
5625800fc9
Merge SCI-MR-180: feature/vector-product 2023-03-14 17:16:34 +00:00
Gleb Minaev
28b85b0f53 Remove the choice of left-handed product. Refactor vectorProduct. Remove leviChivita function. 2023-03-14 20:13:34 +03:00
Artyom Degtyarev
4c1ffdb6d9 search for shortest path algorithm 2023-03-14 13:50:42 +03:00
72c7030297 Add time series example stub 2023-03-10 22:50:41 +03:00
a3963ac4f5 Refactor series naming and docs 2023-03-10 21:40:14 +03:00
4871baf0e5 Add vector product to Euclidean3DSpace 2023-03-10 12:01:08 +03:00
Artyom Degtyarev
2bce369c5d search for shortest path algorithm 2023-03-09 16:03:48 +03:00
Artyom Degtyarev
1b6a41c728 search for shortest path algorithm 2023-03-09 08:39:20 +03:00
Artyom Degtyarev
61d43ae5fa search for shortest path algorithm 2023-03-04 21:31:06 +03:00
Artyom Degtyarev
6288eb9d97 Merge branch 'dev' of https://git.jetbrains.space/spc/sci/kmath into artdegt
# Conflicts:
#	kmath-trajectory/src/commonMain/kotlin/space/kscience/kmath/trajectory/tangent.kt
2023-03-04 20:58:35 +03:00
Artyom Degtyarev
2c13386646 search for shortest path algorithm 2023-03-01 10:40:54 +03:00
db61f71440 update build tools 2023-02-18 19:04:07 +03:00
04127fc3f2 Fix tests 2023-02-18 18:53:03 +03:00
Artyom Degtyarev
cc0fb2a718 non-existence of tangents throws exception 2023-02-16 18:47:42 +03:00
ed4aa47913 Minor refactoring of tangents 2023-02-16 10:57:24 +03:00
67316c4a70 Add documentation after circle tangent changes 2023-02-16 10:39:25 +03:00
7d897ad8cb Cleanup after circle tangent changes 2023-02-16 10:29:12 +03:00
Artyom Degtyarev
8998a394b3 tangentsToCircle fixed 2023-02-15 17:55:39 +03:00
Artyom Degtyarev
c342c5cd78 tangentsToCircle fixed 2023-02-15 17:53:32 +03:00
Artyom Degtyarev
d535a2155f tangentsToCircle fixed 2023-02-15 15:06:47 +03:00
Artyom Degtyarev
bef317677c tangentsToCircle fixed 2023-02-15 14:36:58 +03:00
Artyom Degtyarev
50579f4712 added tangent between two circles 2023-02-13 23:17:13 +03:00
784d397ab1 Fix serial names for trajectory serializers 2023-02-12 10:40:53 +03:00
6deeaf057e Add angle serializer 2023-02-11 21:51:19 +03:00
2c6d1e89c5 Update type-safe angles 2023-02-05 20:05:53 +03:00
0366a69123 Refactor trajectory 2023-02-03 19:33:22 +03:00
db30913542 Move to build tools 0.14 2023-02-03 19:32:53 +03:00
d97888f135 Fix test 2023-01-24 21:22:25 +03:00
7f4f4c7703 Update of symbolic operations 2023-01-24 21:01:26 +03:00
2e4be2aa3a A minor change to XYfit arguments 2023-01-24 11:36:53 +03:00
3f4fe9e43b Migrate to 1.8. Use universal autodiffs 2022-12-31 15:02:52 +03:00
6d47c0ccec
Ordered segments in trajectory 2022-12-10 12:30:15 +03:00
29977650f1
Naive classifier notebook 2022-12-10 12:21:56 +03:00
991ab907d8
Encapsulate internal constants in Expression 2022-12-10 11:09:55 +03:00
Margarita
9e141db871
Merge pull request #2 from SciProgCentre/dev
Dev
2022-12-10 04:01:45 +03:00
b14e2fdd08
Moved polynomials to https://github.com/SciProgCentre/kmath-polynomial 2022-11-05 21:44:41 +03:00
cff563c321
Major tensor refactoring 2022-11-05 16:14:23 +03:00
8286db30af
Optimize tensor shape computation 2022-10-16 20:15:37 +03:00
94489b28e2
Fix visibility in Trajectory2D 2022-10-16 14:41:48 +03:00
fb0d016aa8
Perform merge build only on JVM 2022-10-15 18:58:30 +03:00
e24463c58b
Refactor Dubins path 2022-10-15 18:45:06 +03:00
ee569b85f8
Safe shapes 2022-10-14 13:05:39 +03:00
b0abcf2d0c
Safe shapes 2022-10-14 12:47:57 +03:00
c653052d8c
Merge remote-tracking branch 'space/dev' into dev 2022-10-04 09:20:18 +03:00
SPC-code
2376d278c3
Merge pull request #504 from SciProgCentre/dev
Merge to update docs and contributions
2022-10-03 20:58:00 +03:00
89d0cbc7ea
Refactoring and optimization of tensorAlgebra 2022-09-30 11:34:44 +03:00
b602066f48
Change the default strides and unify strides processing 2022-09-27 16:57:06 +03:00
d70389d2e6
Fix after series merge 2022-09-26 16:47:38 +03:00
4d1137659b
Merge branch 'feature/series' into dev
# Conflicts:
#	build.gradle.kts
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/transform/Transformations.kt
#	kmath-core/build.gradle.kts
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/AlgebraND.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferAlgebraND.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/BufferND.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShapeIndices.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/BufferAlgebra.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/DoubleBufferOps.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/bufferExtensions.kt
#	kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/distributions/UniformDistribution.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/samplers/Sampler.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BroadcastDoubleTensorAlgebra.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BufferedTensor.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/DoubleTensorAlgebra.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/broadcastUtils.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/linUtils.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/tensorCastsUtils.kt
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/internal/utils.kt
#	settings.gradle.kts
2022-09-26 13:10:59 +03:00
6bf8d9d325
Naming refactoring 2022-09-26 13:08:49 +03:00
2358f53cf7 Make Circle2D data class 2022-09-15 17:42:37 +03:00
20886d6f6b
Global refactor of tensors 2022-09-11 17:10:26 +03:00
b5d04ba02c
Global refactor of tensors 2022-09-11 15:27:38 +03:00
3729faf49b
Rename Tensor::get to Tensor::getTensor to avoid name clash. 2022-09-05 23:24:01 +03:00
a9821772db
Move power to ExtendedFieldOps 2022-09-05 22:08:35 +03:00
5042fda751
Int Tensor Algebra implementation 2022-09-05 16:30:39 +03:00
ad97751327
Refactor for build tools 0.13.0 2022-09-04 20:59:30 +03:00
0c1d0aa64e
Merge remote-tracking branch 'origin/dev' into dev 2022-08-21 19:18:05 +03:00
ec77cd1fc3
Geometry overhaul 2022-08-21 19:17:38 +03:00
Gleb Minaev
26662b5114
Merge pull request #502 from lounres/fix/#472
Fix #455: Update copyrights
2022-08-21 15:06:41 +03:00
98e21f3c3a
Merge remote-tracking branch 'origin/dev' into dev 2022-08-21 11:40:20 +03:00
978de59b7a
Add rotations converter to Quaternions 2022-08-21 11:40:02 +03:00
5af0c91f0a
Misc 2022-08-21 11:39:41 +03:00
6111c673ee
Type-safe angles 2022-08-21 11:39:17 +03:00
Alexander Nozik
7f77c1e710
Merge pull request #501 from lounres/fix/old-domain-appearances
Replace main `mipt-npm` appearances with `SciProgCentre`.
2022-08-20 09:50:55 +03:00
Gleb Minaev
efe14f50bf #472: Update copyright. 2022-08-19 15:59:13 +03:00
Gleb Minaev
b6d2eb3b1b Replace main mipt-npm appearances with SciProgCentre.
Now link in "Documentation site (WIP)" works.
2022-08-19 15:19:01 +03:00
a8182fad23
Multik went MPP 2022-08-04 09:54:59 +03:00
ee0d44e12e
rename bdot to matmul 2022-08-03 18:20:46 +03:00
e636ed27bd
Merge remote-tracking branch 'origin/dev' into dev 2022-08-03 18:13:08 +03:00
5402ba47c9
Restrict tensor dot ot vectors and matrices only. Introduce bdot to Double TensorAlgebra for broadcasting operations. 2022-08-03 18:10:44 +03:00
9456217935
Update multik algebra 2022-08-03 17:29:01 +03:00
Alexander Nozik
c5516e5581
Merge pull request #498 from mipt-npm/refactor/dubins
Refactor/dubins
2022-07-30 09:53:46 +03:00
0e9072710f
Kotlin 1.7.20-Beta 2022-07-29 15:58:02 +03:00
137ddb3ade
Code simplification for Dubins path 2022-07-29 14:12:44 +03:00
Alexander Nozik
99fee476bc
Merge pull request #469 from lounres/feature/polynomials
Feature: Polynomials and rational functions
2022-07-28 18:04:06 +03:00
Gleb Minaev
a2fb14a221 Merge remote-tracking branch 'origin/feature/polynomials' into feature/polynomials 2022-07-28 12:03:12 +03:00
Gleb Minaev
c2025ee1c9 Remove Polynomial interface, fix consequent platform clashes. Add invariance. 2022-07-27 14:36:20 +03:00
Alexander Nozik
b5406e460e
Merge branch 'dev' into feature/polynomials 2022-07-27 08:26:08 +03:00
323e8b6872
Code simplification for Dubins path 2022-07-26 09:19:04 +03:00
1e8a8cac7e
Fix readme 2022-07-24 12:01:02 +03:00
TatianaMy
ad30c68eba
Merge pull request #495 from ESchouten/trajectory
Trajectory: Dubins path
2022-07-24 11:29:24 +03:00
Gleb Minaev
0c6ad35c13 Simplify the version catalog usage. 2022-07-23 10:24:52 +03:00
Gleb Minaev
e1b8fcdbbf Two consecutive dots... 2022-07-20 19:10:35 +03:00
Gleb Minaev
fe4eb96dae Add docs. 2022-07-20 19:09:20 +03:00
Gleb Minaev
163a7c717a Fix description. 2022-07-20 08:28:47 +03:00
Gleb Minaev
9d4df5d8e0 Add and regenerate READMEs. Fix files' directory. 2022-07-20 08:22:41 +03:00
Erik Schouten
f2cbbeba20 Author details 2022-07-17 15:56:24 +02:00
Erik Schouten
429eefa3f7 Arc direction as computed property 2022-07-17 15:48:08 +02:00
Erik Schouten
86fce7ec68 Arc contains circle, circle direction is computed from poses, factory function can create Arc based on Vector points and provided direction 2022-07-17 15:47:05 +02:00
Erik Schouten
8faa312424 Dubins factory functions 2022-07-17 14:56:21 +02:00
Erik Schouten
3260c3d171 Pose2D facrtory function 2022-07-17 14:39:43 +02:00
Erik Schouten
7de157ce24 Re-introduce line/straight segment, rename components to start/end 2022-07-17 14:21:12 +02:00
Gleb Minaev
f48e4483cc Last cosmetic changes. 2022-07-16 22:21:13 +03:00
Gleb Minaev
2d86cf1cc7 Remove power overriding and algebraic stub. 2022-07-16 21:55:35 +03:00
Gleb Minaev
99c7174802 Turn Polynomial data class back. 2022-07-16 20:55:10 +03:00
Gleb Minaev
58d7015782 Remove utils modules. Revive suddenly lost tests. 2022-07-16 20:15:30 +03:00
Gleb Minaev
3a91cb2579 Draft another DSL for labeled polynomials. Add variance. 2022-07-16 18:46:40 +03:00
Gleb Minaev
db19df4329 Merge branch 'dev' into feature/polynomials 2022-07-16 17:23:39 +03:00
Gleb Minaev
a1a2c41846 Add a bit more utilities for maps and refactor polynomials' code. 2022-07-16 17:13:05 +03:00
3eef778f60
Add mandatory MutableBufferFactory to Algebra #477 2022-07-16 16:27:11 +03:00
Gleb Minaev
579511a5ee Add utilities for maps. Fix some tests. 2022-07-16 16:07:03 +03:00
68add4cb5f
Refactor test naming 2022-07-16 11:35:50 +03:00
b522e5919e
Merge remote-tracking branch 'origin/dev' into dev 2022-07-16 10:19:55 +03:00
Alexander Nozik
fc036215a5
Merge pull request #402 from mipt-npm/commandertvis/diff
Copy `DerivativeStructure` from Commons Math to multiplatform
2022-07-16 10:05:59 +03:00
Alexander Nozik
debff5357b
Merge pull request #494 from mipt-npm/altavir/diff
altavir/diff
2022-07-16 09:58:43 +03:00
Erik Schouten
4f88982734 Formatting 2022-07-15 22:13:50 +02:00
Erik Schouten
fa6d741869 Small improvement in test classes, theta function 2022-07-15 22:12:36 +02:00
Erik Schouten
ada1141738 Use Line distancTo function 2022-07-15 18:57:10 +02:00
Erik Schouten
cdb116fa20 Cleanup 2022-07-15 18:55:37 +02:00
Erik Schouten
32769d6906 Dubins path 2022-07-15 18:13:50 +02:00
18ae964e57
Name refactor 2022-07-15 17:35:13 +03:00
bfadf5b33d
Name refactor 2022-07-15 17:31:28 +03:00
846a6d2620
Grand derivative refactoring. Phase 3 2022-07-15 17:20:00 +03:00
f5fe53a9f2
Grand derivative refactoring. Phase 2 2022-07-15 16:20:28 +03:00
5846f42141
Grand derivative refactoring. Phase 1 2022-07-15 15:21:49 +03:00
Gleb Minaev
4ea29c82c5 Small fix of DSL1. 2022-07-13 12:05:53 +03:00
56f3c05907
Merge remote-tracking branch 'origin/dev' into altavir/diff 2022-07-13 10:13:47 +03:00
Gleb Minaev
87aeda84d9 Added MathJax to docs. 2022-07-12 23:10:38 +03:00
0eb9bd810c
Kotlin 1.7.10 2022-07-12 22:56:08 +03:00
Gleb Minaev
f7d159bc03 Made IntModulo implement ScaleOperations. 2022-07-12 02:05:29 +03:00
Gleb Minaev
5bc627f1d4 Rollback all breaking changes. The only breaking change now is value class. 2022-07-12 01:56:34 +03:00
Gleb Minaev
6ff79e28ac Fix names, references, etc. 2022-07-12 00:57:44 +03:00
Gleb Minaev
f726e6d0f1 Minimise appearance of new feature, leave only upgrades. 2022-07-11 23:32:15 +03:00
Gleb Minaev
51dd72e48f Finish move. 2022-07-11 22:39:13 +03:00
Gleb Minaev
1c719b9e70 Fix examples. 2022-07-11 17:52:46 +03:00
Gleb Minaev
d44a48bdb1 Moving to new modules. 2022-07-11 17:27:59 +03:00
Gleb Minaev
d3be07987c Simplify usages of LabeledPolynomial constructing fabrics. Fix bugs. Add tests for variable's interoperability. 2022-07-06 23:16:25 +03:00
Gleb Minaev
923c52737d Adapt NumberedPolynomial tests to LabeledPolynomial tests. 2022-07-06 17:13:50 +03:00
Gleb Minaev
5834fad938 Renamed constructing DSLs components. Fixed rejected NumberedPolynomial tests. 2022-07-06 00:37:46 +03:00
Gleb Minaev
45ed45bd13 Finish tests generation for numbered utilities. Also:
- Optimize a bit labeled and numbered differentiation.
- Fixed bugs in numbered anti-differentiation.
2022-07-05 03:41:52 +03:00
Gleb Minaev
e40977647d Added suppresses. 2022-07-05 03:35:56 +03:00
Gleb Minaev
e89e4e19d3 Return suppresses. 2022-07-04 03:54:28 +03:00
Gleb Minaev
39088ec36b Replaced assertFailsWith with assertFailsWithTypeAndMessage. 2022-07-04 02:36:46 +03:00
Gleb Minaev
102e83b478 Tests generation for numbered utilities in progress: finish substitutions. 2022-07-04 02:24:46 +03:00
Gleb Minaev
672a3c1552 Tests generation for numbered utilities in progress: finish map-wise substitutions. Also:
- Upgrade operations on Rational.
- Add new assertions.
- Changed a bit FIXME comments.
2022-07-03 15:47:12 +03:00
Gleb Minaev
f147636e9d Tests generation for numbered utilities in progress. 2022-07-01 14:46:05 +03:00
Gleb Minaev
c8b9951f46 Added for list utilities for rational functions. 2022-06-29 14:54:49 +03:00
Gleb Minaev
64b33aed18 Remove extra suppresses. 2022-06-29 14:53:12 +03:00
Gleb Minaev
da46ea923c Extended test for NumberedPolynomial 2022-06-28 15:07:09 +03:00
Gleb Minaev
043d292eca Added test. Fixed bug in NumberedPolynomial's DSL. 2022-06-27 17:14:03 +03:00
Gleb Minaev
0ef2258665 Removed extra suppresses. 2022-06-27 17:11:39 +03:00
Gleb Minaev
ed634013f6 Removed extra suppresses. 2022-06-27 17:07:33 +03:00
Gleb Minaev
cb7291ccb0 Little addition to polynomials design note. 2022-06-26 12:58:30 +03:00
Gleb Minaev
630d16bbee Added design notes. Also:
- Changed `xxxPolynomialSpace()` and `xxxPolynomialSpace()` functions to `xxxPolynomialSpace` value properties.
- Changed inconsistency of names `XxxRationalFunctionalSpaceYyy` and `XxxRationalFunctionSpaceYyy` in favor of second one.
2022-06-26 12:16:51 +03:00
Gleb Minaev
fc2455fe34 Merge branch 'dev' into feature/polynomials 2022-06-25 23:29:34 +03:00
Gleb Minaev
3e917baaaf Added examples for polynomials. Also:
- Fixed bug in differentiation of NumberedPolynomials.
- Fixed bug in addition and subtraction of LabeledPolynomials.
- Added references to NumberedPolynomialWithoutCheck and LabeledPolynomialWithoutCheck.
- Made NumberedRationalFunction and LabeledRationalFunction classes data. Made their constructor public.
2022-06-25 21:23:32 +03:00
Gleb Minaev
403ff93f4a Moved optimizations to branch refactor/polynomials 2022-06-25 16:01:18 +03:00
Gleb Minaev
9fc99a4c72 Removed extra copyright comment. 2022-06-25 15:45:10 +03:00
Gleb Minaev
6c8fa29304 Merge branch 'feature/polynomials-sift' into feature/polynomials 2022-06-18 01:26:33 +03:00
Gleb Minaev
d416f8cf34 Merge branch 'dev' into feature/polynomials 2022-06-18 01:25:46 +03:00
Gleb Minaev
680d23ddcb Last sift. Cleaned up labeled structures. 2022-06-18 01:25:14 +03:00
Gleb Minaev
1ea336b70e Added some test of NumberedPolynomial utilities. 2022-06-17 22:07:54 +03:00
Gleb Minaev
b5a94923b5 Fixed problems with JVM names. Exposed internal NumberedPolynomial constructor with opt-in condition. Added and upgraded tests. Fixed small bugs (mistakes). Upgraded arithmetic operations a bit. 2022-06-17 01:53:40 +03:00
a1267d84ac
Fix quaternion rotation tests 2022-06-14 20:58:13 +03:00
Gleb Minaev
eadd521e35 Merge branch 'dev' into feature/polynomials-sift 2022-06-14 19:46:50 +03:00
b5031121ce
up build tools 2022-06-14 19:31:13 +03:00
Gleb Minaev
d0134bdbe9 Sift 4. Cleaned up "numbered" case. Tests are in progress. 2022-06-14 19:15:36 +03:00
a810790d8d Merge SCI-MR-158: Fix name clash in strict mode; replace eval with new Function 2022-06-14 15:59:58 +00:00
Iaroslav Postovalov
b09127f090
Fix name clash in strict mode; replace eval with new Function 2022-06-14 22:52:47 +07:00
Alexander Nozik
f0053daf77
Merge pull request #489 from lounres/docs-latex-update
Inlined LaTeX formula
2022-06-14 18:09:29 +03:00
85a1e8b33f
New common test infrastructure 2022-06-14 16:27:32 +03:00
Gleb Minaev
58e0715714 Removed duplicates of copyright comments. 2022-06-13 12:15:14 +03:00
Gleb Minaev
5928adfe45 Fixed merging accidents. 2022-06-13 12:08:58 +03:00
Gleb Minaev
4e08d6d877 Merge branch 'feature/polynomials-listPolynomials-applications' into feature/polynomials-sift 2022-06-13 12:04:57 +03:00
1fd8dfd7b8
refactor Quaternions 2022-06-13 11:17:41 +03:00
Gleb Minaev
37ad48e820 Sift # 3. Filtered last sift and usages of [ListPolynomial]s. 2022-06-13 02:06:15 +03:00
Gleb Minaev
dbb48a2a9f Added docstrings to ListPolynomial and ListRationalFunction fabric functions. 2022-06-13 01:41:04 +03:00
Gleb Minaev
ab9bba2202 Put suddenly disappeared files back. 2022-06-13 00:16:22 +03:00
Gleb Minaev
b50d8dcd23 Merge branch 'feature/polynomials-ListPolynomials' into feature/polynomials-sift
# Conflicts:
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/ListPolynomial.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/ListRationalFunction.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/RationalFunction.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/listUtilOptimized.kt
#	kmath-functions/src/commonTest/kotlin/space/kscience/kmath/functions/ListPolynomialTest.kt
#	kmath-functions/src/commonTest/kotlin/space/kscience/kmath/functions/ListPolynomialUtilTest.kt
#	kmath-functions/src/commonTest/kotlin/space/kscience/kmath/test/misc/IntModulo.kt
#	kmath-functions/src/commonTest/kotlin/space/kscience/kmath/test/misc/misc.kt
2022-06-12 23:54:30 +03:00
Gleb Minaev
94fd24d852 Fixed some tests and docstrings. Removed zero and one overridings because overrided fields are already lazily initialized. 2022-06-12 23:49:44 +03:00
Gleb Minaev
e710013800 Fixed tests. 2022-06-12 23:02:26 +03:00
Gleb Minaev
3a6aa14320 Cleaned up ListPolynomials and ListRationalFunctions:
- Added/updated docs.
- Fully (but in a simple way) implemented invocation, substitution, functional representation, derivatives and antiderivatives. Optimized reimplementation is in progress.
- Upgraded `PolynomialSpaceOfFractions` by adding a bit of laziness.
- Other little things...
2022-06-12 22:52:08 +03:00
fabad733f4
Fix binaryen module creation 2022-06-12 15:30:10 +03:00
e1276b684f
Update better-parse 2022-06-12 15:19:59 +03:00
569e01fce1
Migration to kotlin 1.7 2022-06-12 15:16:40 +03:00
Gleb Minaev
17703e407d Applied changes from previous sift. 2022-06-12 00:24:23 +03:00
Gleb Minaev
a6b86eeee1 Cleaned out useless code. 2022-06-11 19:31:01 +03:00
Gleb Minaev
03b92de6e0 Sifted ListPolynomial's basics. 2022-06-11 19:29:14 +03:00
Gleb Minaev
8af183a969 Fixed typos. Added docstrings. Added variable convertional methods. 2022-06-11 19:22:57 +03:00
Gleb Minaev
a2b02ef09e Sifted rest usage of non-basic polynomial things. 2022-06-11 16:15:59 +03:00
Gleb Minaev
9b51062bf7 Sift. 2022-06-11 16:09:24 +03:00
Gleb Minaev
89cdbf4d71 Changed names of algebraic stub. Added FIXMEs about KT-31420. Changed JVM/JS names style. 2022-06-11 15:58:25 +03:00
Gleb Minaev
b92ef23f5d
Some fixes 2022-06-11 00:06:45 +03:00
Gleb Minaev
de9f3cc8df Inlined LaTeX formula. Now GitHub supports MathJax! 2022-06-10 23:37:50 +03:00
c28be83226
LazyStructire::deferred -> async 2022-06-08 09:00:37 +03:00
Gleb Minaev
af2e437a48 Merge branch 'master' into feature/polynomials
# Conflicts:
#	README.md
#	kmath-ast/README.md
#	kmath-complex/README.md
#	kmath-core/README.md
#	kmath-ejml/README.md
#	kmath-for-real/README.md
#	kmath-functions/README.md
#	kmath-jafama/README.md
#	kmath-kotlingrad/README.md
#	kmath-nd4j/README.md
#	kmath-tensors/README.md
2022-06-03 21:58:37 +03:00
5a36c3e03c
Remove metaspace memory allocation key 2022-04-13 11:20:11 +03:00
Alexander Nozik
2144c6382c
Update pages.yml 2022-04-12 12:02:11 +03:00
Alexander Nozik
7e4ece8dbc
Update publish.yml 2022-04-12 11:56:12 +03:00
Alexander Nozik
b698f2d613
Update pages.yml 2022-04-12 11:10:14 +03:00
Alexander Nozik
19cd74013b
Update pages.yml 2022-04-12 11:06:18 +03:00
Alexander Nozik
5bb895a653
Merge pull request #480 from mipt-npm/dev
0.3.0
2022-04-12 10:59:28 +03:00
358d750226
Add missing @CommanderTvis contributions to changelog 2022-04-12 09:49:35 +03:00
d862a0a896
0.3.0 release 2022-04-11 20:08:13 +03:00
74e6bc65a3
0.3.0 release 2022-04-11 20:07:40 +03:00
916bc69e4b
Revert changes in tensor algebra to remove name conflicts 2022-04-11 17:32:16 +03:00
7e4d223044
Fixed missing TF basic operations 2022-04-11 14:56:48 +03:00
b509dc917d
ValueAndErrorField 2022-04-10 23:00:55 +03:00
Iaroslav Postovalov
ff58985d78
Merge pull request #476 from mipt-npm/refactor/histogram
Complete refactor of histograms API
2022-04-11 00:59:04 +07:00
1295a407c3
Refactor tree histogram 2022-04-10 15:29:46 +03:00
6247e79884
Refactor multivariate histograms 2022-04-10 13:41:41 +03:00
27a252b637
Accept changes, Update documentation 2022-04-10 11:31:52 +03:00
229c36b661
Accept changes 2022-04-10 10:32:36 +03:00
Alexander Nozik
40b088149b
Update kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt
Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
2022-04-10 10:29:59 +03:00
Alexander Nozik
86d89f89f9
Update kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt
Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
2022-04-10 10:29:44 +03:00
eba3a2526e
[final] Generalize UniformHistogram1D 2022-04-10 09:48:55 +03:00
3de8976ea5
Merge remote-tracking branch 'origin/dev' into refactor/histogram
# Conflicts:
#	buildSrc/gradle.properties
#	gradle/wrapper/gradle-wrapper.properties
2022-04-10 09:41:38 +03:00
Alexander Nozik
c24cf90262
Merge pull request #471 from mipt-npm/commandertvis/gradle
Upgrade gradle tools
2022-04-10 09:40:16 +03:00
3a2faa7da4
Generalize UniformHistogram1D 2022-04-09 10:18:18 +03:00
a2c0bc8a10
Another histogram refactor 2022-04-08 19:41:41 +03:00
73f72f12bc
[WIP] Another histogram refactor 2022-04-05 23:23:29 +03:00
Gleb Minaev
7f7b550674 Simplified polynomial builders. 2022-04-03 11:44:42 +03:00
Iaroslav Postovalov
5988b9ad30
Merge branch 'master' into commandertvis/gradle 2022-04-01 21:56:53 +07:00
Iaroslav Postovalov
97a320c9ef
Use gradle-build-action 2022-04-01 14:02:03 +07:00
Iaroslav Postovalov
bae465fe86
Update GitHub actions 2022-04-01 03:06:07 +07:00
Iaroslav Postovalov
3277a99ed3
Never use GitHub Packages to publish project with 2022-04-01 02:58:12 +07:00
Iaroslav Postovalov
38fd3e24c8
Use correct class name for kotlin JVM compilation 2022-04-01 02:37:14 +07:00
Iaroslav Postovalov
13fb49e48c
Rename version catalog 2022-04-01 02:27:50 +07:00
Iaroslav Postovalov
92cffd78d9
Upgrade gradle tools 2022-04-01 02:23:34 +07:00
Gleb Minaev
b3087c245f Fixed tests. 2022-03-25 17:46:13 +03:00
Gleb Minaev
f7286d33d2 Moved constructors to separate files. Replaced some TODOs with FIXMEs. 2022-03-25 17:18:56 +03:00
Gleb Minaev
7e328a5dbf Enhanced DSL constructor a bit. 2022-03-25 00:59:48 +03:00
Gleb Minaev
060f0ee35d Removed comparability feature. 2022-03-25 00:57:32 +03:00
ce82d2d076 Histogram API refactor 2022-03-23 15:51:08 +03:00
3a3a5bd77f Histogram API refactor 2022-03-23 14:07:24 +03:00
29369cd6d7
[WIP] Another histogram refactor 2022-03-22 22:17:20 +03:00
Gleb Minaev
420bf05b22 Fixed annoying JVM clashes 😑 2022-03-22 19:42:59 +03:00
Gleb Minaev
0a5122a974 Prototyped DSL-like constructor for NumberedPolynomial. 2022-03-22 19:40:55 +03:00
Gleb Minaev
d75a41482d Added fabrics for LabeledPolynomial and NumberedPolynomial. 2022-03-22 17:09:33 +03:00
Gleb Minaev
5b8d6b601e Added degreeBy to Numbered.... 2022-03-22 15:37:19 +03:00
Gleb Minaev
b44c99c265 Added multivariate abstractions. 2022-03-22 15:28:34 +03:00
Gleb Minaev
39ce855075 Added constructors for RFs' spaces 2022-03-22 14:25:09 +03:00
Gleb Minaev
2f9e504357 Added division to RFs' Spaces. Added conversion to polynomial and RFs' spaces. Added requirements for RFs' denominators' changes for case of non-integral domain. Added requirements for non-zero divisor to RFs' divisions. 2022-03-22 13:58:29 +03:00
Gleb Minaev
09868f090b Enhanced tests of Double substitution. 2022-03-22 02:39:43 +03:00
Gleb Minaev
98b9a70893 Enhanced tests of Double substitution. 2022-03-22 02:37:26 +03:00
Gleb Minaev
c6d1068df4 Renamed Polynomial, etc. to ListPolynomial, etc. and AbstractPolynomial to Polynomial.
As it was advised by @CommanderTvis.
2022-03-21 23:47:10 +03:00
Gleb Minaev
51b0d232b5 Renamed AbstractPolynomialFractionsSpace to PolynomialSpaceOfFractions 2022-03-21 23:21:55 +03:00
Gleb Minaev
83d57c7295 Added RFs' interface to remove another boilerplate. Fixed bug in RFs' equalsTo. 2022-03-21 21:22:25 +03:00
Gleb Minaev
88e0dcf413 Added usage of more correct exceptions. 2022-03-21 18:26:09 +03:00
Gleb Minaev
25ec59b985 Finished with tests for Polynomial. 2022-03-20 23:22:39 +03:00
Gleb Minaev
fbc21101bb Added test. Fixed isOne and isMinusOne for Polynomial. 2022-03-20 06:26:52 +03:00
Gleb Minaev
5d4514a742 More test tools! More tests!! More fixes of stupid bugs!!! 😭 2022-03-19 19:35:41 +03:00
Gleb Minaev
90a7c4d901 Simplified use of Rational (current BigInt are hard to use and actually useless). Added tests, fixed bug. 2022-03-19 18:08:43 +03:00
Gleb Minaev
a965f5683f Added some tests and some utilities for tests. Fixed bug in utility of PolynomialSpace. 2022-03-19 16:54:30 +03:00
39640498fc
Another histogram refactor 2022-03-19 09:20:32 +03:00
Gleb Minaev
85cd3b4de6 Added some test. Fixed bug in algebraicStub.kt 2022-03-18 20:39:01 +03:00
Gleb Minaev
cdc85291bc Fixed bug in implementations of polynomial operations 2022-03-18 20:04:21 +03:00
Gleb Minaev
ed2f14b68e Optimised existing substitution function. Prototyped substitution for RFs. 2022-03-18 01:47:03 +03:00
Gleb Minaev
86553e9f35 Added utilities. Rewrote polynomial-in-polynomial substitution 2022-03-17 16:28:41 +03:00
Gleb Minaev
d63c4acf10 Added space and scope fabrics for RFs 2022-03-17 16:27:02 +03:00
Gleb Minaev
ffd3ae7684 Optimized allocation during coefficients generation in Polynomial 2022-03-17 16:02:41 +03:00
Gleb Minaev
a8a95c9df7 Fixed typo 2022-03-17 02:15:48 +03:00
Gleb Minaev
e5186d469a Fixed issue with confusing countOfVariables in Numbered... 2022-03-17 02:12:40 +03:00
Gleb Minaev
2082175af5 Fixed typos. 2022-03-16 23:31:07 +03:00
Gleb Minaev
75fd920735 Deleted suddenly missed region marks and unused error classes 2022-03-16 23:22:51 +03:00
Gleb Minaev
3c9d8a4eee Deleted all region marks 2022-03-16 22:44:55 +03:00
Gleb Minaev
24944cdb16 Added support of power function to abstract structures.
Implemented exponentiation by squaring as default implementation of `power`. Updated docs in algebraicStub.kt and updated realisations in it.
2022-03-16 15:19:27 +03:00
Gleb Minaev
9aa131a9c6 Replaced Variable in Labeled... by Symbol and deleted it 2022-03-16 01:06:39 +03:00
Gleb Minaev
16cf1bc65e Implemented all derivative-like functions 2022-03-16 00:47:07 +03:00
Gleb Minaev
bb5e638b31 Added polynomial spaces and scopes fabrics 2022-03-15 20:38:27 +03:00
Gleb Minaev
1f9d8d34f5 Tried to add constructors and/or fabrics for polynomials 2022-03-15 20:18:39 +03:00
Gleb Minaev
91c9ea61da Added derivative-like functions to Polynomial 2022-03-15 18:10:11 +03:00
Gleb Minaev
1754ae0695 Added some docs 2022-03-15 16:43:22 +03:00
Gleb Minaev
79736a0a9b Forgot to remove unnecessary tailrec 2022-03-15 15:36:10 +03:00
Gleb Minaev
f86529d659 Optimized optimizedMultiply and optimizedAddMultiplied for cases of negative value of other and multiplier 2022-03-15 15:35:17 +03:00
Gleb Minaev
ebd7f799ad Attempts to implement derivatives and antiderivatives 2022-03-15 00:47:23 +03:00
Gleb Minaev
31ccf744c5 Deleted useless annotations JvmName, JsName and Suppress 2022-03-14 23:33:00 +03:00
Gleb Minaev
fb01d85197 Removed extra JSName annotations. Now everything builds 2022-03-14 22:23:50 +03:00
Gleb Minaev
44febbdd73 Processed labeledRationalFunctionUtil.kt 2022-03-14 20:19:42 +03:00
Gleb Minaev
dd820da765 1. Prototyped rest 2 algebraic structures of rational functions
2. Added `constantZero` and `constantOne` to abstract spaces and applied them instead of `ring.zero` and `ring.one`
3. Moved logic of `R.isZero` and 5 others to `AbstractRationalFunctionalSpace`
4. Deleted forgotten overridden functions of constants
5. Added KMath contributors' copyright notes
6. Added TODO 😄 The `NumberedPolynomial`'s `countOfVariables` is a confusing
2022-03-14 19:59:53 +03:00
Gleb Minaev
07f4b83722 Fixed forgotten TODOs 2022-03-14 14:18:15 +03:00
Gleb Minaev
de53d032af 1. Prototyped Rational Functions
2. Added abstract interfaces for removing boilerplates
3. Changed or added default values in interfaces
4. Renamed non-operator `equals` to `equalsTo`, and made it infix
2022-03-14 14:14:24 +03:00
Gleb Minaev
033edd3feb Removed kotlin-js-store 2022-03-13 03:55:51 +03:00
Gleb Minaev
59e65afc63 Merge remote-tracking branch 'origin/feature/polynomials' into feature/polynomials
# Conflicts:
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt
#	kotlin-js-store/yarn.lock
2022-03-13 03:53:29 +03:00
Gleb Minaev
93de1d5311 Added support for all polynomials. But standard utilities still are not fully implemented. 2022-03-13 03:44:16 +03:00
Gleb Minaev
571c6342dd Regenerated READMEs 2022-03-13 03:44:16 +03:00
Gleb Minaev
cab5958107 Added abstract rational functions 2022-03-13 03:44:16 +03:00
Gleb Minaev
191dd02e47 Restructured Polynomial 2022-03-13 03:44:15 +03:00
Gleb Minaev
843d63c76a Added support for all polynomials. But standard utilities still are not fully implemented. 2022-03-13 03:27:00 +03:00
Gleb Minaev
ffea8cc223 Regenerated READMEs 2022-03-13 03:25:25 +03:00
Gleb Minaev
ab9dcd83b9 Added abstract rational functions 2022-03-10 01:44:14 +03:00
Alexander Nozik
92ba439f2a
Merge pull request #468 from mipt-npm/dev
Build fixes
2022-03-08 23:17:17 +03:00
0b2e8ff25e
Build fixes 2022-03-08 23:15:48 +03:00
Alexander Nozik
df075718db
Merge pull request #466 from mipt-npm/dev
Dev
2022-03-07 22:07:41 +03:00
Iaroslav Postovalov
8518f333e3 Delete yarn.lock 2022-03-08 01:31:31 +07:00
4575ab2b79
Update interpolation API to agree with other conventions. 2022-03-07 10:39:59 +03:00
Gleb Minaev
2483c56f1c Restructured Polynomial 2022-03-03 20:45:35 +03:00
Alexander Nozik
c80f70fe0f
Merge pull request #461 from ivandev0/kylchik/jacobi
Jacobi eigenvalue algorithm
2022-02-20 10:18:06 +03:00
Ivan Kylchik
a621dd7c5b Drop duplicate test from DorBenchmark 2022-02-20 02:55:37 +03:00
Ivan Kylchik
dda6602ed4 Replace complex access to tensor with faster access to buffer in Jacobi algorithm 2022-02-20 02:51:35 +03:00
Ivan Kylchik
b13765ec19 Implement much faster Jacobi algorithm 2022-02-20 02:51:35 +03:00
Ivan Kylchik
7aff774bc1 Improve Jacobi algorithm readability by extracting some logic into helper fun 2022-02-20 02:51:35 +03:00
Ivan Kylchik
7a72a0b979 Implement Jacobi algorithm to find eigenvalues 2022-02-20 02:51:35 +03:00
ac3adfa644
Fix tf dot 2022-02-17 22:46:17 +03:00
Ivan Kylchik
a78e361b17 Implement much faster dot product algorithm for tensors 2022-02-18 00:13:23 +07:00
Alexander Nozik
8974164ec0
Merge pull request #459 from mipt-npm/dev
v0.3.0-dev-18
2022-02-13 17:50:33 +03:00
408443989c
Up version 2022-02-13 17:48:04 +03:00
Iaroslav Postovalov
745a7ad66e Add complete constant folding in kmath-ast by introducing TypedMst, some minor changes 2022-02-11 20:46:30 +07:00
Iaroslav Postovalov
7b1bdc21a4 Copy DerivativeStructure to multiplatform 2022-02-09 22:08:37 +07:00
Alexander Nozik
ef747f642f
Merge pull request #458 from mipt-npm/commandertvis/no-evaluate
Remove Algebra.evaluate(MST) by inlining it into interpret
2022-02-09 18:04:48 +03:00
Iaroslav Postovalov
e094f6e8ee Remove Algebra.evaluate(MST) by inlining in into interpret 2022-02-08 11:43:50 +07:00
53ab8334dd Merge SCI-MR-149: Fix theta 2022-02-02 07:00:26 +00:00
Iaroslav Postovalov
d35516b9af Fix theta 2022-02-02 10:00:45 +07:00
7bb66f6a00
Add TensorFlow prototype 2022-01-29 15:02:46 +03:00
41fc6b4dd9
Merge branch 'feature/tensorflow' into dev 2022-01-28 09:46:55 +03:00
Alexander Nozik
2e13d518f6
Merge pull request #451 from mipt-npm/commandertvis/js-benchmark
Make JS benchmarks of expressions
2022-01-26 17:44:00 +03:00
Iaroslav Postovalov
8607639876 Change units 2022-01-26 20:33:44 +07:00
Iaroslav Postovalov
d10815020d JS benchmarking 2022-01-26 16:46:38 +07:00
91d93b3bb2
restore metaspace 2022-01-04 19:45:24 +03:00
dd8a4796f6
Update gradle plugin and build consistency 2022-01-04 13:15:50 +03:00
479d106165
install Kover plugin 2021-12-30 18:50:47 +03:00
Alexander Nozik
4b4c878e21
Merge pull request #447 from mipt-npm/commandertvis/fixbuild
Do numeric type conversion in JS MST compilers
2021-12-30 16:54:27 +03:00
2f96d619fc
Fix AST JS test 2021-12-29 20:08:26 +03:00
Alexander Nozik
4badc3e044
Merge pull request #448 from breandan/master
Update Kotlin∇ and remove old Maven repositories
2021-12-25 21:20:42 +03:00
breandan
6255a46004 update Kotlin∇ and remove old maven repositories 2021-12-25 12:05:42 -05:00
e11df4fdd5
Add inline to histogram builders 2021-12-18 21:57:06 +03:00
Iaroslav Postovalov
a9779fe38b Do numeric type conversion in JS MST compilers 2021-12-07 12:00:31 +07:00
Alexander Nozik
f6fa288011
Merge pull request #445 from mipt-npm/commandertvis/gram
Rewrite the `ArithmeticsEvaluator.number` rule to handle well both floating-point numbers and integers
2021-12-02 09:40:55 +03:00
Alexander Nozik
a3556ecdb3
Merge pull request #444 from mipt-npm/commandertvis/specialized
Completely specialized expression types for `Int`, `Long`, `Double` and compilation of MST to it
2021-12-02 09:40:26 +03:00
Iaroslav Postovalov
cf5f886226 Rewrite the ArithmeticsEvaluator.number rule to handle well both floating-point numbers and integers 2021-11-29 13:50:06 +07:00
Iaroslav Postovalov
5ba7d74bd2 Completely specialized expression types for Int, Long, Double and compilation of MST to it 2021-11-28 20:56:01 +07:00
Alexander Nozik
c6a4721d64
Merge pull request #443 from mipt-npm/commandertvis/update
Update gradle-tools, make Kotlin 1.6.0 migrations
2021-11-24 11:58:34 +03:00
Iaroslav Postovalov
d2e3110480 Update gradle-tools, do Kotlin 1.6.0 migrations 2021-11-24 15:32:06 +07:00
24799a691f Add inc/dec to counters 2021-11-23 10:32:51 +03:00
Alexander Nozik
4691caaa7f
Merge pull request #435 from alexismanin/feat/permsort
Feat/permsort
2021-11-21 20:21:18 +03:00
Alexis Manin
06a6a99ef0 feat(Core): add new flavors of permSort: allow user to specify a comparator (sort with) or a custom field to use in buffer values (sort by). 2021-11-18 17:44:53 +01:00
Alexis Manin
0f7a25762e feat(Core): add a permutation sorting prototype for buffers
This is a Buffer extension function to create a list of permuted indices that represent the sequence of naturally sorted buffer elements
2021-11-17 13:19:40 +01:00
Iaroslav Postovalov
e38b2e1c53 Only dump ASM classes during tests if according property is passed to Gradle 2021-11-17 19:03:20 +07:00
Alexander Nozik
a6922ab9d8
Merge pull request #440 from mipt-npm/commandertvis/license
Revert license removal and update copyright
2021-11-16 17:38:29 +03:00
Iaroslav Postovalov
7ceb0b69b8 Revert license removal and update copyright 2021-11-16 18:14:34 +07:00
Alexander Nozik
e25827eb14
Merge pull request #437 from mipt-npm/commandertvis/double-specialized
Provide specializations of `AsmBuilder` for `Double`, `Long`, `Int`
2021-11-16 11:41:53 +03:00
Alexander Nozik
b1911ebe2d
Merge pull request #438 from mipt-npm/commandertvis/411
Relax type requirements in algebraExtensions.kt from `Ring` to `Group`
2021-11-16 10:52:41 +03:00
Iaroslav Postovalov
70ac232c15 Relax type requirements in algebraExtensions.kt from Ring to Group 2021-11-16 14:27:20 +07:00
Iaroslav Postovalov
7b50400de5 Provide specializations of AsmBuilder for Double, Long, Int 2021-11-16 14:03:12 +07:00
Iaroslav Postovalov
f231d722c6 Multiple performance improvements related to ASM
1. Argument values are cached in locals
2. Optimized Expression.invoke function
3. lambda=indy is used in kmath-core
2021-11-15 23:29:15 +07:00
4e16cf1c98 Merge remote-tracking branch 'origin/feature/tensorflow' into feature/tensorflow 2021-11-10 20:04:45 +03:00
6c2abdaab0 First tensorflow test. 2021-11-10 20:04:29 +03:00
c583320051 Merge branch 'dev' into feature/tensorflow
# Conflicts:
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/DoubleTensorAlgebra.kt
2021-11-10 11:52:11 +03:00
9a1f8a2266 remove unnecessary toInt 2021-11-10 11:51:20 +03:00
fa9ff4c978 Minor refactoring 2021-11-09 17:56:53 +03:00
d62bc66d4a Refactoring 2021-11-09 13:42:22 +03:00
f6b576071d Add non-boxing BufferView access 2021-11-09 12:25:17 +03:00
1315a8cd34 views cleanup 2021-11-08 19:57:22 +03:00
a1351aa942 Buffer views 2021-11-08 17:50:49 +03:00
bf504ae6c5 Basic series 2021-11-05 16:58:13 +03:00
0e1e97a3ff Multik integration finished (for now) 2021-11-04 10:58:27 +03:00
726864ed0e Refactoring of power 2021-11-03 12:55:29 +03:00
Alexander Nozik
bd0895b268
Merge pull request #426 from grinisrit/dev
fix argmax
2021-11-01 21:48:36 +03:00
Roland Grinis
62e7073ed2 example fixed 2021-11-01 18:03:46 +00:00
Roland Grinis
a994b8a50c fix argmax 2021-11-01 17:55:10 +00:00
b65197f577 revert parts of tensor api to tensors 2021-11-01 19:45:02 +03:00
Alexander Nozik
eb1bc5acc4
Merge pull request #424 from grinisrit/feature/tensorflow
dot fixed for tensorflow
2021-10-29 15:20:20 +03:00
Roland Grinis
db06d10cc2 dot fixed for tensorflow 2021-10-28 19:25:10 +01:00
46e7da9ae0 Tensor algebra generified 2021-10-28 11:18:16 +03:00
0f5f59e175 Merge branch 'dev' into feature/tensorflow 2021-10-28 10:58:53 +03:00
4db7398a28 Tensor algebra generified 2021-10-28 10:58:22 +03:00
64629561af [WIP] TensorFlow refactoring 2021-10-28 10:52:40 +03:00
7bdc54c818 Merge branch 'dev' into feature/tensorflow
# Conflicts:
#	kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/DoubleTensorAlgebra.kt
2021-10-28 09:55:43 +03:00
Alexander Nozik
f8d21ad072
Merge pull request #422 from mipt-npm/refactor/tensor-univeral
Refactor/tensor univeral
2021-10-28 09:51:26 +03:00
29a90efca5 Tensor algebra generified 2021-10-27 14:48:36 +03:00
4635cd3fb3 Refactor TensorAlgebra to take StructureND and inherit AlgebraND 2021-10-26 16:08:02 +03:00
7e59ec5804 Refactor TensorAlgebra to take StructureND and inherit AlgebraND 2021-10-26 09:16:24 +03:00
cc114041c4 Initial implementation of TensorFlow connector 2021-10-24 18:33:39 +03:00
47aeb36979 fix NDArray cast 2021-10-20 17:04:00 +03:00
cfd3f3b7e1 fix NDArray cast 2021-10-20 16:35:52 +03:00
69e6849a12 Name refactoring for tensors 2021-10-20 16:11:36 +03:00
6c4741ede6 [WIP] TensorFlow 2021-10-20 16:06:45 +03:00
40c02f4bd7 Add multik dot for tensors 2021-10-19 10:50:13 +03:00
Alexander Nozik
42259e3eb9
Merge pull request #420 from mipt-npm/dev
0.3.0-dev-17
2021-10-18 13:41:56 +03:00
98bbc8349c 0.3.0-dev-17 2021-10-18 13:18:10 +03:00
Alexander Nozik
ae8655d6af
Merge pull request #419 from mipt-npm/feature/multik
Feature/multik
2021-10-18 13:06:34 +03:00
Alexander Nozik
bfc6cbe5d8
Update multik.kt 2021-10-18 13:04:36 +03:00
dccc92bf2f Switch to multik-default 2021-10-18 12:52:24 +03:00
a81ab474f7 Add multik tensor factories and benchmarks 2021-10-18 11:35:09 +03:00
827f115a92 Multik wrapper 2021-10-17 21:12:14 +03:00
05ae21580b Merge branch 'dev' into feature/multik 2021-10-17 16:44:26 +03:00
9b9fe07044 Specialized operations for ND algebra 2021-10-17 16:42:46 +03:00
6de43ee4ba update multik module 2021-10-17 13:52:40 +03:00
da34d0f71b Merge branch 'dev' into feature/multik 2021-10-17 13:16:39 +03:00
4513b06e87 Shapeless ND and Buffer algebras 2021-10-17 13:09:21 +03:00
688382eed6 Shapeless ND and Buffer algebras 2021-10-17 12:42:35 +03:00
d0354da80a Shapeless ND and Buffer algebras 2021-10-17 11:12:35 +03:00
0ac5363acf Multik wrapper prototype 2021-10-16 11:10:34 +03:00
Alexander Nozik
6a9f4d4626
Merge pull request #417 from mipt-npm/dev
0.3.0-dev-15
2021-10-13 14:56:53 +03:00
8d2770c275 Build tools to 0.10.5 2021-10-13 09:06:54 +03:00
09a9df5213 Add complex power 2021-10-09 20:19:36 +03:00
30e3e80397 Add nd add benchmarks 2021-10-06 12:25:32 +03:00
d9f36365d9 Fix Mean bug 2021-10-04 22:31:06 +03:00
663aaa8b4c Merge remote-tracking branch 'origin/dev' into dev 2021-10-04 12:47:42 +03:00
fd8a61c852 Fix Mean bug 2021-10-04 12:40:30 +03:00
abae29bbed DoubleBuffer algebra refactoring 2021-10-02 18:54:45 +03:00
85aefb5380 Completely remove AlgebraElements.kt 2021-10-02 16:14:38 +03:00
0f634688cc API cleanup 2021-10-02 15:56:57 +03:00
01bbb4bb13 API cleanup 2021-10-02 09:55:52 +03:00
Alexander Nozik
4a066ea364
Merge pull request #415 from V3lop5/master
Added gradle wrapper validation
2021-09-27 18:08:48 +03:00
Paule
a68884142f Added gradle wrapper validation
See https://github.com/marketplace/actions/gradle-wrapper-validation
2021-09-27 12:36:48 +02:00
64781a6785 Move Minuit tmp classes to optimization 2021-09-23 21:44:18 +03:00
974d73e25c Adjust benchmarks. 2021-09-22 22:09:46 +03:00
89eebbecb7 Fix EJML inversion issue 2021-09-21 21:24:27 +03:00
9fcc1b3af2 Split Buffer.kt for better readability 2021-09-19 21:17:26 +03:00
546d56aeee Refactor buffer builders to suit new discoverability pattern 2021-09-19 21:13:07 +03:00
49ec5d1554 Refactor ND builders to suit new discoverability pattern 2021-09-19 20:48:36 +03:00
Alexander Nozik
6dc9e8847a
Merge pull request #404 from mipt-npm/feature/advanced-optimization
Feature/advanced optimization
2021-08-29 11:44:09 +03:00
Alexander Nozik
55ea3658b9
Update CHANGELOG.md
Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
2021-08-27 18:16:24 +03:00
Alexander Nozik
8581b32448
Apply suggestions from code review
Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
2021-08-27 18:13:54 +03:00
Alexander Nozik
b0bbdc122e
Merge pull request #412 from mipt-npm/commandertvis/asm-debug
Add debug property for dumping classes generated with ASM
2021-08-21 18:07:27 +03:00
Iaroslav Postovalov
7e0820d861 Add debug property for dumping classes generated with ASM 2021-08-21 19:58:06 +07:00
Iaroslav Postovalov
0b90dd4df2 Fix #408 2021-08-19 12:44:33 +03:00
Iaroslav Postovalov
3c6b068c39 Avoid using kapt in kmath-jupyter 2021-08-18 16:41:31 +03:00
Alexander Nozik
bcc666d19e
Merge pull request #124 from knok16/experiment_with_geometry_package
Initial geometry projections implemetations
2021-08-18 09:40:40 +03:00
Veniamin Viflyantsev
47ac2dd0a9 returned back test timeouts, decrease number of cases that tests check to make it faster 2021-08-17 23:47:52 +03:00
Ven
f271ded526
Apply suggestions from code review
Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
2021-08-17 21:17:02 +03:00
Veniamin Viflyantsev
603db46eb8 increased test timeouts in geometry project 2021-08-17 21:10:26 +03:00
Alexander Nozik
1bc642efb6
Merge pull request #403 from mipt-npm/commandertvis/tests
Ignore `TestExecutionTime` suite to reduce build time
2021-08-17 19:23:36 +03:00
Alexander Nozik
e7173e9d5d
Merge pull request #406 from mipt-npm/commandertvis/license
Fix copyright in `ejmlCodegen.kt`
2021-08-17 19:22:42 +03:00
Iaroslav Postovalov
ca6955beb5 Fix copyright in ejmlCodegen.kt 2021-08-17 21:38:54 +07:00
Iaroslav Postovalov
b74bc32015 Ignore TestExecutionTime suite to reduce build time 2021-08-17 21:38:00 +07:00
Veniamin Viflyantsev
9023098090 implementation of geometry projections of vectors to a line/plane 2021-08-17 13:59:59 +03:00
8d33d6beab Fixed QOW optimization 2021-08-16 16:40:56 +03:00
dfd6e0a949 Merge remote-tracking branch 'origin/dev' into feature/advanced-optimization
# Conflicts:
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt
#	kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/_generated.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/NoDerivFunctionOptimization.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/XYFit.kt
2021-08-16 09:56:00 +03:00
aaa298616d QOW is working more or less 2021-08-16 09:55:03 +03:00
Alexander Nozik
06fc5bbe66
Merge pull request #400 from mipt-npm/commandertvis/license
Fix path to `LICENSE` in the notice
2021-08-16 08:54:00 +03:00
9b8da4cdcc Fix JS bug with null cast 2021-08-12 20:28:45 +03:00
Iaroslav Postovalov
da27c2e494 Fix path to LICENSE in the notice 2021-08-08 12:27:16 +07:00
a020d1545c merge dev 2021-08-06 12:23:24 +03:00
Alexander Nozik
ff1fee022c
Merge pull request #399 from mipt-npm/commandertvis/jupyter
Avoid using `kapt` in `kmath-jupyter`
2021-08-05 15:40:46 +03:00
Iaroslav Postovalov
adff75bb6b Avoid using kapt in kmath-jupyter #398 2021-08-05 19:09:26 +07:00
Iaroslav Postovalov
86a45504e3 Add contentEquals extension to ND algebra and LinearSpace 2021-08-05 16:45:54 +07:00
Alexander Nozik
21dd5ddd7d
Merge pull request #395 from mipt-npm/commandertvis/time
Extend CI timeout and update GraalVM
2021-08-05 12:20:49 +03:00
Iaroslav Postovalov
8e766497c6 Extend CI timeout and update GraalVM 2021-08-05 16:09:12 +07:00
Alexander Nozik
c377d6cda8
Merge pull request #392 from mipt-npm/commandertvis/build-cache
Use Gradle caching in CI builds
2021-07-29 19:59:49 +03:00
Iaroslav Postovalov
56fed6c16a Use Gradle caching 2021-07-29 23:55:27 +07:00
Alexander Nozik
2aede5b7b9
Merge pull request #390 from mipt-npm/commandertvis/upgrade-deps
Update dependencies
2021-07-29 09:36:24 +03:00
Alexander Nozik
899d7d8152
Merge pull request #391 from mipt-npm/commandertvis/doc
Revise grammar of KDoc comments, refresh documentation files
2021-07-29 09:28:05 +03:00
Iaroslav Postovalov
afd5908784 Revise grammar of KDoc comments, refresh documentation files 2021-07-29 07:16:26 +07:00
Iaroslav Postovalov
fe21f0c954 Update plotly.kt and SLF4J 2021-07-28 05:52:23 +07:00
Alexander Nozik
065f95f912
Merge pull request #386 from pklimai/name-fix
Fix package name
2021-07-21 15:50:48 +03:00
Alexander Nozik
dd776bb0d1
Merge pull request #388 from mipt-npm/commandertvis/publish
Fix publish.yml
2021-07-21 14:03:19 +03:00
Iaroslav Postovalov
dd01c39cbe Fix publish.yml 2021-07-21 17:58:25 +07:00
Iaroslav Postovalov
2d3a5fb5c8 Fix publish.yml 2021-07-21 03:29:15 -07:00
c263b1acbe Fix package name again 2021-07-21 13:25:35 +03:00
ef50a4d963 Fix package name 2021-07-21 12:33:45 +03:00
Iaroslav Postovalov
8b3298f7a8 Exact conversions from Long to Int, Int indexing of Dimension 2021-07-20 11:21:47 -07:00
Iaroslav Postovalov
ec8f14a6e9 Fix publish.yml 2021-07-20 10:19:59 -07:00
Iaroslav Postovalov
bc28412950 Update publish.yml 2021-07-20 10:07:45 -07:00
Alexander Nozik
ca645aec17
Merge pull request #382 from mipt-npm/commandertvis/nopublicoverride
Replace `public override` with `override`
2021-07-19 10:22:15 +03:00
Iaroslav Postovalov
b1998ed1a9 Replace public override with override 2021-07-19 03:12:41 +07:00
Alexander Nozik
3023bd639e
Merge pull request #381 from mipt-npm/commandertvis/dokka
Build infrastructure changes
2021-07-17 13:01:26 +03:00
Iaroslav Postovalov
ef41c3f168 Build infrastructure changes 2021-07-17 16:40:34 +07:00
Iaroslav Postovalov
ecd70f2139
Merge pull request #380 from mipt-npm/commandertvis/contracts
Add contracts to some functions, fix multiple style issues
2021-07-13 23:12:48 +07:00
Iaroslav Postovalov
5d2eaaf68a Add contracts to some functions, fix multiple style issues 2021-07-13 00:38:30 +07:00
3ba12f4999 Generic Buffer Algebra 2021-07-09 14:11:26 +03:00
Iaroslav Postovalov
d50163d247
Merge pull request #376 from mipt-npm/commandertvis/bump
Generate README, bump versions of Kotlin, Gradle, ND4J, ASM
2021-07-03 18:14:03 +07:00
Iaroslav Postovalov
83fc4e28d8 Generate README, bump versions of Kotlin, Gradle, ND4J, ASM 2021-07-03 17:23:45 +07:00
Iaroslav Postovalov
839b1f2a82
Merge pull request #372 from mipt-npm/commandertvis/cmrandom
Update CMRandomGeneratorWrapper
2021-06-20 18:23:30 +07:00
Iaroslav Postovalov
9f513b355c Update CMRandomGeneratorWrapper 2021-06-20 17:42:25 +07:00
Alexander Nozik
4a0c47c3dc
Merge pull request #371 from mipt-npm/commandertvis/gradle_
Refactor benchmark report writer
2021-06-19 19:41:36 +03:00
Iaroslav Postovalov
7feb87ff05 Refactor benchmark report writer 2021-06-19 20:52:26 +07:00
Iaroslav Postovalov
65d0cbbe31
Merge pull request #370 from mipt-npm/commandertvis/astrendering
Some refactoring of AST rendering
2021-06-18 01:01:13 +07:00
Iaroslav Postovalov
5d5f84ad55 Some refactoring of AST rendering 2021-06-15 20:37:40 +07:00
Iaroslav Postovalov
d133f54476
Merge pull request #369 from mipt-npm/commandertvis/benchmarks
Generated benchmarking reports
2021-06-15 20:03:15 +07:00
94c58b7749 Fix Univariate histogram filling 2021-06-15 13:45:08 +03:00
Iaroslav Postovalov
45f1588175 Generated benchmarking reports 2021-06-15 17:14:18 +07:00
Alexander Nozik
cfe6c3ef4b
Merge pull request #368 from mipt-npm/commandertvis/benchmarks
Update Jafama module documentation with some minor code amendments
2021-06-14 20:41:41 +03:00
Iaroslav Postovalov
4d6428a308 Update Jafama module documentation with some minor code amendments 2021-06-14 21:51:06 +07:00
Alexander Nozik
c1b105db2a
Merge pull request #357 from therealansh/kmathJafama
integrate: Jafama + KMath
2021-06-12 10:25:25 +03:00
therealansh
03be37bb4f add: kotlin math benchmarks 2021-06-12 10:07:41 +05:30
therealansh
b99d0b96d8 add:benchmarks to readme 2021-06-12 10:07:41 +05:30
therealansh
9a9ebc7304 add: benchmarks for Jafama 2021-06-12 10:07:41 +05:30
therealansh
590910ac2d add: example and Readme 2021-06-12 10:07:41 +05:30
therealansh
abb3d9fe50 add: Double using StrictMath 2021-06-12 10:05:57 +05:30
therealansh
6c815abd54 chore: refactored and dependency add 2021-06-12 10:05:57 +05:30
therealansh
2dff15c5aa integrate: Jafama + KMath 2021-06-12 10:05:57 +05:30
Alexander Nozik
ecab9a458f
Merge pull request #360 from mipt-npm/commandertvis/just-calculate
Add justCalculate benchmark to inspect overhead of Expression API, some minor refactorings
2021-06-11 09:53:05 +03:00
Alexander Nozik
71b3dc2179
Merge pull request #363 from mipt-npm/commandertvis/readme
Fix README.md again
2021-06-11 09:52:19 +03:00
Iaroslav Postovalov
46bf66c8ee Add justCalculate benchmark, some minor refactorings 2021-06-09 21:50:34 +07:00
Iaroslav Postovalov
7b736a7c81 Fix README.md again 2021-06-09 21:40:47 +07:00
Alexander Nozik
4810f2e63e
Merge pull request #359 from mipt-npm/commandertvis/ga
Enable build workflow for external PRs (w/manual approval)
2021-06-08 17:52:51 +03:00
Iaroslav Postovalov
c0ab082d24 Run build workflow for PRs 2021-06-08 21:14:10 +07:00
Iaroslav Postovalov
a3c64dc273
Merge pull request #358 from mipt-npm/commandertvis/readme
Fix README.md
2021-06-08 07:11:31 -07:00
Iaroslav Postovalov
7d0eff74f6 Fix shield README.md, fix build 2021-06-08 21:11:16 +07:00
95c0b2d3f0 [WIP] optimization with QOW 2021-06-08 14:27:45 +03:00
7f32348e7a Slight adjustment to tensor internals 2021-06-02 21:10:05 +03:00
Iaroslav Postovalov
0f3b3b35d9
Merge pull request #356 from mipt-npm/commandertvis/symja
Fix up Symja build issues
2021-05-29 16:07:57 +07:00
Iaroslav Postovalov
a02cf0487c Merge branch 'master' into commandertvis/symja 2021-05-29 15:50:33 +07:00
Iaroslav Postovalov
65e0560553 Fix Symja build issues 2021-05-29 15:50:16 +07:00
Alexander Nozik
8da331f476
Merge pull request #351 from mipt-npm/commandertvis/symja
Integration between MST and Symja IExpr
2021-05-26 18:01:25 +03:00
c8621ee5b7 [WIP] optimization refactoring 2021-05-25 21:11:57 +03:00
f84f7f8e45 Merge branch 'dev' into feature/advanced-optimization
# Conflicts:
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/DifferentiableExpression.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/XYFit.kt
2021-05-25 17:00:02 +03:00
f2b7a08ad8 Remove second generic from DifferentiableExpression 2021-05-25 16:53:53 +03:00
c240fa4a9e [WIP] optimization refactoring 2021-05-25 16:42:23 +03:00
88e94a7fd9 [WIP] Optimization 2021-05-24 17:02:12 +03:00
3ec674c61b Merge branch 'dev' into feature/advanced-optimization
# Conflicts:
#	examples/src/main/kotlin/space/kscience/kmath/functions/integrate.kt
#	examples/src/main/kotlin/space/kscience/kmath/functions/matrixIntegration.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMGaussRuleIntegrator.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/integration/CMIntegrator.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/CMOptimization.kt
#	kmath-commons/src/main/kotlin/space/kscience/kmath/commons/optimization/cmFit.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/GaussIntegrator.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/Integrand.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/MultivariateIntegrand.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/integration/UnivariateIntegrand.kt
#	kmath-functions/src/commonTest/kotlin/space/kscience/kmath/integration/GaussIntegralTest.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/FunctionOptimization.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/NoDerivFunctionOptimization.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/optimization/Optimization.kt
2021-05-24 14:44:08 +03:00
12805712d3 Integrand toString 2021-05-24 14:30:51 +03:00
380c76fe40 Piecewise optimization 2021-05-23 20:01:07 +03:00
ec7a971df7 Separate double-based integrator for a Simpson rule 2021-05-22 20:17:52 +03:00
a24c8dcbce Simpson and spline integration 2021-05-22 20:08:49 +03:00
18509f1259 Simpson integrator 2021-05-21 23:14:07 +03:00
Alexander Nozik
889244902b
Merge pull request #352 from mipt-npm/commandertvis/fix-type-param
Fix unresolved reference in generated type parameter
2021-05-21 16:28:30 +03:00
Iaroslav Postovalov
189449f40e Fix unresolved reference in generated type parameter 2021-05-21 20:08:17 +07:00
Iaroslav Postovalov
a722cf0cdb Integration between MST and Symja IExpr 2021-05-21 20:00:23 +07:00
Alexander Nozik
bb228e0c68
Merge pull request #350 from mipt-npm/commandertvis/kotlingrad
Rename `DifferentiableMstExpression`, fix #349
2021-05-21 09:42:44 +03:00
Iaroslav Postovalov
485e90fcd0 Rename DifferentiableMstExpression, fix #349 2021-05-21 00:51:29 +07:00
Alexander Nozik
958788bc91
Merge pull request #332 from mipt-npm/commandertvis/nd4j
Nd4j based TensorAlgebra implementation
2021-05-20 18:15:59 +03:00
Iaroslav Postovalov
15a0258b7d Nd4j based TensorAlgebra implementation, drop Nd4jArrayLongStructure 2021-05-20 21:42:36 +07:00
Alexander Nozik
2889f0794b
Merge pull request #346 from mipt-npm/commandertvis/out
Add out variance to StructureND and its implementations where possible, make some unrelated changes
2021-05-20 17:38:27 +03:00
Iaroslav Postovalov
d7a4228f5f Add out variance to StructureND and some related types, make some unrelated changes 2021-05-20 19:57:55 +07:00
Iaroslav Postovalov
5d2fff6575
Merge pull request #343 from mipt-npm/commandertvis/formatter
Hard code specific imports in codegen
2021-05-20 13:39:14 +07:00
8a07140f7c Minor piecewise rework 2021-05-19 22:35:06 +03:00
0898285542 Removed Any restriction on polynomials 2021-05-19 12:58:01 +03:00
ddb8917535 Merge remote-tracking branch 'origin/dev' into dev 2021-05-19 08:58:29 +03:00
Iaroslav Postovalov
b4dd4380c0 Hard code specific imports in codegen 2021-05-19 07:37:41 +07:00
Iaroslav Postovalov
e7235e2a9c
Merge pull request #341 from mipt-npm/feature/booleans
LogicAlgebra and its Boolean implementation, merge MST.Symbolic and Symbol
2021-05-19 07:36:36 +07:00
a67c112793 add xor 2021-05-18 10:22:33 +03:00
8b92db9923 bump version 2021-05-18 10:07:55 +03:00
d45d44f96d Fix Interpolation 2021-05-17 21:55:32 +03:00
53a6d3543f [WIP] Interpolation fix 2021-05-17 16:53:12 +03:00
Alexander Nozik
72f4d7c7e6
Update kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt
Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
2021-05-17 10:10:54 +03:00
Alexander Nozik
dfac6aeb5c
Update CHANGELOG.md
Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
2021-05-17 10:10:49 +03:00
83b6d8fee0 dump api 2021-05-16 22:39:44 +03:00
4c1a7f98a1 Merge remote-tracking branch 'origin/dev' into dev 2021-05-16 22:34:09 +03:00
e6c6925209 Fix integration borders 2021-05-16 22:33:53 +03:00
7f1789c556 Merge remote-tracking branch 'origin/dev' into feature/booleans 2021-05-16 20:52:22 +03:00
516444d1bc Fix and test 2021-05-16 20:51:46 +03:00
15d874fb06 Remove MST.Symbolic
Replace it by Symbol
LogicAlgebra
2021-05-16 19:53:21 +03:00
Iaroslav Postovalov
47526d4dd5
Merge pull request #339 from mipt-npm/commandertvis/ejml
Code generation of EJML linear spaces
2021-05-16 18:55:10 +07:00
Iaroslav Postovalov
eb3a8655fb
Code generation of EJML linear spaces 2021-05-16 18:41:25 +07:00
f86a6130e0 Add opt-in for examples 2021-05-16 14:20:28 +03:00
d1e76175b7 Refactor integrator API. 2021-05-16 14:09:21 +03:00
6f39b38a72 Refactor integrator API. 2021-05-16 13:59:37 +03:00
4964fb2642 Merge remote-tracking branch 'origin/dev' into dev 2021-05-14 18:23:48 +03:00
Alexander Nozik
4065466be3
Merge pull request #338 from mipt-npm/commandertvis/link-kotlingrad-doc
Link to Kotlingrad documentation
2021-05-14 17:49:28 +03:00
Iaroslav Postovalov
b33c68e315
Link to Kotlingrad documentation 2021-05-14 21:47:21 +07:00
Alexander Nozik
6362918365
Merge pull request #337 from mipt-npm/commandertvis/link-kotlingrad-doc
Link to Kotlingrad documentation
2021-05-14 17:24:09 +03:00
Iaroslav Postovalov
b94172fd22
Link to Kotlingrad documentation 2021-05-14 21:15:24 +07:00
42d130f69c Build tools update. Cleanup 2021-05-14 15:59:17 +03:00
fff7377687 ColumnarData returns nullable column 2021-05-14 12:42:27 +03:00
6eb95f26eb Additional piecewise extension 2021-05-14 12:11:37 +03:00
Alexander Nozik
a0621bba5b
Merge pull request #334 from zhelenskiy/dev
TODO removed as I already added what neeed
2021-05-14 10:50:54 +03:00
zhelenskiy
cf555bc8ae TODO removed as I already added what neeed 2021-05-14 10:48:57 +03:00
dc9ec54644 naming fix and doc update 2021-05-14 09:32:24 +03:00
1a615c503d re-apply bigint fix 2021-05-14 09:20:49 +03:00
1b60f71ed0 Revert "fixes to power"
This reverts commit bdb9ce6a
2021-05-14 09:14:48 +03:00
Alexander Nozik
c1b94ff0bc
Merge pull request #328 from zhelenskiy/dev
Karatsuba added, 2 bugs are fixed
2021-05-14 09:12:25 +03:00
Alexander Nozik
a86e8eb164
Merge pull request #333 from mipt-npm/fix/tensor-cov-api
remove cov from tensors API
2021-05-14 09:10:57 +03:00
Alexander Nozik
bdb9ce6a59
fixes to power 2021-05-14 09:10:05 +03:00
Alexander Nozik
a299003236
Merge branch 'dev' into dev 2021-05-14 09:06:21 +03:00
zhelenskiy
c204747401 Reusing of existing power function 2021-05-13 22:44:33 +03:00
Roland Grinis
e110253d8f remove cov from tensors API 2021-05-13 19:26:18 +01:00
Alexander Nozik
ed5e94f580
Merge pull request #331 from mipt-npm/commandertvis/q
Special rendering of Quaternion
2021-05-13 19:49:51 +03:00
Iaroslav Postovalov
fcb9605338
Special rendering of Quaternion #330 2021-05-13 22:59:35 +07:00
zhelenskiy
1e94538931 Unstable API annotation added + inconsistent docs fix + unnecessary BigIntField usage removed 2021-05-13 13:11:20 +03:00
feb5743f58 Change signature of one of integrate helpers 2021-05-13 11:10:59 +03:00
f5289abdc3 Introduce PerformancePitfall annotation 2021-05-13 11:09:49 +03:00
97c4b81717 Introduce PerformancePitfall annotation 2021-05-13 11:02:20 +03:00
Alexander Nozik
3131e2a40d
Merge pull request #329 from mipt-npm/fix/tensors-doc
Fix readme for tensors
2021-05-12 22:02:35 +03:00
Roland Grinis
d721c4b597 typo found 2021-05-12 19:43:08 +01:00
Roland Grinis
e5f3ee75be tensors readme fix 2021-05-12 19:40:10 +01:00
zhelenskiy
8443fac4ae UInt can be used in exponent (in pow) now. 2021-05-12 14:10:32 +03:00
zhelenskiy
1e71f29d5e Large addition tests added 2021-05-12 13:59:41 +03:00
zhelenskiy
ded01251d1 Karatsuba enhancement 2021-05-12 11:05:42 +03:00
zhelenskiy
ed86a31c50 Placing pow outside the Ring interface. 2021-05-12 04:58:48 +03:00
zhelenskiy
b4e47494fc Parsing of decimal values takes 9 immediately digits but not 1. 2021-05-12 04:42:17 +03:00
zhelenskiy
9184bd55de Parser optimization 2021-05-12 02:01:49 +03:00
zhelenskiy
74d14970b9 empty string parsing fixed 2021-05-12 00:58:27 +03:00
Alexander Nozik
e01ee63c03
Merge pull request #326 from mipt-npm/commandertvis/kotlingrad
Promote kmath-kotlingrad to experimental alongside minor documentation and API changes
2021-05-11 09:01:59 +03:00
Alexander Nozik
e302b5ea4c
Merge pull request #327 from mipt-npm/commandertvis/unstable
Document and change retention for UnstableKMathAPI
2021-05-11 09:01:16 +03:00
zhelenskiy
2da0648d73 Karatsuba added
Incorrect equals fix test
Incorrect overflow handling support
2021-05-11 01:40:45 +03:00
zhelenskiy
3ad7f32ada Incorrect BigInt equality fixed 2021-05-10 18:41:40 +03:00
zhelenskiy
d17a3ac6ef Further optimization of power is added 2021-05-10 18:24:13 +03:00
zhelenskiy
1716b7f5d1 Fast power is added 2021-05-10 17:57:49 +03:00
Iaroslav Postovalov
e2920ed683
Promote kmath-kotlingrad to experimental alongside minor documentation and API changes 2021-05-09 18:17:28 +07:00
Iaroslav Postovalov
bbef697b7d
Document and change retention for UnstableKMathAPI 2021-05-09 18:10:06 +07:00
Alexander Nozik
ca02f5406d
Update gradle.properties
Increase metaspace for dokka
2021-05-08 18:07:53 +03:00
Alexander Nozik
50d55e9734
Merge pull request #324 from mipt-npm/dev
v0.3.0-dev-9
2021-05-08 17:16:29 +03:00
6d78bb8d91 0.3.0-dev-8. Readme update 2021-05-08 14:36:37 +03:00
515d2391ee Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	.github/workflows/pages.yml
2021-05-08 14:29:33 +03:00
7ce0829597 0.3.0-dev-8. Cleanup 2021-05-08 14:20:16 +03:00
e4e661a3bf Update jupyter integration 2021-05-08 14:10:57 +03:00
0622be2494 Merge remote-tracking branch 'origin/dev' into dev 2021-05-08 11:35:15 +03:00
Alexander Nozik
c420c2ccc6
Merge pull request #300 from mipt-npm/feature/tensor-algebra
KMP library for tensors
2021-05-08 09:48:04 +03:00
Iaroslav Postovalov
512ed1139c
Merge pull request #323 from AndreiKingsley/andrew
fixes
2021-05-08 03:34:57 +07:00
Andrei Kislitsyn
33e27cd992 fixed 2021-05-07 23:07:02 +03:00
Andrei Kislitsyn
11a1624e64 fixes 2021-05-07 23:06:41 +03:00
Andrei Kislitsyn
dde1db7b0a fixes 2021-05-07 23:05:37 +03:00
Roland Grinis
75ef241be3 Merge commit 'refs/pull/322/head' of ssh://git.jetbrains.space/mipt-npm/sci/kmath into feature/tensor-algebra 2021-05-07 14:19:37 +01:00
Roland Grinis
a5b72f2016 Doc typo 2021-05-07 14:15:48 +01:00
Roland Grinis
21b5d45b96 Throwable value method 2021-05-07 14:13:07 +01:00
Andrei Kislitsyn
5b725a087b new cast 2021-05-07 15:53:09 +03:00
Roland Grinis
d73d03c055 valueOrNull added 2021-05-07 13:36:15 +01:00
Roland Grinis
e80eefa90f typo corrected 2021-05-07 13:12:55 +01:00
Roland Grinis
d31726a0d9 produce routine 2021-05-07 13:12:18 +01:00
Roland Grinis
0ef64130ae TensorLinearStructure made internal 2021-05-07 13:00:30 +01:00
Roland Grinis
0920e21d62 Merging implementations together 2021-05-07 12:52:17 +01:00
Andrei Kislitsyn
14ca7cdd31 fixes 2021-05-07 13:00:20 +03:00
Andrei Kislitsyn
1b1a078dea neural network! 2021-05-07 03:22:34 +03:00
Roland Grinis
febe526325 Update stack docs 2021-05-06 14:50:05 +01:00
Andrei Kislitsyn
db5378c9f4 PCA example 2021-05-06 16:29:21 +03:00
Roland Grinis
5fe1320855 minor corrections 2021-05-06 12:59:21 +01:00
AlyaNovikova
90149e3965 add documentation to map and randomNormal function 2021-05-06 14:42:15 +03:00
AlyaNovikova
56cadbd9ef Merge branch 'feature/tensor-algebra' of https://github.com/mipt-npm/kmath into feature/tensor-algebra 2021-05-06 14:24:06 +03:00
AlyaNovikova
dc22bd8498 add documentation to DoubleTensorAlgebra 2021-05-06 14:23:57 +03:00
Andrei Kislitsyn
8ac253b9fe cov + docs 2021-05-06 14:09:47 +03:00
Roland Grinis
35928e7960 minor corrections 2021-05-06 10:52:37 +01:00
Andrei Kislitsyn
0e793eba26 Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-05-06 12:30:23 +03:00
Andrei Kislitsyn
499cf85ff0 refactor BT + docs 2021-05-06 12:30:13 +03:00
Roland Grinis
16bed53997 Drop unused functionality in TensorLinearStructure 2021-05-06 09:59:58 +01:00
Roland Grinis
477e64e4d3 Typos corrected 2021-05-06 09:51:59 +01:00
Roland Grinis
a1cbd7a457 TensorLinearStructure doc 2021-05-06 09:48:43 +01:00
Roland Grinis
0680a3a1cb Merge commit 'refs/pull/315/head' of ssh://git.jetbrains.space/mipt-npm/sci/kmath into feature/tensor-algebra 2021-05-06 09:04:01 +01:00
AlyaNovikova
229c1b57da add documentation to DoubleLinearOpsTensorAlgebra 2021-05-06 10:27:47 +03:00
Roland Grinis
b7cc4e4b1b merge dev 2021-05-06 07:45:53 +01:00
Roland Grinis
431db00f1a refactor tests 2021-05-05 16:35:26 +01:00
Roland Grinis
218b81a242 Min max refactor 2021-05-05 16:11:46 +01:00
Andrei Kislitsyn
d0281871fa analytic tests and examples 2021-05-05 14:27:01 +03:00
Alexander Nozik
3e10e1463a
Merge pull request #311 from mipt-npm/commandertvis/frac
MST rendering: support infix division, use arcsin instead sin^-1 form for inverse trigonometric functions
2021-05-04 13:42:56 +03:00
Iaroslav Postovalov
591b408729
MST rendering: support infix division, use arcsin instead sin^-1 form for inverse trigonometric functions 2021-05-04 17:22:09 +07:00
Roland Grinis
b59e48410f More basic functionality, tests to come 2021-05-03 19:49:23 +01:00
Andrei Kislitsyn
7f8914d8ea fixes 2021-05-03 20:42:18 +03:00
Andrei Kislitsyn
8898f908ef statistic algebra 2021-05-03 18:45:18 +03:00
Alexander Nozik
eca1ad48f5
Merge pull request #273 from mipt-npm/feature/jupyter
Add Jupyter integration
2021-05-02 21:28:17 +03:00
Alexander Nozik
889b8a4490
Merge pull request #304 from mipt-npm/commandertvis/deprecate-element
Deprecate AlgebraElements.kt
2021-05-02 21:27:03 +03:00
Alexander Nozik
a8a5c769c4
Merge pull request #309 from mipt-npm/commandertvis/mst-tests
Simplify and revise test cases for MST compilation engines
2021-05-02 21:19:38 +03:00
Iaroslav Postovalov
f0627b2ced
Simplify and revise test cases for MST compilation engines #285 2021-05-03 00:27:16 +07:00
Roland Grinis
5aaba0dae4 TensorStructure to Tensor 2021-05-02 16:19:05 +01:00
Alexander Nozik
c8fb770ffd
Rename LICENSE.txt to LICENSE 2021-05-01 22:44:43 +03:00
Alexander Nozik
1fe1a74b48
Create LICENSE.txt 2021-05-01 22:40:53 +03:00
Roland Grinis
48d86fac56 invoke refactor 2021-05-01 19:55:48 +01:00
Andrei Kislitsyn
ac6608b5b4 refactor 2021-05-01 20:45:23 +03:00
Andrei Kislitsyn
bfba653904 refactor 2021-05-01 17:47:12 +03:00
Iaroslav Postovalov
83c7ec8c6b
Deprecate AlgebraElements.kt 2021-05-01 18:46:11 +07:00
Andrei Kislitsyn
fe81dea243 stack 2021-05-01 14:22:05 +03:00
Andrei Kislitsyn
b7cac3a015 fix sequences + array casting 2021-05-01 13:32:50 +03:00
Roland Grinis
1b6bd67b90 No virtual mutable buffers 2021-04-30 21:11:01 +01:00
Roland Grinis
74773686b4 toDoubleTensor and toIntTensor renaming 2021-04-30 19:49:43 +01:00
Roland Grinis
8a039326d4 Minor corrections 2021-04-30 19:47:05 +01:00
Andrei Kislitsyn
f0cdb9b657 refactor utils and remove inline 2021-04-30 20:07:59 +03:00
Andrei Kislitsyn
e2c7751c7e refactor linops 2021-04-30 19:45:31 +03:00
Roland Grinis
1695fc5075 Fix examples 2021-04-30 15:25:45 +01:00
Roland Grinis
42ddd2e569 MutableBufferFromGenerator 2021-04-30 15:08:32 +01:00
Roland Grinis
86c2816cfd Fixed strides code duplication 2021-04-30 14:53:02 +01:00
Iaroslav Postovalov
77d72c7bf6
Add Jupyter integration 2021-04-30 20:50:00 +07:00
Roland Grinis
6be5caa93f No secondary constructors 2021-04-30 14:44:42 +01:00
Roland Grinis
e5e62bc544 Extending from Algebra 2021-04-30 14:38:03 +01:00
Alexander Nozik
72d91b04da
Merge pull request #301 from mipt-npm/commandertvis/graal-ga
Use GraalVM as CI JDK
2021-04-30 16:31:24 +03:00
Iaroslav Postovalov
2aed0316f4
Use GraalVM as CI JDK 2021-04-30 20:29:05 +07:00
Iaroslav Postovalov
fd7e26d6c5
Merge pull request #294 from mipt-npm/commandertvis/rework-ejml
Rewrite EJML module by dropping ejml-simple abstraction level
2021-04-30 19:51:44 +07:00
Iaroslav Postovalov
598b2e1587
Rewrite EJML module by dropping ejml-simple abstraction level; multiple build script changes 2021-04-30 19:48:12 +07:00
Roland Grinis
bd068b2c14 Smaller SVD test 2021-04-30 09:54:25 +01:00
Roland Grinis
e371a4a6db Merge branch 'dev' into feature/tensor-algebra 2021-04-30 09:20:26 +01:00
Roland Grinis
b546f3f78b Merge PR 2021-04-30 09:19:30 +01:00
Andrei Kislitsyn
09f0a2879e refactor lu + docs 2021-04-30 11:08:22 +03:00
Roland Grinis
cba62a9468 English typo 2021-04-29 18:48:41 +01:00
Roland Grinis
432f404d7c More descriptions 2021-04-29 18:45:46 +01:00
AlyaNovikova
b9f1f0e525 fixes 2021-04-29 20:00:05 +03:00
AlyaNovikova
64c6cbf860 change tuple to pair/triple 2021-04-29 17:21:29 +03:00
AlyaNovikova
6f5b0f0a03 add README and documentation for the main functions of tensor algebra 2021-04-29 17:09:50 +03:00
Roland Grinis
51f084d28b merge PR 2021-04-28 17:07:10 +01:00
Andrei Kislitsyn
a0e9180db6 example with LUP 2021-04-28 18:18:57 +03:00
Roland Grinis
b65a673173 Fix format for 0.0 2021-04-28 14:16:57 +01:00
Alexander Nozik
0f786e4f6f
Merge pull request #293 from mipt-npm/commandertvis/ast-stability
Promote kmath-ast as experimental, mark AST Rendering and WASM with @UnstableKMathAPI
2021-04-28 08:59:54 +03:00
Iaroslav Postovalov
e3f7b7a5fa
Promote kmath-ast as experimental, mark AST Rendering and WASM with @UnstableKMathAPI 2021-04-28 10:27:08 +07:00
Roland Grinis
23ea4a95a1 Fixed strides flipping 2021-04-27 19:01:54 +01:00
Roland Grinis
c2db3a23e1 Feedback for SVD 2021-04-26 16:24:26 +01:00
Andrei Kislitsyn
30ca333c04 OLS/SVD example 2021-04-26 17:27:50 +03:00
Andrei Kislitsyn
2c001cb1b3 fix div + simple tests 2021-04-26 17:07:49 +03:00
7b6361e59d [WIP] optimization refactor in process 2021-04-26 15:02:19 +03:00
Iaroslav Postovalov
1f71b5333a
Merge pull request #291 from mipt-npm/commandertvis/readme-ast
Update README.md
2021-04-26 08:47:45 +07:00
257337f4fb [WIP] Refactor optimization 2021-04-25 22:34:59 +03:00
Roland Grinis
4f593aec63 Buffer mini-protocol 2021-04-24 18:53:21 +01:00
Iaroslav Postovalov
077c2b4e3b
Update README.md in kmath-ast 2021-04-24 12:14:31 +07:00
Roland Grinis
287e2aeba2 div operator 2021-04-23 14:22:52 +01:00
2cf56641aa Merge remote-tracking branch 'origin/dev' into dev 2021-04-22 19:37:28 +03:00
Andrei Kislitsyn
559e8b24ab rework structure + fixes 2021-04-21 23:44:39 +03:00
Roland Grinis
cc11df6174 Casting receiver 2021-04-21 19:51:34 +01:00
Roland Grinis
76b5cd0de5 Merge dev 2021-04-21 17:04:09 +01:00
Iaroslav Postovalov
84b149fa81
Merge pull request #274 from mipt-npm/commandertvis/exp-render
Redesign exponential function rendering
2021-04-21 22:13:21 +07:00
Iaroslav Postovalov
488f5f0008
Redesign exponential function rendering 2021-04-21 22:13:03 +07:00
7a11ed0797 Merge remote-tracking branch 'origin/dev' into dev 2021-04-21 16:03:30 +03:00
Iaroslav Postovalov
23d2f8d758
Merge pull request #289 from mipt-npm/commandertvis/rendering-tests
Move AST rendering tests to common
2021-04-21 19:57:36 +07:00
Iaroslav Postovalov
cfa9077e29
Move AST rendering tests to common 2021-04-21 19:50:33 +07:00
Alexander Nozik
264139fe13
Merge pull request #288 from mipt-npm/commandertvis/copyright
Configure copyright scoping
2021-04-21 15:48:11 +03:00
Iaroslav Postovalov
0a0d0af94a
Configure copyright scoping 2021-04-21 19:46:02 +07:00
Iaroslav Postovalov
a722672b35
Merge pull request #284 from mipt-npm/commandertvis/binaryen
MST compilation to WebAssembly with Binaryen, reorganize internal JS bindings, tests refactor
2021-04-21 19:31:31 +07:00
Iaroslav Postovalov
b6a57dbfd0
MST compilation to WebAssembly with Binaryen, reorganize internal JS bindings, tests refactor 2021-04-21 19:17:57 +07:00
6aa5b547b5 cleanup 2021-04-21 12:48:11 +03:00
9c353f4a0d Make ND4J float algebra extended 2021-04-20 22:48:09 +03:00
Alexander Nozik
477f75270c
Merge pull request #283 from mipt-npm/commandertvis/better-parse
Update dependencies
2021-04-20 15:19:06 +03:00
Iaroslav Postovalov
84fa878ee3
Update dependencies 2021-04-20 19:14:59 +07:00
fd4108b74f fix segmented integral 2021-04-19 11:26:06 +03:00
86818f6864 Replace dl4j with nd4j dependency 2021-04-19 09:31:56 +03:00
07e39a068d Use split interval for integration. 2021-04-18 19:43:03 +03:00
6c215abf13 Fix BigInt benchmark. 2021-04-17 10:08:04 +03:00
Alexander Nozik
2418b0bb9e
Merge pull request #281 from zhelenskiy/dev
Tests for large BigIntegers multiplication and power are provided.
2021-04-17 09:56:18 +03:00
f67cfcc9e6 Fix benchmarks 2021-04-17 09:47:34 +03:00
922ca564b1 Merge remote-tracking branch 'zhelenskiy/dev' into zhelenskiy_dev 2021-04-17 09:47:16 +03:00
Alexander Nozik
3dc7038b6e
Update BigIntBenchmark.kt
unify definition (pow function seems to work wrong
2021-04-17 09:46:10 +03:00
562e641b06 Fix benchmarks 2021-04-17 09:43:40 +03:00
b84ac68bd8 Merge branch 'dev' into zhelenskiy_dev 2021-04-17 09:27:41 +03:00
zhelenskiy
41d0be8085 Increasing number of tests 2021-04-16 23:29:31 +03:00
8689d29e4c Fix benchmarks 2021-04-16 22:43:10 +03:00
zhelenskiy
a110dc20d5 Tests for large BigIntegers multiplication and power are provided.
Km implementation is very slow.
2021-04-16 22:15:12 +03:00
00a2ce2152 Back to gradle 7 2021-04-16 20:30:40 +03:00
Alexander Nozik
2ac55e851f
Update pages.yml
remove caches from build pages
2021-04-16 20:03:44 +03:00
Alexander Nozik
4ac65b60cd
Merge pull request #280 from mipt-npm/dev
Dev
2021-04-16 19:45:55 +03:00
299592ed25 Update readme 2021-04-16 19:44:51 +03:00
e38685951c Remove unnecessary inlines 2021-04-16 19:20:50 +03:00
ef1200aad0 Update integration API 2021-04-16 16:39:27 +03:00
65a8d8f581 Field element integration 2021-04-16 15:50:33 +03:00
Roland Grinis
82d8394a9f remove kolinx import 2021-04-16 12:05:18 +01:00
Iaroslav Postovalov
1582ac2c29
Fix import 2021-04-16 18:05:01 +07:00
Roland Grinis
4f8ab4dd78 Ignore print test 2021-04-16 12:03:27 +01:00
Iaroslav Postovalov
e9c31b7827
Merge branch 'master' into dev
# Conflicts:
#	README.md
#	build.gradle.kts
#	examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt
#	examples/src/main/kotlin/space/kscience/kmath/structures/ParallelRealNDField.kt
#	kmath-ast/README.md
#	kmath-ast/build.gradle.kts
#	kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/MstExpression.kt
#	kmath-complex/README.md
#	kmath-complex/build.gradle.kts
#	kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/ComplexNDField.kt
#	kmath-core/README.md
#	kmath-core/build.gradle.kts
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/MST.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/MstAlgebra.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/RealNDField.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/RealBufferField.kt
#	kmath-coroutines/build.gradle.kts
#	kmath-coroutines/src/commonMain/kotlin/space/kscience/kmath/chains/BlockingRealChain.kt
#	kmath-coroutines/src/jvmMain/kotlin/space/kscience/kmath/structures/LazyNDStructure.kt
#	kmath-dimensions/src/commonTest/kotlin/kscience/dimensions/DMatrixContextTest.kt
#	kmath-for-real/README.md
#	kmath-functions/README.md
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/Interpolator.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LoessInterpolator.kt
#	kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/XYPointSet.kt
#	kmath-geometry/build.gradle.kts
#	kmath-nd4j/README.md
#	kmath-nd4j/build.gradle.kts
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/distributions/FactorizedDistribution.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Fitting.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/OptimizationProblem.kt
#	kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt
#	kmath-viktor/src/main/kotlin/space/kscience/kmath/viktor/ViktorNDStructure.kt
2021-04-16 18:02:44 +07:00
Roland Grinis
1e7cf39150 Don't print 0 order 2021-04-16 11:58:42 +01:00
Alexander Nozik
77a3db56fc
Merge pull request #260 from mipt-npm/commandertvis/license
Carefully specify the license information
2021-04-16 11:55:54 +03:00
1d1937405d BigIntBenchmarks. Rollback to gradle 6.8.3 because incompatibility with benchmarks 2021-04-16 10:05:51 +03:00
ba3c9b6d45 BigIntBenchmarks. cleanup 2021-04-16 09:47:30 +03:00
Roland Grinis
baa303171e No jvm specifics please 2021-04-16 07:47:06 +01:00
Roland Grinis
41ac72b4fb MPP toString for DoubleTensor 2021-04-16 07:45:31 +01:00
Andrei Kislitsyn
b7da52edb1 pretty printer 2021-04-15 23:10:15 +03:00
Iaroslav Postovalov
41b7349a43
Setup copyright headers, add references to third-party files, update LICENSE 2021-04-16 00:15:00 +07:00
19ec6a57a4 Gauss-Legendre working test 2021-04-15 19:39:46 +03:00
93bc371622 WIP Integrator tests 2021-04-15 09:53:29 +03:00
Roland Grinis
0fa73e1e9e Drop unused code 2021-04-14 22:21:18 +01:00
Roland Grinis
b46e8c5fe2 LU and det refactored 2021-04-14 22:13:54 +01:00
e2ceb64d36 Fix errors and migrations 2021-04-14 23:26:21 +03:00
Andrei Kislitsyn
2092cc9af4 resolve conflict 2021-04-14 23:12:39 +03:00
Andrei Kislitsyn
bbe7c99ec5 fix det 2021-04-14 23:11:06 +03:00
Andrei Kislitsyn
aeb71b5d27 fix det 2021-04-14 23:10:42 +03:00
Andrei Kislitsyn
c7669d4fba fix det 2021-04-14 23:05:54 +03:00
Roland Grinis
a2d41d5e73 Cholesky with precision in client API 2021-04-14 20:30:42 +01:00
6cea5742e8 Blocking statistics. Move MST to core 2021-04-14 12:40:26 +03:00
ce4dcb63b0 Roll-back to 0.9.4 plugin 2021-04-10 17:29:36 +03:00
000c79d42f Simplify test 2021-04-10 17:15:15 +03:00
4abd0bdb6f Migrate to gradle 7.0 and suspend-inline bug 2021-04-10 16:31:08 +03:00
acb4052fe4 Migrate to gradle 7.0 and suspend-inline bug 2021-04-10 15:20:09 +03:00
Roland Grinis
75783bcb03 some todos 2021-04-09 14:06:44 +01:00
Roland Grinis
b51427d2ab test to fix determinant 2021-04-09 12:26:03 +01:00
Roland Grinis
1e8da7a87b Cholesky decomp tests and checks - det to be fixed 2021-04-09 10:53:36 +01:00
Roland Grinis
a692412cff Safer cleaner for symeig 2021-04-09 10:08:55 +01:00
Roland Grinis
fe8579180d Open epsilon to client to control numerical precision for power methods 2021-04-09 09:56:37 +01:00
Roland Grinis
3f0dff3ce9 Approximate spectral decomposition for symmetric matrices based on SVD 2021-04-09 09:18:00 +01:00
Roland Grinis
e4dbabc30f more infor 2021-04-09 08:32:03 +01:00
Roland Grinis
5d8b42da90 minor corrections to linear stuff 2021-04-09 08:29:08 +01:00
Roland Grinis
8c1131dd58 Approaching SymEig through SVD 2021-04-09 08:03:47 +01:00
Roland Grinis
a09a1c7adc Fixed tests 2021-04-09 07:33:25 +01:00
AlyaNovikova
ea4d6618b4 fix bugs in svd 2021-04-08 23:58:44 +03:00
Roland Grinis
74dfca4e2e Using kmath-stat for random normals 2021-04-07 15:11:00 +01:00
31460df721 GaussianSampler inherits Blocking Sampler 2021-04-07 14:14:22 +03:00
Roland Grinis
383376080e Merge branch 'dev' into feature/tensor-algebra 2021-04-07 12:05:56 +01:00
5bdc02d18c fix for #272 2021-04-06 17:17:43 +03:00
Roland Grinis
174f6566e1 Negative indices 2021-04-06 12:07:39 +01:00
Roland Grinis
2bbe10e41c SymEig test 2021-04-06 11:41:41 +01:00
Roland Grinis
dcdc22dd9d SVD test to be fixed 2021-04-06 11:04:00 +01:00
Alexander Nozik
45301d9172
Update build.yml
Add timeout to build
2021-04-06 11:15:47 +03:00
Roland Grinis
4336788a6b Moving Alya's SVD implementation to linutils 2021-04-06 09:00:13 +01:00
AlyaNovikova
814eab8cde implement svd function and tests for it 2021-04-06 00:06:14 +03:00
Alexander Nozik
94093378e0
Merge pull request #268 from mipt-npm/commandertvis/e-pi
Add pi and e constants, some unrelated changes
2021-04-05 19:50:02 +03:00
Iaroslav Postovalov
cf91da1a98
Add pi and e constants, some unrelated changes 2021-04-05 23:44:42 +07:00
f7e792faff Add test for grid iteration. 2021-04-02 19:09:35 +03:00
Alexander Nozik
ae5ca44dc0
Merge pull request #270 from mipt-npm/commandertvis/fix-binding
Remove redundant try-catch expressions
2021-04-02 12:52:38 +03:00
Iaroslav Postovalov
e6921025d1
Remove redundant try-catch expressions 2021-04-02 16:46:12 +07:00
a91d468b74 Refactor Algebra and ExpressionAlgebra. Introduce bindSymbolOrNull on the top level 2021-04-01 21:27:30 +03:00
AlyaNovikova
3e98240b94 add function diagonalEmbedding with tests 2021-04-01 20:21:14 +03:00
af4866e876 Refactor MST 2021-04-01 20:15:49 +03:00
c2bab5d138 Fix Samplers and distribution API 2021-04-01 18:18:54 +03:00
Alexander Nozik
ae911fcc2f
Merge pull request #264 from mipt-npm/commandertvis/ast-rendering
Some experiments with MST rendering
2021-03-31 13:06:14 +03:00
Iaroslav Postovalov
9ee506b1d2
Some experiments with MST rendering 2021-03-31 16:12:07 +07:00
Roland Grinis
b36281fa39 roll back 2021-03-31 09:23:41 +01:00
Roland Grinis
706a44fd33 get normals TBD 2021-03-31 09:15:55 +01:00
Roland Grinis
5abd63cde2 moving to kmath-tensors module 2021-03-31 09:07:45 +01:00
Roland Grinis
61edf999c8 Merge branch 'dev' into feature/tensor-algebra 2021-03-31 08:35:48 +01:00
Roland Grinis
6305acea68 API dump 2021-03-31 08:32:53 +01:00
Alexander Nozik
b4fc311668
Merge pull request #164 from mipt-npm/feature/mp-samplers
Implement Commons RNG-like samplers in kmath-prob module for Multiplatform
2021-03-31 09:25:44 +03:00
Iaroslav Postovalov
9574099f9b
Fix post-merge issues 2021-03-31 02:24:21 +07:00
Iaroslav Postovalov
f26cad6d18
Merge branch 'dev' into feature/mp-samplers
# Conflicts:
#	examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt
#	examples/src/main/kotlin/space/kscience/kmath/stat/DistributionBenchmark.kt
#	examples/src/main/kotlin/space/kscience/kmath/stat/DistributionDemo.kt
#	kmath-commons/src/test/kotlin/space/kscience/kmath/commons/optimization/OptimizeTest.kt
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffer.kt
#	kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/BlockingRealChain.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/SamplerAlgebra.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/Distribution.kt
#	kmath-stat/src/commonMain/kotlin/space/kscience/kmath/stat/RandomChain.kt
#	kmath-stat/src/jvmMain/kotlin/space/kscience/kmath/stat/distributions.kt
2021-03-31 01:48:26 +07:00
Roland Grinis
07b6f988c2 forgot ln 2021-03-30 19:31:42 +01:00
Roland Grinis
b5d3ca76db Dropping creation methods from interface 2021-03-30 19:20:20 +01:00
Roland Grinis
ae30d3a03e remerging pr 263 2021-03-30 16:58:05 +01:00
Roland Grinis
03455a3beb infix dot forgotten 2021-03-30 14:36:59 +01:00
Roland Grinis
581c13c573 drop code duplication 2021-03-30 14:14:05 +01:00
Roland Grinis
370bab462c merged pull request 2021-03-30 13:14:09 +01:00
Andrei Kislitsyn
139534fdb3 fix 2021-03-30 15:13:45 +03:00
Roland Grinis
97f148c175 Merge commit 'refs/pull/263/head' of ssh://git.jetbrains.space/mipt-npm/sci/kmath into feature/tensor-algebra 2021-03-30 13:06:23 +01:00
Andrei Kislitsyn
2503d35ba8 complete qr + test qr and lu 2021-03-30 14:53:19 +03:00
Roland Grinis
d281dfca3a Separate linear algebra utils into dedicated module 2021-03-30 11:22:55 +01:00
Andrei Kislitsyn
6e85d496f2 resolve conflict 2021-03-30 00:22:10 +03:00
Roland Grinis
51eca003af Moved back value to main algebra context 2021-03-29 22:11:34 +01:00
Roland Grinis
92710097f0 Fixing 2D and 1D casts 2021-03-29 21:58:56 +01:00
Andrei Kislitsyn
3219712019 resolve merge conflict 2021-03-26 23:49:58 +03:00
Roland Grinis
22b68e5ca4 BufferedTensor2D & BufferedTensor1D 2021-03-26 20:36:21 +00:00
Andrei Kislitsyn
5d830206a2 Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-26 19:03:43 +03:00
Roland Grinis
516cd90677 Moved out to archive unimplemented API 2021-03-26 15:36:53 +00:00
Roland Grinis
e03910354e ok reverting 2021-03-26 15:14:23 +00:00
Andrei Kislitsyn
056699f27b Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-26 18:10:53 +03:00
Roland Grinis
1588b5d94f once mutable stay it and enjoy 2021-03-26 15:09:18 +00:00
Andrei Kislitsyn
3cb9535fc9 Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-26 18:07:20 +03:00
Roland Grinis
a6354623ec returning cols/rows as vectors 2021-03-26 15:06:05 +00:00
Andrei Kislitsyn
d6a1bee93b Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-26 17:43:20 +03:00
Andrei Kislitsyn
1f19ac88ae qr fix 2021-03-26 17:43:08 +03:00
Roland Grinis
9162867fc2 Mutable structures 2D functionality added 2021-03-26 14:37:27 +00:00
Roland Grinis
1056fc7200 Test for scalar product 2021-03-26 13:48:59 +00:00
Roland Grinis
daa0777182 removed unused code 2021-03-24 18:43:03 +00:00
Roland Grinis
94b5afa6c4 eq moved to interface 2021-03-24 18:39:40 +00:00
Roland Grinis
f70f60c0e8 Moved det to LinearOps 2021-03-24 15:58:25 +00:00
Roland Grinis
a4aa4b80d2 Updated API 2021-03-24 15:51:58 +00:00
Andrei Kislitsyn
ab81370001 fixes 2021-03-24 18:42:41 +03:00
Andrei Kislitsyn
96a755071f Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-24 18:08:53 +03:00
Andrei Kislitsyn
206bcfc909 lu inv and det complete + tests 2021-03-24 18:08:36 +03:00
cd05ca6e95 Initial Optimization API 2021-03-24 16:36:06 +03:00
Andrei Kislitsyn
5c0674f1f5 Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-24 14:00:51 +03:00
Andrei Kislitsyn
fea53af0ee fix 2021-03-24 14:00:47 +03:00
AlyaNovikova
c2f11fb6e1 fix bugs in function dot, add tests 2021-03-24 13:43:54 +03:00
e216fd50f5 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	build.gradle.kts
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/misc/XYPointSet.kt
#	kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt
2021-03-24 13:33:08 +03:00
Roland Grinis
e01ca38fb3 Tasks for Andrei and Alya 2021-03-23 13:51:52 +00:00
Andrei Kislitsyn
078686a046 hotfix sequence 2021-03-23 15:59:55 +03:00
Alexander Nozik
570642e56d
Merge pull request #258 from mipt-npm/commandertvis/doc
KDoc API reference updates
2021-03-23 15:55:51 +03:00
Iaroslav Postovalov
7579a35f8e
Merge branch 'dev' into commandertvis/doc 2021-03-23 19:48:16 +07:00
Iaroslav Postovalov
4d160b81b9
Improve KDoc comments for kmath-functions 2021-03-23 19:48:12 +07:00
AlyaNovikova
2d2c4bd474 add broadcast of all dims except the last 2, add tensors dot, fix bug in function times 2021-03-23 14:53:54 +03:00
Alexander Nozik
5a108c0604
Merge pull request #256 from mipt-npm/commandertvis/dokka-links
Improve Dokka configuration
2021-03-22 16:41:43 +03:00
Iaroslav Postovalov
1b01654667
Improve Dokka configuration 2021-03-22 20:41:18 +07:00
Iaroslav Postovalov
67aa173927
Some documentation updates 2021-03-22 16:11:54 +07:00
Roland Grinis
0365d41f31 Merged PR 2021-03-21 17:57:19 +00:00
Andrei Kislitsyn
df402086da init test for analytic algebra 2021-03-21 19:08:30 +03:00
Andrei Kislitsyn
8e9a85078e Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-21 19:05:14 +03:00
Andrei Kislitsyn
fa78ed1f45 map and analytic funcions 2021-03-21 19:05:11 +03:00
Roland Grinis
d8ef190ed8 UnaryPlus fails API check 2021-03-21 08:07:17 +00:00
Roland Grinis
94e5ee4a6d TensorLinearStructure introduced 2021-03-21 08:01:52 +00:00
Roland Grinis
510c855a65 Merge dev, API check failed 2021-03-21 07:41:48 +00:00
Roland Grinis
b7e1349ead atanh as example 2021-03-20 18:59:54 +00:00
Roland Grinis
8933c820b3 merge PR 2021-03-19 20:32:57 +00:00
Andrei Kislitsyn
a0534b896f resolve conflict 2021-03-19 23:26:54 +03:00
Roland Grinis
93d3cb47be Testing linear structure 2021-03-19 20:10:08 +00:00
Roland Grinis
3535e51248 Broadcasting as its own algebra 2021-03-19 19:52:58 +00:00
Roland Grinis
274be61330 Explicit broadcasting enforced 2021-03-19 19:40:17 +00:00
Andrei Kislitsyn
5e94610e28 imp full and remove copypaste in geners 2021-03-19 17:51:30 +03:00
aeceb4a337 Move dataset to core 2021-03-19 14:53:14 +03:00
88d0c19a74 Refactor structure features. Basic curve fitting 2021-03-19 11:07:27 +03:00
Alexander Nozik
defaf716d7
Merge pull request #230 from mipt-npm/commandertvis/issue226
Fix #226
2021-03-17 20:14:16 +03:00
Iaroslav Postovalov
c4367ac509
Merge branch 'dev' into commandertvis/issue226
# Conflicts:
#	kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Counter.kt
2021-03-17 23:57:50 +07:00
Alexander Nozik
4dafb8eb49
Merge pull request #252 from mipt-npm/commandertvis/ejml
Some adjustments to the EJML module
2021-03-17 19:25:49 +03:00
Iaroslav Postovalov
6375cb5fd8
Some adjustments to the EJML module 2021-03-17 23:11:26 +07:00
Andrei Kislitsyn
1fa0da2810 complete lu and matrix mapping 2021-03-17 17:53:14 +03:00
Roland Grinis
efb23591a9 Added squeeze 2021-03-17 07:36:35 +00:00
248d42c4e0 Remove MutableBufferND 2021-03-16 22:46:22 +03:00
90981f6a40 Remove contentEquals from Buffer 2021-03-16 21:56:09 +03:00
a3ca06a241 Remove StructureND identity #248 2021-03-16 21:43:29 +03:00
206e4cbcf6 Real -> Double 2021-03-16 21:17:26 +03:00
05f742452d Structure naming change 2021-03-16 20:56:20 +03:00
Alexander Nozik
7c0d805018
Merge pull request #250 from mipt-npm/feature/integration
Feature/integration
2021-03-16 20:44:41 +03:00
105b84b87c minor cosmetics 2021-03-16 20:44:03 +03:00
Roland Grinis
bd3425e7a5 IndexTensor type added to LinearOps 2021-03-16 14:43:20 +00:00
Roland Grinis
138d376289 Merge commit 'refs/pull/247/head' of ssh://git.jetbrains.space/mipt-npm/sci/kmath into feature/tensor-algebra 2021-03-16 14:01:14 +00:00
Roland Grinis
70bebbe848 1D mutable structure setter fixed 2021-03-16 12:12:28 +00:00
874875c13a API for integration 2021-03-16 15:05:44 +03:00
AlyaNovikova
99ee5aa54a add broadcast to functions 2021-03-16 14:57:19 +03:00
Roland Grinis
0553a28ee8 ReduceOpsTensorAlgebra 2021-03-16 07:47:02 +00:00
b2df860381 Merge branch 'dev' into feature/integration 2021-03-16 09:47:40 +03:00
Roland Grinis
f4454a6cf6 Matrices from tensors test 2021-03-15 22:45:55 +00:00
Roland Grinis
791f55ee8a get dim 0 operator for tensors 2021-03-15 22:39:29 +00:00
Roland Grinis
7cb5cd8f71 BufferedTensor revisited 2021-03-15 22:11:15 +00:00
Roland Grinis
f8e0d4be17 MutableStructure 2D & 1D 2021-03-15 21:18:15 +00:00
Roland Grinis
b227a82a80 OrderedTensorAlgebra 2021-03-15 19:06:33 +00:00
acfdd187a4 Bump readme 2021-03-15 20:17:04 +03:00
Roland Grinis
b6a5fbfc14 Sync with Andrew 2021-03-15 17:08:45 +00:00
Roland Grinis
f66ac653e0 RealTensor to DoubleTensor rename 2021-03-15 16:59:50 +00:00
Alexander Nozik
88542cc858
Merge pull request #245 from mipt-npm/dev
Bump readme
2021-03-15 19:57:25 +03:00
484a58755f Bump readme 2021-03-15 19:57:01 +03:00
Alexander Nozik
e4d856033a
Merge pull request #244 from mipt-npm/dev
0.3.0-dev-2
2021-03-15 19:52:27 +03:00
17647742a8 Bump readme 2021-03-15 19:45:46 +03:00
e8e5d98e9d Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	README.md
2021-03-15 19:45:05 +03:00
179a07e034 Bump readme 2021-03-15 19:41:37 +03:00
Alexander Nozik
913c12fb30
fix coordinates 2021-03-15 19:39:22 +03:00
cceffa09e8 Bump dev version 2021-03-15 19:24:07 +03:00
71ed56c2b6 Move features to scopes 2021-03-15 16:46:12 +03:00
Roland Grinis
a3ca861ebe Rename FFTs 2021-03-15 13:05:45 +00:00
Roland Grinis
50ed7ce28b ComplexTensorAlgebra interface 2021-03-15 12:54:46 +00:00
Andrei Kislitsyn
2d2c5aa684 matrixhelper 2021-03-15 15:18:21 +03:00
8c098b6033 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	.github/workflows/pages.yml
#	gradle.properties
2021-03-15 15:04:17 +03:00
d9743978ab Reformat code 2021-03-15 14:26:59 +03:00
0e0deaeb72 Refactor buffer factories 2021-03-15 14:26:17 +03:00
Roland Grinis
4e4690e510 unsafe buffer casts moved to internal utils 2021-03-15 08:48:31 +00:00
Roland Grinis
04f6ef1ed0 Fixed tests with unsafe accessors 2021-03-15 08:31:19 +00:00
Roland Grinis
39a0889123 Dev merge assemble fixed, tests still broken 2021-03-15 07:50:20 +00:00
Roland Grinis
7d416f55d4 Merge branch 'dev' into feature/tensor-algebra 2021-03-15 07:29:02 +00:00
Roland Grinis
c02f71263d Adding the interfaces for AnalyticTensorAlgebra and LinearOpsTensorAlgebra 2021-03-14 21:18:20 +00:00
Alexander Nozik
8af2f5eb31
Merge pull request #241 from mipt-npm/refactor/linear-algebra
Refactor/linear algebra
2021-03-14 21:49:47 +03:00
6c451b5ca7 fix doc typo 2021-03-14 15:09:04 +03:00
e01f90b5e0 add gradient example 2021-03-14 14:40:13 +03:00
5a568c4587 add gradient example 2021-03-14 14:23:53 +03:00
0cc68e72ce cleanup 2021-03-14 09:59:53 +03:00
8179be2f62 cleanup 2021-03-14 09:55:24 +03:00
0aa73cd48f Vector space refactor (optimization) 2021-03-14 09:43:22 +03:00
Roland Grinis
384415dc98 utils module for tensors 2021-03-13 19:16:13 +00:00
be9398b322 Vector space refactor 2021-03-13 21:22:18 +03:00
Andrei Kislitsyn
8f88a101d2 complete lu for matrix 2021-03-13 20:51:15 +03:00
Andrei Kislitsyn
3e0d152c1b resolve mc 2021-03-13 19:32:34 +03:00
Andrei Kislitsyn
0911efd4aa add buffered tensor + lu 2021-03-13 19:30:58 +03:00
5e6f65a181 WIP Matrix refactor 2021-03-13 18:19:10 +03:00
d5ba816b7d WIP Matrix refactor 2021-03-13 18:00:47 +03:00
19d3998c3b WIP vector space refactor 2021-03-13 10:10:00 +03:00
9bc8e8fbf9 WIP vector space refactor 2021-03-12 22:52:18 +03:00
Alexander Nozik
48ad773c9d
Merge pull request #238 from mipt-npm/commandertvis/fix-pages-index
Fix lack of index.html
2021-03-12 21:45:59 +03:00
Iaroslav Postovalov
6b44439d43
Fix lack of index.html 2021-03-13 01:44:37 +07:00
Alexander Nozik
2216e23273
Merge pull request #237 from mipt-npm/commandertvis/metaspace
Increase Metaspace size
2021-03-12 21:15:34 +03:00
Iaroslav Postovalov
171f5d5ba3
Increase Metaspace size 2021-03-13 00:57:40 +07:00
Alexander Nozik
0ed70cc960
Merge pull request #232 from mipt-npm/commandertvis/buffer-to-array
Improve collection conversion functions for Buffer
2021-03-12 20:51:16 +03:00
Alexander Nozik
fed74dd69c
Merge pull request #236 from mipt-npm/commandertvis/fix-dokka-build
Fix Dokka build
2021-03-12 20:45:11 +03:00
Iaroslav Postovalov
756626c9bc
Fix Dokka build 2021-03-13 00:42:42 +07:00
Alexander Nozik
de89ef437c
Merge pull request #235 from mipt-npm/commandertvis/fix-wrong-task
Fix wrong task name
2021-03-12 20:07:34 +03:00
Iaroslav Postovalov
1c02ab3471
Fix wrong task name 2021-03-13 00:04:10 +07:00
Alexander Nozik
5e9b2de8b0
Merge pull request #234 from mipt-npm/commandertvis/publish-dokka
Cherry-pick 401ca24
2021-03-12 19:58:29 +03:00
Iaroslav Postovalov
850dd3f58e
Provide pages workflow for sending Dokka artifacts to gh-pages 2021-03-12 23:52:17 +07:00
Alexander Nozik
fa63b84b78
Merge pull request #233 from mipt-npm/commandertvis/publish-dokka
Provide a workflow for sending Dokka artifacts to gh-pages
2021-03-12 19:49:20 +03:00
52a942dbe2 integrand 2021-03-12 19:29:06 +03:00
Iaroslav Postovalov
401ca2443d
Provide pages workflow for sending Dokka artifacts to gh-pages 2021-03-12 23:27:22 +07:00
Iaroslav Postovalov
d562541965
Improve conversion functions for Buffer 2021-03-12 23:23:10 +07:00
Roland Grinis
03cc6a310b Merge PR and check transpose 2021-03-12 15:11:33 +00:00
AlyaNovikova
626d5c98fa change IllegalArgumentException to RuntimeException 2021-03-12 15:43:44 +03:00
AlyaNovikova
70e1861e53 remove extra import 2021-03-12 15:25:47 +03:00
AlyaNovikova
454d574ccd add broadcast and functions plus and minus 2021-03-12 15:20:46 +03:00
Iaroslav Postovalov
993bba3133
Fix #226 2021-03-12 19:03:56 +07:00
Andrei Kislitsyn
95b814e163 add fromMatrix 2021-03-12 14:29:51 +03:00
Andrei Kislitsyn
f9500f44ec new tensor def 2021-03-12 13:50:06 +03:00
Roland Grinis
bb4894b87e removing assignement for non operator members 2021-03-11 21:46:35 +00:00
AlyaNovikova
723e0e458e add functions transpose and transposeAssign 2021-03-11 23:04:42 +03:00
Alexander Nozik
f449bdd58f
Merge pull request #219 from mipt-npm/refactor/algebra-scale
Fully refactor algebra split ScaleOperations from Space.
2021-03-11 11:28:54 +03:00
803f298d8b Make vector spaces great again 2021-03-11 11:28:10 +03:00
fd51564628 Return field get access in algebras 2021-03-11 10:18:59 +03:00
522f39cef3 replace Space by Group 2021-03-10 22:09:19 +03:00
Alexander Nozik
3e15413465
Merge pull request #222 from mipt-npm/commandertvis/benchmarks
Revise benchmarks code
2021-03-10 19:51:23 +03:00
Alexander Nozik
5c2f15da04
Merge pull request #224 from mipt-npm/commandertvis/issue223
Fix #223
2021-03-10 19:23:13 +03:00
Iaroslav Postovalov
39b41cc2ae
Fix #223 2021-03-10 22:40:43 +07:00
fe95c4e48e Code review. 2021-03-10 18:20:23 +03:00
6a5ca2a115 Code review. 2021-03-10 18:02:04 +03:00
Iaroslav Postovalov
940718098d
Revise benchmarks code
Revise benchmarks code by using kotlinx.benchmark type aliases
(it will simplify creating multiplatform benchmarks), using
Blackhole class to consume results, moving all the constant state
to private companion objects
2021-03-10 21:35:28 +07:00
Roland Grinis
3a37b88b5c Fixed getting value test for tensors 2021-03-09 21:13:48 +00:00
Your Name
6298189fb3 Merge remote-tracking branch 'ups/feature/tensor-algebra' into andrew 2021-03-09 22:23:17 +03:00
Your Name
fe55856a26 basic implements & refactor tensor structure & and new tensor algebra methods 2021-03-09 22:18:46 +03:00
Roland Grinis
4210481223 Merge branch 'dev' into feature/tensor-algebra 2021-03-09 08:48:56 +00:00
8ae8ebe871 Fully refactor algebra split ScaleOperations from Space. 2021-03-08 21:03:48 +03:00
Roland Grinis
90f4ff06fd Basic tasks for Alya and Andrei 2021-03-04 13:22:28 +00:00
Roland Grinis
ed007589cf LU decomposition set up 2021-03-02 14:54:07 +00:00
Alexander Nozik
fe9334d570
Merge pull request #214 from mipt-npm/commandertvis/ga-publication
Rewrite workflows
2021-03-02 16:18:08 +03:00
Roland Grinis
4aa1df0628 Safe item method and view_as added 2021-03-02 09:32:36 +00:00
Roland Grinis
f15ac20323 Cannot afford to inherit from RingWithNumbers 2021-03-01 22:52:58 +00:00
Roland Grinis
7c38b16f17 Initial draft for RealTensor and RealTensorALgebra 2021-03-01 21:43:04 +00:00
Alexander Nozik
f5f9bbed53
Merge pull request #216 from mipt-npm/feature/ring-operations
Deprecating div methods
2021-03-01 18:41:20 +03:00
Roland Grinis
ec4b972896 JNI generated files added to .gitignore 2021-03-01 15:19:07 +00:00
Roland Grinis
80f21a2751 Adding .vscode to .gitignore 2021-03-01 15:05:19 +00:00
Roland Grinis
477f7dd079 Deprecating div methods 2021-03-01 13:01:15 +00:00
Roland Grinis
2ea6d0bfdd Merging dev 2021-03-01 12:47:20 +00:00
Iaroslav Postovalov
30bd56d0f7
Support space credentials 2021-02-28 21:29:21 +07:00
Iaroslav Postovalov
4ec33c6857
Remove publishWindows task 2021-02-28 20:23:16 +07:00
Iaroslav Postovalov
a68b102e40
Update deploy.yml 2021-02-28 20:23:02 +07:00
Iaroslav Postovalov
13792b07b2
Add Touchlab notice 2021-02-28 17:14:41 +07:00
Iaroslav Postovalov
d0cf16c8a6
Rework GA workflows 2021-02-28 17:06:47 +07:00
Alexander Nozik
aa69c8fde4
Update README.md
JS-IR badge
2021-02-27 09:56:50 +03:00
Alexander Nozik
1a7dddd497
Merge pull request #210 from mipt-npm/commandertvis/update-deps
Update dependencies
2021-02-26 20:26:40 +03:00
Iaroslav Postovalov
9f663ae7f7
Update dependencies 2021-02-26 21:50:06 +07:00
72affcf09b update build tools 2021-02-22 21:04:08 +03:00
Alexander Nozik
16fcc1c412
Remove bintray badge. 2021-02-21 16:58:43 +03:00
Alexander Nozik
98171bad07
Merge pull request #207 from mipt-npm/dev
Fix landing readme
2021-02-21 16:42:01 +03:00
bc9d8a3ed2 Fix landing readme 2021-02-21 16:40:29 +03:00
Alexander Nozik
dc76a987e1
Merge pull request #206 from mipt-npm/dev
v0.2.0
2021-02-21 16:33:25 +03:00
22dedb06cb Patch changelog 2021-02-21 16:17:57 +03:00
dd5ef4810f Gradle plugin 0.8.0 2021-02-21 16:13:40 +03:00
1ad305ba34 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	kmath-core/api/kmath-core.api
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/linear/MatrixContext.kt
2021-02-19 13:50:49 +03:00
6581f3dd8a Cleanup 2021-02-19 13:38:32 +03:00
Iaroslav Postovalov
84adce13c9
Merge pull request #148 from mipt-npm/gsl-experiment
Changes for upcoming GSL extension project
2021-02-19 17:34:27 +07:00
Iaroslav Postovalov
ef97386033
Fix typo 2021-02-19 17:34:02 +07:00
209e17cd42 Merge histograms 2021-02-19 10:52:56 +03:00
c6ea423bd6 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	CHANGELOG.md
#	kmath-core/api/kmath-core.api
#	kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains/HyperSquareDomain.kt
#	kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/RealHistogram.kt
#	kmath-histograms/src/commonTest/kotlin/scietifik/kmath/histogram/MultivariateHistogramTest.kt
#	kmath-histograms/src/jsMain/kotlin/space/kscience/kmath/histogram/Counters.kt
#	kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/Counters.kt
#	kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogram.kt
#	kmath-histograms/src/jvmMain/kotlin/space/kscience/kmath/histogram/UnivariateHistogramSpace.kt
2021-02-19 09:46:25 +03:00
Alexander Nozik
ee4c348294
Merge pull request #203 from mipt-npm/refactor/histograms
Refactor/histograms
2021-02-18 18:05:03 +03:00
Iaroslav Postovalov
69cdfc9500
Regenerate README, undo workflows changes 2021-02-18 19:39:25 +07:00
Iaroslav Postovalov
48545bae23
Remove changelog changes 2021-02-18 19:38:39 +07:00
Iaroslav Postovalov
e8de7c5fb3
Delete GSL module 2021-02-18 19:38:13 +07:00
Iaroslav Postovalov
2a325b4bc8
Add stub of lib downloading 2021-02-18 19:37:12 +07:00
8485d28872 Change package name to space.kscience 2021-02-18 11:17:28 +03:00
Iaroslav Postovalov
090f93ab7b
Merge branch 'dev' into gsl-experiment 2021-02-17 21:24:40 +07:00
f201210fa0 Merge remote-tracking branch 'origin/dev' into dev 2021-02-15 09:35:14 +03:00
d1b4d1ac11 Histograms refactor 2021-02-15 09:32:25 +03:00
ce18e85a0a Histograms refactor 2021-02-14 22:44:05 +03:00
Alexander Nozik
3b38e5c29a
Merge pull request #204 from mipt-npm/commandertvis/edit-descriptions-of-core-algebras
Fix my mistakes in descriptions of core algebraic structures
2021-02-13 17:11:03 +03:00
Iaroslav Postovalov
acfff40d96
Fix my mistakes in descriptions of core algebraic structures 2021-02-13 21:05:01 +07:00
987997cc02 Histograms refactor 2021-02-12 22:43:35 +03:00
Iaroslav Postovalov
d69a04bb6e
Merge branch 'dev' into feature/mp-samplers 2021-02-12 20:58:03 +07:00
Iaroslav Postovalov
41be1cd34d
Merge branch 'dev' into gsl-experiment 2021-02-12 20:54:21 +07:00
ee29b218f0 Merge remote-tracking branch 'space/dev' into refactor/histograms 2021-02-12 10:44:10 +03:00
Alexander Nozik
5589dc0ce1
Merge pull request #202 from mipt-npm/commandertvis/signature-of-invoke
Fix JVM signature of generated invoke method for final classes
2021-02-11 19:45:30 +03:00
Iaroslav Postovalov
0e42cc9f5c
Update README 2021-02-11 23:35:45 +07:00
Iaroslav Postovalov
f054a4c039
Fix JVM signature of generated invoke method 2021-02-11 23:34:48 +07:00
Iaroslav Postovalov
b6be3a0333
Merge branch 'dev' into gsl-experiment 2021-02-11 23:13:57 +07:00
Alexander Nozik
c3c2658d91
Merge pull request #201 from mipt-npm/commandertvis/fix-benchmarks
Fix broken benchmarks code again
2021-02-11 15:22:09 +03:00
Iaroslav Postovalov
443af750a4
Add kmath-complex reference 2021-02-11 18:44:17 +07:00
Iaroslav Postovalov
15b223a801
Fix compilation issues 2021-02-11 18:43:42 +07:00
Iaroslav Postovalov
228b55f5ea
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	CHANGELOG.md
#	gradle.properties
#	kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt
#	kmath-stat/build.gradle.kts
2021-02-11 17:28:22 +07:00
Iaroslav Postovalov
6aeccef889
Fix benchmarks again 2021-02-11 15:20:29 +07:00
2fdba53911 WIP histograms refactor 2021-02-11 11:18:16 +03:00
a384b323c3 Update examples to use with instead of invoke on algebras 2021-02-11 11:17:44 +03:00
Alexander Nozik
bca36529a5
Merge pull request #183 from mipt-npm/commandertvis/hermitian-conjugate
Add transposeConjugate function for Complex and Double (conjugates are not cached). Minor refactoring of MatrixContext and API reference changes
2021-02-11 11:06:38 +03:00
Alexander Nozik
cd4bfdf59e
Merge pull request #156 from mipt-npm/feature/quaternion
Add fast quaternion implementation, minor changes to complex
2021-02-11 11:01:29 +03:00
Alexander Nozik
87f2021bcb
Merge pull request #200 from mipt-npm/commandertvis/fix-benchmarks
Fix benchmarks source set
2021-02-11 10:55:39 +03:00
Iaroslav Postovalov
a891734ef0
Add newline 2021-02-11 14:53:20 +07:00
Iaroslav Postovalov
b02091402f
Remove explicity qualification 2021-02-11 14:52:26 +07:00
Iaroslav Postovalov
e6876c3f97
Fix benchmarks source set 2021-02-11 14:49:15 +07:00
Iaroslav Postovalov
78dc3ee985
Merge branch 'dev' into commandertvis/hermitian-conjugate 2021-02-09 18:13:03 +07:00
Iaroslav Postovalov
cd96845c31
Discard a change 2021-02-09 18:12:35 +07:00
Iaroslav Postovalov
b06f96c335
Move complex related tests from kmath-core to kmath-complex 2021-02-09 18:11:54 +07:00
Iaroslav Postovalov
da1713b3c6
Fix failing test 2021-02-08 19:01:47 +07:00
Iaroslav Postovalov
956ac6b74f
Fix failing test 2021-02-08 18:42:42 +07:00
Iaroslav Postovalov
39f2c6c3f4
Merge branch 'dev' into feature/mp-samplers 2021-02-07 02:58:10 +07:00
Iaroslav Postovalov
53769ede96
Fix Kotlin version in buildSrc 2021-02-07 02:48:55 +07:00
Iaroslav Postovalov
a5cdf7c297
Merge branch 'dev' into gsl-experiment 2021-02-07 02:46:24 +07:00
Iaroslav Postovalov
d7c28bfd0c
Fix problems related to merge 2021-02-07 02:45:35 +07:00
Iaroslav Postovalov
73969da969
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
#	kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/Complex.kt
2021-02-07 02:31:54 +07:00
Iaroslav Postovalov
5f8054834a
Comment out incorrect tests 2021-02-07 02:26:25 +07:00
Iaroslav Postovalov
b1c9bff07f
Merge branch 'dev' into feature/quaternion 2021-02-07 02:22:55 +07:00
Iaroslav Postovalov
49da84b223
Merge branch 'dev' into gsl-experiment 2021-02-06 23:12:38 +07:00
Iaroslav Postovalov
9210bc9198
Merge branch 'dev' into feature/mp-samplers 2021-02-06 23:12:16 +07:00
Iaroslav Postovalov
1ce8a5708d
Add OptIn annotation 2021-02-06 23:07:11 +07:00
86263f602a Remove inline from Random-based RandomGenerator.kt to work around https://youtrack.jetbrains.com/issue/KT-44703 2021-02-04 13:24:54 +03:00
fab12564cf Kotlin 1.4.30 and JVM-IR 2021-02-04 11:00:30 +03:00
2738496447 Histogram API update 2021-02-04 11:00:08 +03:00
Iaroslav Postovalov
1306ee418f
Update workflows 2021-02-01 21:39:20 +07:00
065d7a150a Fix kotlin version bug for GSL codegen 2021-02-01 13:20:33 +03:00
cde9d85a96 Fix symbol delegate after build work-around for https://youtrack.jetbrains.com/issue/KT-4012 2021-02-01 12:58:56 +03:00
8f101c5cd0 Fix symbol delegate after build work-around for https://youtrack.jetbrains.com/issue/KT-4012 2021-02-01 12:34:30 +03:00
730678b2fc Add safety checks for kmath-for-real buffer operations. 2021-01-31 20:02:11 +03:00
Iaroslav Postovalov
a0186844f5
Update README files 2021-01-31 15:36:35 +07:00
Iaroslav Postovalov
55f8c3938b
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	.github/workflows/build.yml
2021-01-31 14:57:31 +07:00
Iaroslav Postovalov
d728c35d72
Minor: regenerate README files 2021-01-31 14:50:48 +07:00
Iaroslav Postovalov
46650a414e
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
#	README.md
#	kmath-core/README.md
2021-01-31 14:46:11 +07:00
Iaroslav Postovalov
cd439ce2ed
Minor: regenerate README files 2021-01-31 14:40:03 +07:00
Iaroslav Postovalov
1cfe5a31a7
Add QR decomposition support in GSL wrapper 2021-01-31 00:57:15 +07:00
28240954b0 Documentation update. API generated 2021-01-30 20:23:15 +03:00
0a733642dd Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	README.md
#	kmath-ast/README.md
#	kmath-core/README.md
#	kmath-for-real/README.md
#	kmath-nd4j/README.md
2021-01-30 20:12:40 +03:00
85927c9f6b Documentation update. 2021-01-30 20:12:14 +03:00
Alexander Nozik
8e89b5eba3
Create publish.yml
Add publish workflow
2021-01-30 20:06:21 +03:00
Iaroslav Postovalov
e66f169655
Add owned property to all the objects 2021-01-30 17:35:13 +07:00
Iaroslav Postovalov
955e95690d
Merge branch 'dev' into gsl-experiment 2021-01-30 17:20:36 +07:00
Iaroslav Postovalov
4f78286756
Fix after-merge problems 2021-01-30 17:19:46 +07:00
5f6c133550 Histogram refactor 2021-01-30 11:24:34 +03:00
Iaroslav Postovalov
70c0b614a3
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
#	examples/src/main/kotlin/kscience/kmath/operations/ComplexDemo.kt
#	examples/src/main/kotlin/kscience/kmath/structures/ComplexND.kt
#	kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/ComplexNDField.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/structures/NDAlgebra.kt
#	kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NDFieldTest.kt
2021-01-29 17:00:57 +07:00
Iaroslav Postovalov
5c982df36a
Merge branch 'dev' into commandertvis/hermitian-conjugate
# Conflicts:
#	kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/nd/Structure2D.kt
2021-01-29 16:54:42 +07:00
Alexander Nozik
e1ca02dced
Merge pull request #197 from mipt-npm/refactor/ndalgebra
Refactor/ndalgebra
2021-01-28 20:13:38 +03:00
2e52457b96 fix merge 2021-01-28 20:10:42 +03:00
45866b500f Merge remote-tracking branch 'origin/dev' into refactor/ndalgebra
# Conflicts:
#	CHANGELOG.md
#	examples/src/benchmarks/kotlin/kscience/kmath/benchmarks/LinearAlgebraBenchmark.kt
#	kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMMatrix.kt
#	kmath-for-real/src/commonMain/kotlin/kscience/kmath/real/RealMatrix.kt
2021-01-28 20:07:43 +03:00
228c0b3886 misc 2021-01-28 20:04:33 +03:00
Alexander Nozik
d9afcf019a
Merge pull request #189 from mipt-npm/commandertvis/cm-decompositions
Support of new matrix decomposition features for CMMatrix
2021-01-28 19:58:07 +03:00
Iaroslav Postovalov
6503ed4cde
Merge branch 'dev' into commandertvis/cm-decompositions 2021-01-25 17:38:27 +07:00
Alexander Nozik
6cfabbe7ef
Merge pull request #198 from mipt-npm/commandertvis/fix-lup-capitalization
Fix capitalization of LUP in reference names
2021-01-24 19:56:02 +03:00
Iaroslav Postovalov
e0b8a0bfe5
Update the changelog 2021-01-24 22:30:52 +07:00
Iaroslav Postovalov
b20081f161
Fix capitalization of LUP related references (LUP -> Lup) 2021-01-24 22:12:43 +07:00
8a2f1586e2 suppress unused 2021-01-24 17:11:14 +03:00
aff7bbab41 Matrix performance optimization 2021-01-24 17:07:19 +03:00
Iaroslav Postovalov
d36da01833
Rename GslMemoryHolder to GslObject 2021-01-24 16:13:30 +07:00
Iaroslav Postovalov
c50fab027a
Improve null checking and introduce internal wrapper of permutation object 2021-01-24 16:13:08 +07:00
3bbb39f30d cleanup parallel field example 2021-01-24 10:26:56 +03:00
Iaroslav Postovalov
472e2bf671
Improve LUP decomposition wrapper, add Cholesky decomposition 2021-01-24 14:15:41 +07:00
9829a16a32 Optimize Real NDField 2021-01-24 10:15:16 +03:00
1cb41f4dc2 Optimize Real NDField 2021-01-23 22:16:27 +03:00
Iaroslav Postovalov
7105b3662f
Minor: update Kotlin compiler in buildSrc 2021-01-24 02:08:11 +07:00
Iaroslav Postovalov
35a1b91329
Merge branch 'dev' into commandertvis/hermitian-conjugate
# Conflicts:
#	kmath-core/src/commonMain/kotlin/kscience/kmath/linear/FeaturedMatrix.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/linear/VirtualMatrix.kt
2021-01-24 02:02:20 +07:00
Iaroslav Postovalov
9342824c96
Merge branch 'dev' into feature/quaternion 2021-01-24 02:00:22 +07:00
Iaroslav Postovalov
9c77f8f02f
Remove incorrect lines 2021-01-24 01:59:42 +07:00
Iaroslav Postovalov
624460c52d
Merge branch 'dev' into feature/mp-samplers
# Conflicts:
#	examples/src/main/kotlin/kscience/kmath/stat/DistributionBenchmark.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/structures/Structure2D.kt
2021-01-24 01:55:32 +07:00
0baec14059 [WIP] Refactor NDStructures 2021-01-23 21:50:48 +03:00
Iaroslav Postovalov
904a0f3525
Merge branch 'dev' into gsl-experiment 2021-01-24 01:49:43 +07:00
Iaroslav Postovalov
d9ebadd22a
Implement LUP decomposition in GSL module 2021-01-24 01:46:07 +07:00
332c04b573 [WIP] Refactor NDStructures 2021-01-23 19:19:13 +03:00
061398b009 [WIP] Refactor NDStructures 2021-01-22 23:22:24 +03:00
c51018b426 Regenerate readme 2021-01-22 14:29:46 +03:00
Iaroslav Postovalov
a3cf13b678
Merge branch 'dev' into commandertvis/cm-decompositions
# Conflicts:
#	kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMMatrix.kt
2021-01-21 18:43:03 +07:00
Alexander Nozik
2d946b10ae
Merge pull request #194 from mipt-npm/dev
Dev
2021-01-20 17:32:31 +03:00
d10ae66e58 Deploy fixes for 0.2.0-dev-5 2021-01-20 17:08:29 +03:00
881b85a1d9 Add origin (optin) extension property to expose MatrixWrapper content 2021-01-20 15:32:55 +03:00
d00e7434a4 Fix for #193 2021-01-20 15:07:39 +03:00
Iaroslav Postovalov
54d61c016e
Discard temporary changes 2021-01-20 16:53:12 +07:00
Iaroslav Postovalov
8019ac6802
Merge branch 'dev' into gsl-experiment 2021-01-20 16:52:29 +07:00
Iaroslav Postovalov
72832bae10
Minor: reformat 2021-01-20 16:51:36 +07:00
Iaroslav Postovalov
f3c602115a
Merge branch 'dev' into commandertvis/cm-decompositions
# Conflicts:
#	kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt
2021-01-20 16:51:12 +07:00
9011579d2c [WIP] Tensor algebra design 2021-01-20 11:43:01 +03:00
Iaroslav Postovalov
2d1d6c008e
Fix after-merge problems 2021-01-20 15:07:12 +07:00
Iaroslav Postovalov
94a6d5a114
Fix after-merge problems 2021-01-20 14:56:09 +07:00
9ef32db236 Merge branch 'dev' into altavir/tensor-algebra 2021-01-19 23:08:36 +03:00
7acea94e90 Merge remote-tracking branch 'origin/dev' into dev 2021-01-19 22:49:06 +03:00
1c7bd05c58 Add proper equality check for EJML matrices 2021-01-19 22:48:43 +03:00
d0c9d97706 Minor optimization for RealNDAlgebra 2021-01-19 22:29:19 +03:00
a11711c336 Tensor algebra refactoring 2021-01-19 22:25:04 +03:00
360e0e17e9 Minor optimization for RealNDAlgebra 2021-01-19 22:24:42 +03:00
Iaroslav Postovalov
9748e0bfbe
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
#	examples/src/main/kotlin/kscience/kmath/stat/DistributionBenchmark.kt
#	kmath-complex/src/commonMain/kotlin/kscience/kmath/complex/ComplexNDField.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Complex.kt
#	kmath-core/src/commonTest/kotlin/kscience/kmath/structures/NDFieldTest.kt
2021-01-20 01:10:31 +07:00
Iaroslav Postovalov
d17dbd365c
Fix issues related to merge 2021-01-20 01:03:55 +07:00
Iaroslav Postovalov
f711fe3d35
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	CHANGELOG.md
2021-01-20 00:34:19 +07:00
Iaroslav Postovalov
57b1157650
Reformat, bring back the features of CMMatrix with the new API, add missing features in QRDecomposition in EjmlMatrix 2021-01-20 00:28:39 +07:00
Iaroslav Postovalov
97ec575142
Merge branch 'dev' into commandertvis/cm-decompositions
# Conflicts:
#	kmath-commons/src/main/kotlin/kscience/kmath/commons/linear/CMMatrix.kt
#	kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt
2021-01-20 00:19:34 +07:00
53c32abf4f Merge branch 'dev' into feature/tensor-algebra 2021-01-19 20:02:08 +03:00
Alexander Nozik
b3cd4f8e1b
Merge pull request #191 from mipt-npm/commandertvis/update-changelog
Update changelog
2021-01-19 19:38:25 +03:00
4c256a9f14 Features refactoring. 2021-01-19 19:32:13 +03:00
ab32cd9561 Numeric operations are decoupled from Ring 2021-01-19 17:16:43 +03:00
Iaroslav Postovalov
ad822271b3
Update changelog 2021-01-19 20:25:26 +07:00
Iaroslav Postovalov
1a7bd76152
Update changelog 2021-01-19 20:23:11 +07:00
Iaroslav Postovalov
5003cca2cd
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt
2021-01-19 20:19:13 +07:00
Iaroslav Postovalov
acdeeadd6d
Update changelog 2021-01-19 20:17:53 +07:00
Iaroslav Postovalov
cdf4984568
Update tools again 2021-01-19 19:47:08 +07:00
Roland Grinis
ecf813803b Correcting terminology and failed connection to Algebra<T> 2021-01-18 18:34:23 +00:00
4635080317 Optimize RealMatrix dot operation 2021-01-18 21:33:53 +03:00
Iaroslav Postovalov
348f114bb6
Minor: add newline 2021-01-19 01:10:16 +07:00
Iaroslav Postovalov
53db4489f8
Implement decomposition features by CMMatrix 2021-01-19 01:09:44 +07:00
Iaroslav Postovalov
7418228d08
Update KDoc comments 2021-01-19 00:27:28 +07:00
Iaroslav Postovalov
6d118fc841
Minor: fix a typo 2021-01-19 00:15:09 +07:00
Iaroslav Postovalov
f1b319f73d
Minor: micro-optimize getFeature function, reformat 2021-01-19 00:14:12 +07:00
Iaroslav Postovalov
3f00410fc1
Add missing import 2021-01-17 19:12:14 +07:00
Iaroslav Postovalov
6636b228f3
Add missing JvmName annotations 2021-01-17 18:59:20 +07:00
Iaroslav Postovalov
bd178d77ba
Add transposeConjugate function for Complex and Double (conjugate values are not cached). Minor refactoring of MatrixContext and API reference changes 2021-01-17 02:38:48 +07:00
Roland Grinis
835d64d797 Initial draft for TensorAlgebra 2021-01-16 19:29:47 +00:00
Iaroslav Postovalov
7699983f0a
Update tools 2021-01-16 18:53:12 +07:00
Alexander Nozik
758508ba96
Merge pull request #180 from mipt-npm/commandertvis/matrix-decompositions
Update KDoc comments for Matrix classes, improve MatrixFeature API, implement new features with EJML matrix, delete inversion API from EJML in favor of InverseMatrixFeature, override point by EJML matrix
2021-01-16 12:28:42 +03:00
Iaroslav Postovalov
7fdd001a77
Update KDoc comments for Matrix classes, improve MatrixFeature API, implement new features with EJML matrix, delete inversion API from EJML in favor of InverseMatrixFeature, override point by EJML matrix 2021-01-16 15:51:36 +07:00
Iaroslav Postovalov
de289afb7b
Override point function in GslMatrixContext 2021-01-15 23:01:35 +07:00
Iaroslav Postovalov
1c70e73a71
Merge branch 'dev' into gsl-experiment 2021-01-15 21:39:26 +07:00
Alexander Nozik
fed17a17a9
Merge pull request #175 from mipt-npm/commandertvis/update-gradle
Update Gradle again
2021-01-10 17:18:36 +03:00
Iaroslav Postovalov
0ef7e7ca52
Update Gradle again 2021-01-10 17:53:15 +07:00
Alexander Nozik
a5e8c971ba
Merge pull request #173 from mipt-npm/commandertvis/ast-valid-constantfolding
Fix #172, add constant folding for unary operations from numeric nodes
2021-01-07 19:20:31 +03:00
Iaroslav Postovalov
f5b6847bf6
Merge branch 'dev' into gsl-experiment 2021-01-07 22:46:53 +07:00
Iaroslav Postovalov
2012d2c3f1
Fix #172, add constant folding for unary operations from numeric nodes 2021-01-07 22:42:37 +07:00
44ea32e843 Merge remote-tracking branch 'origin/dev' into dev 2021-01-07 18:07:26 +03:00
b288704528 Optimize RealMatrix dot operation 2021-01-07 18:07:00 +03:00
Iaroslav Postovalov
4dd6f506c8
Disable OSX temporarily 2021-01-07 19:38:46 +07:00
Iaroslav Postovalov
a814dec4c6
Reformat generated GslVector APIs 2021-01-07 18:38:52 +07:00
Iaroslav Postovalov
f7fc327e8c
Reformat generated APIs 2021-01-07 18:28:51 +07:00
Iaroslav Postovalov
a86987362b
Fix access for Complex GSL wrappers 2021-01-07 17:34:55 +07:00
Iaroslav Postovalov
f84f719385
Add GSL objects disposition check, add missing newline, improve tests 2021-01-07 17:26:16 +07:00
Iaroslav Postovalov
57328a176e
Improve tests 2021-01-07 02:45:37 +07:00
Iaroslav Postovalov
ff930532e0
Fix failing test 2021-01-07 02:27:46 +07:00
Iaroslav Postovalov
c34af4d8bd
Update tests of GSL 2021-01-06 23:01:05 +07:00
Iaroslav Postovalov
20767a3b35
Add convenience scope functions for GSL contexts 2021-01-06 22:46:32 +07:00
Iaroslav Postovalov
5d855bd915
Merge branch 'dev' into gsl-experiment 2021-01-06 21:09:07 +07:00
Iaroslav Postovalov
ae126d36c8
Update readmes for Complex, minor update of build-script 2021-01-06 21:06:57 +07:00
Iaroslav Postovalov
acf9dd2b6a
Extract complex and quaternion systems to another module 2021-01-06 21:01:37 +07:00
Iaroslav Postovalov
c3b8f11f22
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt
2021-01-05 21:23:12 +07:00
Alexander Nozik
ac03068512
Merge pull request #162 from mipt-npm/feature/dynamic-ops-currying
Provide dynamic operations currying for Algebra<T> instead of eager calls and add JS code generation support
2021-01-05 16:36:51 +03:00
Alexander Nozik
6660360ae2
Merge pull request #169 from mipt-npm/update-gradle
Update Gradle
2021-01-05 16:34:12 +03:00
Iaroslav Postovalov
06c551d346
Update Gradle 2021-01-05 20:23:07 +07:00
Iaroslav Postovalov
28ddc7cd95
Minor: regenerate readme files 2021-01-05 20:16:42 +07:00
Iaroslav Postovalov
fc152dec4f
Fix readme template 2021-01-05 20:15:50 +07:00
Iaroslav Postovalov
ea8dc63b1a
Update doc comments in parser.kt 2021-01-05 20:14:50 +07:00
Iaroslav Postovalov
2c7cb1b04f
Rename ...Operation functions returning function to ...OperationFunction 2021-01-05 19:56:42 +07:00
Iaroslav Postovalov
024800605f
Update ASM 2020-12-22 22:20:30 +07:00
Alexander Nozik
b72b6fb34f
Merge pull request #168 from mipt-npm/space-url
Add Space repository URL
2020-12-22 18:18:08 +03:00
Iaroslav Postovalov
dab6b0e385
Add Space repository URL 2020-12-22 22:15:24 +07:00
Iaroslav Postovalov
1a5efd0a17
Improve ASM and ESTree tests quality 2020-12-22 18:17:24 +07:00
Iaroslav Postovalov
50b62f8a3b
Update readme 2020-12-22 18:02:02 +07:00
Iaroslav Postovalov
1b0f462e54
Reformat build.gradle.kts 2020-12-22 17:49:32 +07:00
Iaroslav Postovalov
d631c048c7
Fix minor problems, update README 2020-12-22 16:00:51 +07:00
Iaroslav Postovalov
c738fb1f2a
Make return types more specific in MstAlgebra.kt 2020-12-22 13:44:52 +07:00
Iaroslav Postovalov
2310aca9db
Improve consistency of operations in MstAlgebra 2020-12-22 13:42:12 +07:00
Iaroslav Postovalov
d521fa0d8d
Fix wrong function name 2020-12-22 13:15:01 +07:00
Iaroslav Postovalov
1ab6702bb4
Delete unused property 2020-12-22 13:11:44 +07:00
Iaroslav Postovalov
46ac73d2c1
Add undefined handling in constant insertion 2020-12-22 13:11:12 +07:00
Iaroslav Postovalov
d657f40e3f
Fix KDoc comments 2020-12-22 12:58:35 +07:00
Iaroslav Postovalov
cfc13cda8f
Rename files and JSBuilder 2020-12-22 12:57:50 +07:00
Iaroslav Postovalov
306eaecdb1
Remove invalid import 2020-12-20 21:55:20 +07:00
Iaroslav Postovalov
7002bdb5bd
Remove redundant suppression 2020-12-20 21:45:02 +07:00
Iaroslav Postovalov
12d6422065
Fix wrong package 2020-12-20 21:43:04 +07:00
Iaroslav Postovalov
69b1952c15
Add verification of NDField 2020-12-20 21:13:11 +07:00
Iaroslav Postovalov
c8df741a4e
Remove incorrent symbol decl. 2020-12-20 20:58:52 +07:00
Iaroslav Postovalov
9fbca45235
Fix incorrect properties in verifier classes 2020-12-20 20:48:38 +07:00
Iaroslav Postovalov
b8e9a7d327
Merge branch 'dev' into feature/dynamic-ops-currying
# Conflicts:
#	kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Algebra.kt
2020-12-20 20:42:01 +07:00
Iaroslav Postovalov
d70b185b3e
Update documentation for Algebra, add overloads for xOperation that invokes an operation not dispatches it 2020-12-20 20:41:17 +07:00
Iaroslav Postovalov
4294bc1b97
Hide bindings from public API 2020-12-20 19:23:10 +07:00
Iaroslav Postovalov
d9932042e8
Delete TS bindings 2020-12-20 19:04:43 +07:00
Iaroslav Postovalov
9a875bc7db
Add missing newline 2020-12-20 19:04:09 +07:00
Iaroslav Postovalov
95701bec1b
Add informative NoSuchElementException message 2020-12-20 19:02:36 +07:00
Iaroslav Postovalov
3cd00b9df6
Inline internal functions with one usage 2020-12-20 18:55:59 +07:00
Iaroslav Postovalov
484b35cb4f
Fix failing tests 2020-12-20 18:34:35 +07:00
de3c2a1b5a Add curring and update kotlin 2020-12-20 14:18:12 +03:00
Iaroslav Postovalov
a655404486
Fix typo 2020-12-20 17:43:21 +07:00
Iaroslav Postovalov
32d77c0e7f
Implement ESTree based code generation for the MST 2020-12-20 17:42:57 +07:00
Iaroslav Postovalov
a5c00051c2
Merge branch 'feature/dynamic-ops-currying' into feature/estree-codegen 2020-12-20 00:58:17 +07:00
Iaroslav Postovalov
d66fb4be75
Delete empty file 2020-12-20 00:56:08 +07:00
Iaroslav Postovalov
bdd33ca6ca
Add dependencies needed for ESTree codegen 2020-12-20 00:49:48 +07:00
Iaroslav Postovalov
cdebe2fc4f
Add API documentation, fix hashCode 2020-12-20 00:06:40 +07:00
Iaroslav Postovalov
c30e739862
Merge branch 'dev' into feature/quaternion 2020-12-12 21:10:21 +07:00
Iaroslav Postovalov
386b063c94
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	.github/workflows/gradle.yml
2020-12-12 21:09:07 +07:00
Iaroslav Postovalov
0952d573bc
Merge branch 'dev' into feature/dynamic-ops-currying 2020-12-12 21:06:39 +07:00
Iaroslav Postovalov
2f11660439
Replace Distribution.normal with NormalDistribution 2020-12-12 21:03:28 +07:00
Iaroslav Postovalov
e43aad33fe
Add missing import 2020-12-12 17:13:14 +07:00
Iaroslav Postovalov
5c54640e60
Merge branch 'dev' into mp-samplers
# Conflicts:
#	examples/src/main/kotlin/kscience/kmath/stat/DistributionDemo.kt
#	kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/distributions.kt
2020-12-12 17:11:09 +07:00
Alexander Nozik
f1435c2c05
Merge pull request #160 from mipt-npm/cross-platform-ga-run
Make gradle GA run cross-platform
2020-12-12 11:17:18 +03:00
Iaroslav Postovalov
07d6d89192
Replace reflective constructor invocation with method handle 2020-12-09 14:43:37 +07:00
Iaroslav Postovalov
95c1504c00
Add cast microoptimization to AsmBuilder 2020-12-09 11:41:37 +07:00
Iaroslav Postovalov
6d96bba101
Fix variable name 2020-12-08 16:35:30 +07:00
Iaroslav Postovalov
cc45e3683b
Refactor ASM builder 2020-12-08 16:16:32 +07:00
Iaroslav Postovalov
f001389f4c
Merge branch 'dev' into feature/dynamic-ops-currying
# Conflicts:
#	kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt
2020-12-08 15:12:52 +07:00
Iaroslav Postovalov
e62cf4fc65
Rewrite ASM codegen to use curried operators, fix bugs, update benchmarks 2020-12-08 14:42:42 +07:00
Iaroslav Postovalov
8603149d4b
Update gradle.yml 2020-12-07 14:01:46 +07:00
Iaroslav Postovalov
1064a24940
Make gradle GA run cross-platform 2020-12-07 04:28:54 +07:00
Iaroslav Postovalov
3d879a766b
Add missing KDoc comment 2020-12-07 02:19:50 +07:00
Iaroslav Postovalov
7a571089a8
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
2020-12-06 04:07:11 +07:00
Iaroslav Postovalov
2f1cfefeac
Update Kotlin, document codegen functions 2020-12-06 04:05:36 +07:00
Iaroslav Postovalov
96957dfa4b
Add missing experimental annotation 2020-12-02 10:49:47 +07:00
Iaroslav Postovalov
f46826f2b1
Fix GSL matrix context 2020-12-02 10:12:33 +07:00
Iaroslav Postovalov
0e8f6e29ee
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt
#	kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt
2020-12-02 09:21:25 +07:00
712df04170 Implemented #131 2020-12-01 21:21:56 +03:00
5368bb5d4a Readme update 2020-11-30 11:25:21 +03:00
89c0d863d2 Benchmark refactoring 2020-11-29 22:26:05 +03:00
625e624cab kmath-for-real refactoring 2020-11-29 21:38:12 +03:00
Iaroslav Postovalov
df4ea2c1e4
Merge branch 'dev' into gsl-experiment 2020-11-30 01:20:52 +07:00
Iaroslav Postovalov
6fb3c03e87
Fix broken APIs in kmath-for-real 2020-11-30 01:19:27 +07:00
Iaroslav Postovalov
0db33cca55
Merge branch 'dev' into gsl-experiment 2020-11-30 00:56:35 +07:00
Iaroslav Postovalov
4433da9acf
Merge remote-tracking branch 'origin/dev' into dev 2020-11-30 00:56:01 +07:00
Iaroslav Postovalov
b10ba4c62a
Update KotlinGrad 2020-11-30 00:55:42 +07:00
Iaroslav Postovalov
5a3fccb455
Add reference to Commons Math implementation of InternalErf, fix markdown issues, rename prob package in examples to stat 2020-11-29 22:02:06 +07:00
5b653f10d7 kmath-for-real refactoring 2020-11-29 13:32:20 +03:00
Iaroslav Postovalov
12758d589e
Merge branch 'dev' into mp-samplers 2020-11-29 16:25:25 +07:00
Iaroslav Postovalov
f18cd9ad40
Fix package names 2020-11-29 16:25:08 +07:00
Iaroslav Postovalov
4fc8d7b57c
Fix build 2020-11-29 16:12:41 +07:00
Iaroslav Postovalov
f8272f29b6
Remove failing test 2020-11-29 02:20:04 +07:00
Iaroslav Postovalov
e5d5ac17da
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	build.gradle.kts
#	examples/build.gradle.kts
#	examples/src/main/kotlin/kscience/kmath/ast/ExpressionsInterpretersBenchmark.kt
#	settings.gradle.kts
2020-11-29 01:17:16 +07:00
Iaroslav Postovalov
863b22a451
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
2020-11-29 01:14:08 +07:00
Iaroslav Postovalov
0595950820
Merge branch 'dev' into feature/dynamic-ops-currying 2020-11-29 01:11:32 +07:00
c21e761a76 Workaround for https://youtrack.jetbrains.com/issue/KT-40121 2020-11-28 19:46:51 +03:00
a8329b2ed2 Grid generators moved to kmath-for-real 2020-11-28 18:43:35 +03:00
Iaroslav Postovalov
e447a15304
Make MstAlgebra operations return specific types 2020-11-28 13:42:18 +07:00
Iaroslav Postovalov
3e7c9d8dce
Rework unary/binary operation API 2020-11-28 13:37:37 +07:00
af306084cf Test for #65 2020-11-22 19:16:08 +03:00
1538bc0e69 Merge remote-tracking branch 'origin/dev' into dev 2020-11-22 19:06:50 +03:00
434229a43a Implementation for #65 2020-11-22 19:06:38 +03:00
Iaroslav Postovalov
aaecc36532
Update invalid test 2020-11-10 19:07:17 +07:00
Iaroslav Postovalov
1539113e72
Make complex and quaternion NaN-hostile 2020-11-10 19:01:26 +07:00
Iaroslav Postovalov
3c602e859d
Merge branch 'dev' into mp-samplers
# Conflicts:
#	examples/src/main/kotlin/kscience/kmath/commons/prob/DistributionBenchmark.kt
#	examples/src/main/kotlin/kscience/kmath/commons/prob/DistributionDemo.kt
#	kmath-commons/src/main/kotlin/kscience/kmath/commons/expressions/DiffExpression.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/distributions/NormalDistribution.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/internal/InternalErf.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/internal/InternalGamma.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/internal/InternalUtils.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/AhrensDieterExponentialSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/AhrensDieterMarsagliaTsangGammaSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/AliasMethodDiscreteSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/BoxMullerNormalizedGaussianSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/GaussianSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/KempSmallMeanPoissonSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/LargeMeanPoissonSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/MarsagliaNormalizedGaussianSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/NormalizedGaussianSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/PoissonSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/SmallMeanPoissonSampler.kt
#	kmath-stat/src/commonMain/kotlin/kscience/kmath/stat/samplers/ZigguratNormalizedGaussianSampler.kt
#	kmath-stat/src/jvmMain/kotlin/kscience/kmath/stat/distributions.kt
2020-11-02 01:16:29 +07:00
Iaroslav Postovalov
b1ccca1019
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
#	examples/build.gradle.kts
#	examples/src/main/kotlin/kscience/kmath/ast/ExpressionsInterpretersBenchmark.kt
#	kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/MstAlgebra.kt
2020-11-02 01:15:13 +07:00
Iaroslav Postovalov
abe68a4fb6
Merge pull request #150 from mipt-npm/kotlingrad
Add adapters of scalar functions to MST and vice versa
2020-11-02 01:09:44 +07:00
Iaroslav Postovalov
33d23c8d28
Duplicate repositories declared in main build script, fix errors 2020-11-02 01:08:55 +07:00
Iaroslav Postovalov
658a1703ed
Add KDoc comment 2020-10-31 21:44:52 +07:00
Iaroslav Postovalov
6b71d8525d
Merge branch 'dev' into kotlingrad
# Conflicts:
#	examples/build.gradle.kts
#	examples/src/main/kotlin/kscience/kmath/ast/ExpressionsInterpretersBenchmark.kt
2020-10-30 19:08:50 +07:00
Iaroslav Postovalov
d14e437659
Update DifferentiableExpression by providing second type argument representing the result of differentiation 2020-10-30 16:57:19 +07:00
Iaroslav Postovalov
ef7066b8c9
Update example 2020-10-30 16:40:58 +07:00
Iaroslav Postovalov
bc4eb95ae7
Add extension functions for DifferentiableMstExpression 2020-10-30 16:40:43 +07:00
Iaroslav Postovalov
0731f2bd89
Merge branch 'nd4j' into dev 2020-10-30 01:09:46 +07:00
Iaroslav Postovalov
29a670483b
Update KG and Maven repos, delete symbol delegate provider, implement working differentiable mst expression based on SFun shape to MST conversion 2020-10-30 01:09:11 +07:00
Iaroslav Postovalov
520f6cedeb
Merge branch 'dev' into kotlingrad 2020-10-30 00:00:38 +07:00
Iaroslav Postovalov
095b165fa4
Uncomment expressions benchmark, and add factory methods for Nd4jRing and Nd4jField 2020-10-29 23:59:36 +07:00
Alexander Nozik
d7071566fa
Merge pull request #116 from mipt-npm/nd4j
Implement kmath-nd4j: module that implements NDStructure for INDArray of ND4J
2020-10-29 19:58:53 +03:00
Alexander Nozik
f40c1f2919
Merge branch 'dev' into nd4j 2020-10-29 19:58:35 +03:00
6f31ddba30 Fix CM DerivativeStructureField constants 2020-10-29 19:50:45 +03:00
fbe1ab94a4 Change DifferentiableExpression API to use ordered symbol list instead of orders map. 2020-10-29 19:35:08 +03:00
Iaroslav Postovalov
61e58c4302
Enable AST example 2020-10-29 16:04:04 +07:00
Iaroslav Postovalov
cdd196097e
Specify operator modifier explicitly 2020-10-29 15:56:41 +07:00
Iaroslav Postovalov
6d016c87f2
Merge branch 'dev' into feature/quaternion
# Conflicts:
#	CHANGELOG.md
2020-10-29 15:49:49 +07:00
Iaroslav Postovalov
1e1819ac78
Merge branch 'dev' into gsl-experiment
# Conflicts:
#	build.gradle.kts
#	settings.gradle.kts
2020-10-29 15:47:09 +07:00
Iaroslav Postovalov
022b8f0fa3
Regenerate readme 2020-10-29 15:44:30 +07:00
Iaroslav Postovalov
57910f617a
Rename API classes, update readme files 2020-10-29 15:39:53 +07:00
Iaroslav Postovalov
d7cf04a98b
Merge branch 'dev' into nd4j
# Conflicts:
#	CHANGELOG.md
#	settings.gradle.kts
2020-10-29 13:38:52 +07:00
Iaroslav Postovalov
6f0f6577de
Refactor toSFun, update KG, delete KMath algebra protocol, update DifferentiableMstExpr. 2020-10-29 13:34:12 +07:00
Iaroslav Postovalov
f341d02941
Rename files, improve error handling, minor codegen update 2020-10-29 04:23:36 +07:00
Iaroslav Postovalov
7f8abbdd20
Fix typo, introduce KG protocol delegating to algebra 2020-10-29 02:22:34 +07:00
Iaroslav Postovalov
2b7803290f
Merge branch 'dev' into kotlingrad
# Conflicts:
#	settings.gradle.kts
2020-10-28 18:37:21 +07:00
Iaroslav Postovalov
55909aee0d
Add additional constructor 2020-10-28 18:36:00 +07:00
Alexander Nozik
4b7bd3d174
Merge pull request #154 from mipt-npm/feature/diff-api
Feature/diff api
2020-10-28 13:25:23 +03:00
Alexander Nozik
ef2fa5f30e
Merge branch 'dev' into feature/diff-api 2020-10-28 12:08:38 +03:00
e5751c4cdc Fix did not work, rolled back. 2020-10-28 10:07:50 +03:00
73b4294122 Try to fix Native compilation bug 2020-10-28 09:56:33 +03:00
5fa4d40f41 Remove Differentiable 2020-10-28 09:25:37 +03:00
dfa1bcaf01 prob renamed to stat 2020-10-28 09:16:21 +03:00
f8c3d1793c Fitting refactor 2020-10-28 09:08:37 +03:00
1c1580c8e6 Generification of autodiff and chi2 2020-10-27 17:57:49 +03:00
9a147d033e Another refactor of SimpleAutoDiff 2020-10-27 17:57:17 +03:00
Iaroslav Postovalov
202ea3582c
Add field test, minor refactor 2020-10-27 20:31:28 +07:00
Iaroslav Postovalov
828e40c452
Add toQuaternion extension for Complex 2020-10-27 19:19:53 +07:00
Iaroslav Postovalov
59a50810cc
Remove KDoc comments 2020-10-27 18:17:42 +07:00
Iaroslav Postovalov
3714cfc28e
Replace Double specialized ops with Number ones 2020-10-27 18:15:43 +07:00
Iaroslav Postovalov
76717c49b1
Implement fast quaternion implementation, minor changes to complex 2020-10-27 18:06:27 +07:00
4450c0fcc7 Fix orders in DerivativeStructures 2020-10-26 14:44:57 +03:00
30132964dd Separate object for fitting. Chi-squared 2020-10-26 10:01:30 +03:00
57781678e5 Cleanup 2020-10-25 19:46:22 +03:00
1fbe12149d Advanced configuration API for cm-optimization 2020-10-25 19:31:12 +03:00
d826dd9e83 Initial optimization implementation for CM 2020-10-24 20:33:19 +03:00
94df61cd43 cleanup 2020-10-24 13:05:36 +03:00
Iaroslav Postovalov
59b120e086
Fix platform declarations 2020-10-23 17:01:16 +07:00
f7614da230 Refactoring 2020-10-22 11:27:08 +03:00
04d3f4a99f Fix ASM 2020-10-22 09:28:18 +03:00
ae07652d9e Symbol identity is always a string 2020-10-21 11:38:28 +03:00
Iaroslav Postovalov
826ec727b7
Merge branch 'dev' into mp-samplers 2020-10-21 02:29:53 +07:00
Iaroslav Postovalov
457931dd86
Update Gradle 2020-10-21 02:26:54 +07:00
Iaroslav Postovalov
a0391a3b83
Merge branch 'master' into dev
# Conflicts:
#	README.md
2020-10-21 02:24:02 +07:00
6386f2b894 Update build tools 2020-10-20 10:03:09 +03:00
707ad21f77 New Expression API 2020-10-19 22:51:33 +03:00
Iaroslav Postovalov
612f6f0082
Refactor, remove unused files, remove BasicSampler 2020-10-16 16:49:47 +07:00
Iaroslav Postovalov
d4aa4587a9
Add missing files 2020-10-15 23:53:19 +07:00
Iaroslav Postovalov
0c6fff3878
Code refactoring, implement NormalDistribution 2020-10-15 23:52:50 +07:00
Iaroslav Postovalov
657dbcb829
Add missing compiler option 2020-10-15 15:24:17 +07:00
Iaroslav Postovalov
2dab0ce40c
Add missing package installation 2020-10-15 14:06:01 +07:00
Iaroslav Postovalov
248deb1682
Update def file 2020-10-15 13:44:49 +07:00
Iaroslav Postovalov
de964af80d
Fix header selection issues, update Gradle 2020-10-15 13:15:11 +07:00
Iaroslav Postovalov
07ad527e0b
Remove sudo 2020-10-14 23:57:35 +07:00
Iaroslav Postovalov
0740d6034b
Remove broken command 2020-10-14 23:45:30 +07:00
Iaroslav Postovalov
3602bce133
Add Chrome installing action 2020-10-14 23:43:16 +07:00
Iaroslav Postovalov
3eb050d3d1
Merge branch 'dev' into gsl-experiment 2020-10-14 23:32:00 +07:00
Iaroslav Postovalov
5460d00f8f
Change Ubuntu version 2020-10-14 23:27:59 +07:00
Alexander Nozik
78fa877116
Update README.md
Fix #152
2020-10-14 11:25:03 +03:00
e44423192d Tools version update 2020-10-13 20:34:17 +03:00
Iaroslav Postovalov
ea0ecc0fba
Use postfix op. form 2020-10-13 22:18:44 +07:00
Iaroslav Postovalov
2723c376d9
Use KG DSL instead of raw scalar construction 2020-10-13 22:09:39 +07:00
Iaroslav Postovalov
381137724d
Rename KG module 2020-10-13 19:47:07 +07:00
Iaroslav Postovalov
fcfd79cb69
Merge remote-tracking branch 'origin/dev' into kotlingrad 2020-10-13 19:44:16 +07:00
Iaroslav Postovalov
245adab719
Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	kmath-ast/build.gradle.kts
2020-10-13 17:34:48 +07:00
Alexander Nozik
f76575bf99
Merge pull request #151 from mipt-npm/hotfix-better-parse-api
Hotfix of better-parse configuration (its classes are exposed as API but are not available to user)
2020-10-13 13:18:32 +03:00
Iaroslav Postovalov
627e18f6ec
Hotfix of better-parse configuration (its classes are exposed as API but are not available to user) 2020-10-13 16:59:21 +07:00
Iaroslav Postovalov
06c3ce5aaf
Simplify extensions.kt 2020-10-12 23:42:13 +07:00
Iaroslav Postovalov
4bf430b2c0
Rename converter functions, add symbol delegate provider for MstAlgebra 2020-10-12 23:17:54 +07:00
Iaroslav Postovalov
54069fd37e
Add example of new AST API 2020-10-12 22:42:34 +07:00
Iaroslav Postovalov
57bdee4936
Add test, update MstAlgebra a bit to return concrete types 2020-10-12 22:34:05 +07:00
Iaroslav Postovalov
31c71e0fad
Add comments on mapping of MST-to-SFun converting 2020-10-12 21:21:08 +07:00
Iaroslav Postovalov
5de9d69237
Add more fine-grained converters from MST to SVar and SConst 2020-10-12 21:06:15 +07:00
Iaroslav Postovalov
84f7535fdd
Add pow support 2020-10-12 20:36:05 +07:00
Iaroslav Postovalov
f0fbebd770
Add adapters of scalar functions to MST and vice versa 2020-10-12 20:26:03 +07:00
Iaroslav Postovalov
6f3deb6a24
Change cached directories, suppress warnings 2020-10-12 18:38:26 +07:00
Iaroslav Postovalov
6ab2ebb13f
Add sudo statement 2020-10-11 22:48:05 +07:00
Iaroslav Postovalov
3ae2be06e2
Remove kotlinx-io dependency, use DeferScope to dispose native memory 2020-10-11 21:24:10 +07:00
Iaroslav Postovalov
3c069398a2
Add /usr/local/ directory to headers 2020-10-11 14:28:59 +07:00
Iaroslav Postovalov
7e7da25a99
Drop headers 2020-10-11 03:44:43 +07:00
Iaroslav Postovalov
922d27fb62
Restructure codegen task 2020-10-11 03:37:04 +07:00
Iaroslav Postovalov
21dfc37727
Hide ignored targets and update generated file 2020-10-11 03:29:38 +07:00
Iaroslav Postovalov
a0066bb6dd
Fix compiler-embeddable version, add generated sources 2020-10-11 03:09:00 +07:00
Iaroslav Postovalov
60c7b08b42
Remove invalid modifier 2020-10-11 01:27:44 +07:00
Iaroslav Postovalov
8af6195265
Fix build-script error 2020-10-11 01:24:16 +07:00
Iaroslav Postovalov
956fe9b9e6
Track generated code 2020-10-11 01:21:10 +07:00
Iaroslav Postovalov
d46350e7b7
Rework codegen, use GSL vectors to store vectors, implement MatrixContext for Float, Double and Complex matrices with BLAS 2020-10-11 01:15:37 +07:00
Iaroslav Postovalov
69a107819b
Implement vector codegen 2020-10-05 17:46:41 +07:00
Iaroslav Postovalov
77dac58efb
Replace manual matrices classes building with codegen 2020-10-05 13:13:16 +07:00
Iaroslav Postovalov
0a02fd07b4
Replace manual matrices classes building with codegen 2020-10-05 13:13:06 +07:00
Iaroslav Postovalov
abcde808dc
Add first working test, use kotlinx-io fork, major rework of GSL API 2020-10-04 20:17:44 +07:00
Iaroslav Postovalov
eedfcf3932
Drop mingw support in GSL module 2020-10-04 15:53:24 +07:00
Iaroslav Postovalov
53f38e7492
Simplify compilerOpts 2020-10-04 15:39:35 +07:00
Iaroslav Postovalov
0565f0665a
Turn on daemon on Windows 2020-10-04 14:45:33 +07:00
Iaroslav Postovalov
881f2280fc
Try adding Windows support 2020-10-04 14:39:24 +07:00
Iaroslav Postovalov
90bdf00f8b
Sort classes, add vectors support 2020-10-04 14:35:51 +07:00
Iaroslav Postovalov
5724558760
Reconfigure native build 2020-10-04 14:10:53 +07:00
Iaroslav Postovalov
74d226cab7
Fix types 2020-10-04 13:54:14 +07:00
Iaroslav Postovalov
fd4253fc93
Provide bindings for each gsl_matrix except char, uchar, long_double because they have no clear KMath analogues 2020-10-04 13:54:00 +07:00
Iaroslav Postovalov
8f6163698c
Update tasks 2020-10-04 13:39:39 +07:00
Iaroslav Postovalov
fb4d74e90f
Add OSX target 2020-10-04 13:26:21 +07:00
Iaroslav Postovalov
159b5530fb
Rename Actions job 2020-10-04 13:22:00 +07:00
Iaroslav Postovalov
ef31cfcd65
Simplify build-script 2020-10-04 13:19:49 +07:00
Iaroslav Postovalov
54eb66ac70
Add explicit cinterop call 2020-10-04 13:10:20 +07:00
Iaroslav Postovalov
e2af1f095a
Change konan cache path 2020-10-04 13:01:52 +07:00
Iaroslav Postovalov
9e277a7de3
Minor changes related to benchmarks and EJML matrix, add GSL module, add wrapper for gsl_matrix, provide headers of gsl, configure cinterop at least for Linux and OSX, update GitHub Actions workflow 2020-10-04 12:45:35 +07:00
Iaroslav Postovalov
a12c645416
Move to kscience 2020-10-03 23:13:08 +07:00
Iaroslav Postovalov
26d81bddb5
Merge remote-tracking branch 'origin/dev' into mp-samplers
# Conflicts:
#	examples/src/main/kotlin/kscience/kmath/commons/prob/DistributionBenchmark.kt
2020-10-02 01:35:55 +07:00
Iaroslav Postovalov
79aa31c406
Merge remote-tracking branch 'origin/dev' into nd4j
# Conflicts:
#	CHANGELOG.md
2020-10-02 01:33:11 +07:00
Iaroslav Postovalov
0e6448cd3e
Merge pull request #136 from mipt-npm/ejml
Drop koma module, implement kmath-ejml module copying it, but for EJML SimpleMatrix
2020-10-02 01:30:39 +07:00
Iaroslav Postovalov
328193d30c
Merge remote-tracking branch 'origin/dev' into nd4j
# Conflicts:
#	examples/build.gradle.kts
#	kmath-core/src/commonMain/kotlin/kscience/kmath/structures/BufferedNDAlgebra.kt
2020-10-02 01:23:05 +07:00
Alexander Nozik
7ed38d151a
Merge pull request #144 from mipt-npm/even-more-docs
Even more documentation comments and minor refactorings
2020-10-01 20:44:29 +03:00
Iaroslav Postovalov
6ee0039985
Fix build problems 2020-10-01 21:49:57 +07:00
Iaroslav Postovalov
254ee9eced
Merge remote-tracking branch 'origin/dev' into even-more-docs 2020-10-01 20:59:34 +07:00
Iaroslav Postovalov
6e6e71543e
Update CHANGELOG.md 2020-10-01 20:32:07 +07:00
Iaroslav Postovalov
a465ab64f0
Remove accidentally left main method 2020-10-01 01:21:34 +07:00
Iaroslav Postovalov
7d60fa142d
Remove kotlin-reflect dependency (-2MiB to library size), optimize type copying, optimize reflection usages, optimize lexer 2020-09-30 21:28:39 +07:00
049ac89667 More informative toString for NDBuffer and Complex 2020-09-30 12:30:06 +03:00
Iaroslav Postovalov
c97f81b277
Merge remote-tracking branch 'origin/dev' into even-more-docs
# Conflicts:
#	build.gradle.kts
#	kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Complex.kt
#	kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/Memory.kt
#	kmath-memory/src/commonMain/kotlin/kscience/kmath/memory/MemorySpec.kt
#	kmath-memory/src/commonMain/kotlin/kscience/memory/Memory.kt
#	kmath-memory/src/commonMain/kotlin/kscience/memory/MemorySpec.kt
#	kmath-memory/src/commonMain/kotlin/scientifik/memory/Memory.kt
#	kmath-memory/src/commonMain/kotlin/scientifik/memory/MemorySpec.kt
#	kmath-memory/src/jsMain/kotlin/kscience/kmath/memory/DataViewMemory.kt
#	kmath-memory/src/jsMain/kotlin/kscience/memory/DataViewMemory.kt
#	kmath-memory/src/jsMain/kotlin/scientifik/memory/DataViewMemory.kt
#	kmath-memory/src/jvmMain/kotlin/kscience/kmath/memory/ByteBufferMemory.kt
#	kmath-memory/src/jvmMain/kotlin/kscience/memory/ByteBufferMemory.kt
#	kmath-memory/src/jvmMain/kotlin/scientifik/memory/ByteBufferMemory.kt
2020-09-28 03:10:24 +07:00
Iaroslav Postovalov
b665a3a2fc
Merge remote-tracking branch 'origin/dev' into mp-samplers 2020-09-28 03:02:48 +07:00
Iaroslav Postovalov
acbfb50eb2
Merge remote-tracking branch 'origin/dev' into nd4j
# Conflicts:
#	CHANGELOG.md
#	examples/build.gradle.kts
#	settings.gradle.kts
2020-09-28 03:01:59 +07:00
Iaroslav Postovalov
6dcb01ecf1
Merge remote-tracking branch 'origin/dev' into ejml
# Conflicts:
#	CHANGELOG.md
#	doc/features.md
#	examples/build.gradle.kts
2020-09-28 03:00:07 +07:00
431b574544 Update changelog 2020-09-27 20:09:46 +03:00
1f6834d418 Update readme 2020-09-27 20:05:31 +03:00
53ea704bae Finishing migration to 1.4.20-M1 2020-09-27 19:57:30 +03:00
Iaroslav Postovalov
b83293a057
Update example 2020-09-27 15:52:18 +07:00
0a71c7196d Fix caches on native 2020-09-27 11:43:03 +03:00
Iaroslav Postovalov
53ebec2e01
Perform 1.4 and explicit API migrations, refactor blocking chain, make tests work 2020-09-27 15:16:12 +07:00
7d315e37d1 native memory 2020-09-27 11:13:30 +03:00
Iaroslav Postovalov
e35a364aa8
Merge remote-tracking branch 'origin/dev' into mp-samplers
# Conflicts:
#	examples/src/main/kotlin/kscience/kmath/commons/prob/DistributionBenchmark.kt
#	examples/src/main/kotlin/kscience/kmath/commons/prob/DistributionDemo.kt
#	kmath-coroutines/src/commonMain/kotlin/kscience/kmath/chains/Chain.kt
#	kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/chains/BlockingIntChain.kt
#	kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/chains/BlockingRealChain.kt
#	kmath-prob/build.gradle.kts
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/Distribution.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/AhrensDieterExponentialSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/AhrensDieterMarsagliaTsangGammaSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/AliasMethodDiscreteSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/BoxMullerNormalizedGaussianSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/GaussianSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/InternalGamma.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/InternalUtils.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/KempSmallMeanPoissonSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/LargeMeanPoissonSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/MarsagliaNormalizedGaussianSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/NormalizedGaussianSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/PoissonSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/SmallMeanPoissonSampler.kt
#	kmath-prob/src/commonMain/kotlin/kscience/kmath/prob/samplers/ZigguratNormalizedGaussianSampler.kt
#	kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/FactorizedDistribution.kt
#	kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/RandomChain.kt
#	kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/RandomGenerator.kt
#	kmath-prob/src/jvmMain/kotlin/kscience/kmath/prob/distributions.kt
#	kmath-prob/src/jvmMain/kotlin/scientifik/kmath/prob/RandomSourceGenerator.kt
2020-09-27 14:54:20 +07:00
Iaroslav Postovalov
940fabfac2
Add more KDoc comments, fix grammar issue 2020-09-27 14:50:07 +07:00
e6104e13e8 Merge remote-tracking branch 'origin/dev' into dev 2020-09-26 13:59:51 +03:00
6b1eb4cfd7 Fix artifact template 2020-09-26 13:57:24 +03:00
b734136b82 Add images 2020-09-26 12:21:08 +03:00
4043df7f24 Documentation auto-generation update 2020-09-26 12:15:11 +03:00
Iaroslav Postovalov
8014b3df0b
Simplify asm.kt 2020-09-25 20:49:08 +07:00
28137e44e1 Readme auto-generation via plugin 2020-09-25 10:13:38 +03:00
Iaroslav
12b599fff2
Fix some packaging issues, add some KDoc comments, minor refactor 2020-09-23 21:15:54 +07:00
Iaroslav
86793d6fac
Fix package 2020-09-21 20:56:30 +07:00
Iaroslav
2ee5d0f325
Change package name, simplify exposed API types, update build snippet, minor refactor 2020-09-21 20:53:31 +07:00
1e50587da4 Update CHANGELOG.md 2020-09-21 15:53:11 +03:00
ceb03245f1 Merge remote-tracking branch 'origin/dev' into dev 2020-09-21 15:47:59 +03:00
bf569e10f9 Implementation for #139 2020-09-21 15:47:47 +03:00
Iaroslav
202bc2e904
Merge remote-tracking branch 'origin/dev' into nd4j
# Conflicts:
#	CHANGELOG.md
#	kmath-core/src/commonMain/kotlin/kscience/kmath/structures/BoxingNDField.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/structures/BufferedNDElement.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/structures/NDAlgebra.kt
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/BufferedNDAlgebra.kt
2020-09-21 19:41:55 +07:00
Iaroslav
02264f84e9
Add EJML module references in the readme and doc 2020-09-21 19:33:12 +07:00
Iaroslav
91cb95544c
Add tests 2020-09-21 19:29:56 +07:00
Iaroslav
964ac8a702
Fix weird guard check 2020-09-21 19:02:12 +07:00
Iaroslav
1c11d25306
Fix typo 2020-09-21 19:01:36 +07:00
Iaroslav
66d5df7a51
Add missing public visibilities 2020-09-21 19:01:24 +07:00
Iaroslav
2c21f56695
Add missing public visibilities and add @author markers 2020-09-21 19:00:55 +07:00
Iaroslav
5910c587e2
Add missing public visibilities 2020-09-21 18:59:32 +07:00
Iaroslav
267b6086a9
Change package and specify public visibilities, fix old plugin ID 2020-09-21 18:59:02 +07:00
Iaroslav
029f534cc2
Merge remote-tracking branch 'origin/dev' into ejml
# Conflicts:
#	CHANGELOG.md
#	README.md
#	examples/build.gradle.kts
#	examples/src/main/kotlin/scientifik/kmath/linear/LinearAlgebraBenchmark.kt
#	examples/src/main/kotlin/scientifik/kmath/linear/MultiplicationBenchmark.kt
#	kmath-core/src/commonMain/kotlin/kscience/kmath/linear/MatrixContext.kt
2020-09-21 18:55:47 +07:00
Iaroslav
68845b7a03
Update CHANGELOG.md 2020-09-21 18:49:02 +07:00
eb8b7196dc Update CHANGELOG.md 2020-09-20 22:41:33 +03:00
735eb937df Update CHANGELOG.md 2020-09-20 22:40:29 +03:00
28190f9800 scientifik -> kscience 2020-09-20 22:39:27 +03:00
da742d6c69 Fix things after merge 2020-09-20 22:25:50 +03:00
5032523bbf Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	build.gradle.kts
#	examples/src/main/kotlin/scientifik/kmath/linear/LinearAlgebraBenchmark.kt
#	kmath-ast/build.gradle.kts
#	kmath-ast/src/commonMain/kotlin/scientifik/kmath/ast/MstAlgebra.kt
#	kmath-commons/build.gradle.kts
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/misc/AutoDiff.kt
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/operations/Complex.kt
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/Buffers.kt
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/FlaggedBuffer.kt
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/IntBuffer.kt
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/RealBuffer.kt
#	kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/ShortBuffer.kt
#	kmath-for-real/build.gradle.kts
#	kmath-functions/build.gradle.kts
#	kmath-memory/build.gradle.kts
#	kmath-prob/build.gradle.kts
2020-09-20 21:59:10 +03:00
Alexander Nozik
51b7d4e73e
Merge pull request #140 from mipt-npm/autodiff-update
Upgrade AutoDiff support of trigonometric ops, also fix some problems with MstAlgebra
2020-09-20 18:21:36 +03:00
Iaroslav
6374d7a360
Update tests 2020-09-20 21:05:37 +07:00
Iaroslav
a03c650f65
Add tests and update changelog 2020-09-20 20:59:21 +07:00
Alexander Nozik
f46fa96590
Merge pull request #128 from mipt-npm/space-automation
Add .space.kts
2020-09-20 16:06:38 +03:00
Iaroslav
1b426d79b4
Fix sign in (d/dx)*cosh(x)=sinh(x) 2020-09-20 19:31:17 +07:00
Iaroslav
b89a05347c
Hotfix some problems with MstAlgebra.kt 2020-09-20 19:26:44 +07:00
Alexander Nozik
9740f4cd11
Merge pull request #138 from mipt-npm/authorship-markers
Add @author annotations, minor KDoc updates
2020-09-20 15:09:06 +03:00
Iaroslav
f815e97873
Update AutoDiff.kt to match new trigonometric functions 2020-09-20 19:06:01 +07:00
Iaroslav
4cebca51ef
Add @author annotations, minor KDoc updates 2020-09-20 19:01:27 +07:00
Iaroslav
4e5c7ab366
Make one-liner not a one-liner 2020-09-20 16:45:26 +07:00
Iaroslav
5a82df57b1
Merge remote-tracking branch 'origin/dev' into nd4j 2020-09-20 16:45:13 +07:00
Iaroslav
1e67ffb5ef
Make one-liner not a one-liner 2020-09-20 16:40:07 +07:00
Iaroslav
a4eb54228d
Merge remote-tracking branch 'origin/dev' into ejml 2020-09-20 16:39:23 +07:00
Iaroslav
40eadbdd04
Merge remote-tracking branch 'origin/master' into dev 2020-09-20 16:38:52 +07:00
Iaroslav
5eaeb82a0f
Make one-liners not one-liners, add newlines at EOFs, optimize imports and Kotlin extension configurations 2020-09-20 16:36:48 +07:00
9617b79647 Merge remote-tracking branch 'origin/kotlin14' into dev
# Conflicts:
#	build.gradle.kts
#	kmath-core/build.gradle.kts
#	kmath-memory/build.gradle.kts
#	settings.gradle.kts
2020-09-20 10:39:25 +03:00
Iaroslav Postovalov
d54e7c3e97
Update changelog 2020-09-15 17:48:43 +07:00
Iaroslav Postovalov
46d6918720
Merge remote-tracking branch 'origin/dev' into nd4j 2020-09-15 17:48:16 +07:00
Iaroslav Postovalov
148c0c8bc5
Update changelog 2020-09-15 17:47:49 +07:00
Iaroslav Postovalov
d55e4a3f84
Merge remote-tracking branch 'origin/dev' into ejml 2020-09-15 17:46:26 +07:00
Alexander Nozik
95d33c25d0
Merge pull request #137 from mipt-npm/dev
0.1.4
2020-09-14 22:49:29 +03:00
139525e2d4 Patch changelog 2020-09-14 22:48:02 +03:00
ec08bec42f 0.1.4 2020-09-14 22:34:45 +03:00
Iaroslav
09b82a8910
Override toString and contentEquals 2020-09-14 20:20:07 +07:00
Iaroslav
2f2315f6cd
Override toString 2020-09-14 20:18:43 +07:00
Iaroslav
91d692381c
Update comparison and fix type error 2020-09-14 20:15:11 +07:00
Iaroslav
a046f5c060
Update features 2020-09-14 20:02:53 +07:00
Iaroslav
1c495759cd
Replace ?: with set merging 2020-09-14 19:53:31 +07:00
72340705fe Build refactor 2020-09-12 14:59:12 +03:00
Iaroslav Postovalov
d088fdf77c
Move matrix solving and inverting to extensions because of consistency 2020-09-12 09:23:47 +07:00
Iaroslav Postovalov
8b171ac3a3
Update changelog 2020-09-12 09:22:26 +07:00
Iaroslav Postovalov
b5fa1ed6e8
Merge remote-tracking branch 'origin/dev' into mp-samplers
# Conflicts:
#	kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/chains/BlockingIntChain.kt
#	kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/chains/BlockingRealChain.kt
#	kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/chains/Chain.kt
#	kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/RandomChain.kt
2020-09-10 23:42:33 +07:00
Iaroslav Postovalov
2b15d69f11
Enable functions module and unmark Polynomial inline 2020-09-10 15:22:01 +07:00
Iaroslav Postovalov
edd3022aac
Add dynamic operations and add documentations 2020-09-10 05:53:44 +07:00
Iaroslav Postovalov
413d129ffc
Update changelog 2020-09-09 23:46:10 +07:00
Iaroslav Postovalov
d1184802bd
Drop koma module, implement kmath-ejml module copying it, but for EJML SimpleMatrix 2020-09-09 23:42:43 +07:00
Iaroslav Postovalov
367a59461d
Merge remote-tracking branch 'origin/dev' into nd4j 2020-09-09 22:36:49 +07:00
Iaroslav Postovalov
fc5ec8fed7
Drop koma support, add more explicit visibility modifiers 2020-09-09 22:31:54 +07:00
Iaroslav Postovalov
8ae9a071ef
Add more explicit public modifiers 2020-09-09 21:12:18 +07:00
Iaroslav Postovalov
96a7edc497
Merge remote-tracking branch 'origin/dev' into kotlin14 2020-09-09 11:30:10 +07:00
Iaroslav Postovalov
f567f73d19
Specify explicit API visbility, minor refactoring (error handling, etc.) 2020-09-09 11:28:54 +07:00
Iaroslav Postovalov
6b79e79d21
Update tools and Kotlin, specify public explicitly, minor contracts refactor 2020-09-09 09:55:26 +07:00
Iaroslav
5e4522bb06
Upgrade build tools plugin to dev version; file reformat; change dependencies' versions; specify visibility explicitly at certain places (core, especially), make some interfaces fun 2020-09-08 16:40:47 +07:00
Iaroslav Postovalov
e9c2b3f839
Merge branch 'dev' into nd4j 2020-08-27 17:03:56 +07:00
Iaroslav Postovalov
2bc62356d6
Fix compilation issues 2020-08-27 16:44:58 +07:00
Iaroslav
7157878485
Update changelog, document kmath-nd4j, refactor iterators, correct algebra mistakes, separate INDArrayStructureRing to Space, Ring and Algebra 2020-08-15 18:35:16 +07:00
Iaroslav
a6d47515eb
Merge remote-tracking branch 'origin/dev' into nd4j 2020-08-15 17:14:32 +07:00
Iaroslav
5cd58a399d
Add .space.kts 2020-08-11 16:18:13 +07:00
Iaroslav Postovalov
a2ee40fde7
Merge remote-tracking branch 'origin/dev' into nd4j 2020-08-11 15:23:40 +07:00
Iaroslav
566bcc20ae
Merge remote-tracking branch 'origin/dev' into nd4j 2020-08-09 23:49:25 +07:00
Iaroslav Postovalov
acca495720
Merge remote-tracking branch 'origin/dev' into nd4j
# Conflicts:
#	build.gradle.kts
2020-07-29 23:46:11 +07:00
Iaroslav Postovalov
019f60c721
Merge remote-tracking branch 'origin/dev' into mp-samplers 2020-07-26 13:39:35 +07:00
Iaroslav Postovalov
bc39a41c31
Merge remote-tracking branch 'origin/dev' into nd4j 2020-07-26 11:30:21 +07:00
Iaroslav
bf071bcdc1
Minor refactor 2020-06-29 22:30:08 +07:00
Iaroslav
f54e5679cf
Add README.md for kmath-nd4j 2020-06-29 22:06:13 +07:00
Iaroslav
d87dd3e717
Refactor array functions 2020-06-29 21:31:08 +07:00
Iaroslav
23b2ba9950
Optimize reverse division for FP INDArrayAlgebra 2020-06-29 03:49:29 +07:00
Iaroslav
8a8b314d0a
Optimize reverse division for FP INDArrayAlgebra 2020-06-29 03:48:11 +07:00
Iaroslav
d7949fdb01
Remove duplicated code 2020-06-29 03:39:37 +07:00
Iaroslav
783087982f
Rollback making Structures inline, implement Algebras for NDArrayStructure 2020-06-29 02:50:34 +07:00
Iaroslav
eb9d40fd2a
Convert INDArray NDStructures implementations to inline classes, add tests to verify equals and hashCode 2020-06-29 00:29:43 +07:00
Iaroslav
3b18000f1e
Make several NDStructures mutable 2020-06-29 00:14:01 +07:00
Iaroslav
f55b2c7a40
Merge branch 'dev' into nd4j 2020-06-28 19:10:07 +07:00
Iaroslav
05120929b0
Encapsulate classOfT property of AsmBuilder 2020-06-28 19:08:44 +07:00
Iaroslav
b41a9588bc
Rename file 2020-06-28 18:21:27 +07:00
Iaroslav
f49c3e4f4d
Add final modifier 2020-06-28 17:33:09 +07:00
Iaroslav
5cc56b6ab0
Remove Base suffix from class name 2020-06-28 17:30:09 +07:00
Iaroslav
fefa0db86e
Rename files 2020-06-28 17:29:00 +07:00
Iaroslav
6f4b22531e
Merge remote-tracking branch 'origin/dev' into nd4j 2020-06-28 17:27:07 +07:00
Iaroslav
e466f4bdf2
Add test for get 2020-06-27 21:21:16 +07:00
Iaroslav
b6bf741dbe
Replace lambdas with references 2020-06-27 21:19:19 +07:00
Iaroslav
bac6451443
Add tests 2020-06-27 21:17:40 +07:00
Iaroslav
4849f400ab
Merge remote-tracking branch 'origin/dev' into nd4j 2020-06-27 21:04:23 +07:00
Iaroslav
2239ef04bb
Merge remote-tracking branch 'origin/master' into nd4j 2020-06-27 21:03:49 +07:00
Iaroslav
551d4991fb
Merge remote-tracking branch 'origin/dev' into mp-samplers 2020-06-27 20:47:57 +07:00
Iaroslav
a378bfc203
Merge remote-tracking branch 'mipt-npm/dev' into nd4j 2020-06-16 14:50:46 +07:00
Iaroslav
6fc6d124ca
Merge remote-tracking branch 'mipt-npm/dev' into mp-samplers 2020-06-16 14:49:56 +07:00
Iaroslav
e7c5411b0c
Merge remote-tracking branch 'mipt-npm/dev' into nd4j 2020-06-14 01:46:10 +07:00
Iaroslav
fae33ed062
Merge remote-tracking branch 'mipt-npm/dev' into mp-samplers 2020-06-14 01:41:36 +07:00
Iaroslav
3e18b21244
Merge remote-tracking branch 'mipt-npm/dev' into nd4j 2020-06-12 17:42:56 +07:00
Iaroslav
8b9c03e616
Merge remote-tracking branch 'mipt-npm/dev' into mp-samplers 2020-06-12 17:40:37 +07:00
Iaroslav
a03c82f758
Simplify BlockingIntChain and BlockingRealChain; add blocking extension function for RandomChain; copy general documentation to samplers created with Apache Commons RNG 2020-06-12 02:49:06 +07:00
Commander Tvis
46f6d57fd9
Add 2 more samplers, replace SimpleChain with generator.chain 2020-06-12 01:13:15 +07:00
Commander Tvis
d0cc75098b
Rework with specialized NDStructure implementations 2020-06-11 14:36:19 +07:00
Commander Tvis
9a4dd31507
Move narrowToIntArray to new file 2020-06-11 14:17:46 +07:00
Commander Tvis
3df9892de5
Implement the ND4J module for scalars 2020-06-11 14:10:39 +07:00
Commander Tvis
f364060acf
Add project stub 2020-06-11 12:16:22 +07:00
Commander Tvis
8cdc596549
Merge remote-tracking branch 'mipt-npm/dev' into dev 2020-06-11 10:39:05 +07:00
Iaroslav
822f960e9c
Fix broken demos, add newlines at the end of files 2020-06-08 18:19:18 +07:00
Iaroslav
246feacd72
Delete unused RandomGenerator-to-URP adapter 2020-06-08 18:05:56 +07:00
Iaroslav
46649a1ddf
Delete unused InternalUtils functions 2020-06-08 18:02:15 +07:00
Iaroslav
d4226b7e7d
Reformat 2020-06-08 17:38:48 +07:00
Iaroslav
5ff76209aa
Specify type explicitly 2020-06-08 17:37:35 +07:00
Iaroslav
2b24bd979e
Add Apache Javadocs references 2020-06-08 17:36:14 +07:00
Iaroslav
e7b1203c2d
Move init blocks checks to factory method of and make all the samplers' constructor private 2020-06-08 17:29:57 +07:00
Iaroslav
28062cb096
Minimal refactor of existing random API, move samplers implementations to samplers package, implement Sampler<T> by all the Samplers 2020-06-08 17:16:57 +07:00
Iaroslav
bc59f8b287
Merger kmath-prob and kmath-commons-rng-part 2020-06-08 15:13:54 +07:00
Iaroslav
2de9548c23
Implement commons-rng particle in pure Kotlin 2020-06-07 22:12:04 +07:00
824 changed files with 69923 additions and 13384 deletions

3
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,3 @@
@altavir
/kmath-trajectory @ESchouten

24
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Gradle build
on:
push:
branches: [ dev, master ]
pull_request:
jobs:
build:
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3.5.1
with:
java-version: '11'
distribution: 'liberica'
cache: 'gradle'
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.0.4
- name: Gradle Build
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: test jvmTest

View File

@ -1,17 +0,0 @@
name: Gradle build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Gradle
run: ./gradlew build

31
.github/workflows/pages.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Dokka publication
on:
workflow_dispatch:
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- uses: actions/checkout@v3.0.0
- uses: actions/setup-java@v3.0.0
with:
java-version: 11
distribution: liberica
- name: Cache konan
uses: actions/cache@v3.0.1
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: gradle/gradle-build-action@v2.4.2
with:
arguments: dokkaHtmlMultiModule --no-parallel
- uses: JamesIves/github-pages-deploy-action@v4.3.0
with:
branch: gh-pages
folder: build/dokka/htmlMultiModule

50
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Gradle publish
on:
workflow_dispatch:
release:
types: [ created ]
jobs:
publish:
environment:
name: publish
strategy:
matrix:
os: [ macOS-latest, windows-latest ]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3.0.0
- uses: actions/setup-java@v3.10.0
with:
java-version: 11
distribution: liberica
- name: Cache konan
uses: actions/cache@v3.0.1
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Publish Windows Artifacts
if: matrix.os == 'windows-latest'
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: |
publishAllPublicationsToSpaceRepository
-Ppublishing.targets=all
-Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
-Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}
- name: Publish Mac Artifacts
if: matrix.os == 'macOS-latest'
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: |
publishMacosX64PublicationToSpaceRepository
publishMacosArm64PublicationToSpaceRepository
publishIosX64PublicationToSpaceRepository
publishIosArm64PublicationToSpaceRepository
publishIosSimulatorArm64PublicationToSpaceRepository
-Ppublishing.targets=all
-Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
-Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}

14
.gitignore vendored
View File

@ -1,7 +1,12 @@
.gradle
build/
out/
.idea/
.vscode/
.fleet/
.kotlin/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
@ -9,4 +14,11 @@ out/
# Cache of project
.gradletasknamecache
gradle.properties
# Generated by javac -h and runtime
*.class
*.log
!/.idea/copyright/
!/.idea/scopes/
/gradle/yarn.lock

View File

@ -0,0 +1,7 @@
<component name="CopyrightManager">
<copyright>
<option name="allowReplaceRegexp" value="Copyright \d{4}-\d{4} KMath" />
<option name="notice" value="Copyright 2018-&amp;#36;today.year KMath contributors.&#10;Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file." />
<option name="myName" value="kmath" />
</copyright>
</component>

View File

@ -0,0 +1,21 @@
<component name="CopyrightManager">
<settings>
<module2copyright>
<element module="Apply copyright" copyright="kmath" />
</module2copyright>
<LanguageOptions name="Groovy">
<option name="fileTypeOverride" value="1" />
</LanguageOptions>
<LanguageOptions name="HTML">
<option name="fileTypeOverride" value="1" />
<option name="prefixLines" value="false" />
</LanguageOptions>
<LanguageOptions name="Properties">
<option name="fileTypeOverride" value="1" />
</LanguageOptions>
<LanguageOptions name="XML">
<option name="fileTypeOverride" value="1" />
<option name="prefixLines" value="false" />
</LanguageOptions>
</settings>
</component>

View File

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[group:kotlin-ultimate]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
</component>

48
.space.kts Normal file
View File

@ -0,0 +1,48 @@
import kotlin.io.path.readText
val projectName = "kmath"
job("Build") {
//Perform only jvm tests
gradlew("spc.registry.jetbrains.space/p/sci/containers/kotlin-ci:1.0.3", "test", "jvmTest")
}
job("Publish") {
startOn {
gitPush { enabled = false }
}
container("spc.registry.jetbrains.space/p/sci/containers/kotlin-ci:1.0.3") {
env["SPACE_USER"] = "{{ project:space_user }}"
env["SPACE_TOKEN"] = "{{ project:space_token }}"
kotlinScript { api ->
val spaceUser = System.getenv("SPACE_USER")
val spaceToken = System.getenv("SPACE_TOKEN")
// write the version to the build directory
api.gradlew("version")
//read the version from build file
val version = java.nio.file.Path.of("build/project-version.txt").readText()
val revisionSuffix = if (version.endsWith("SNAPSHOT")) {
"-" + api.gitRevision().take(7)
} else {
""
}
api.space().projects.automation.deployments.start(
project = api.projectIdentifier(),
targetIdentifier = TargetIdentifier.Key(projectName),
version = version + revisionSuffix,
// automatically update deployment status based on the status of a job
syncWithAutomationJob = true
)
api.gradlew(
"publishAllPublicationsToSpaceRepository",
"-Ppublishing.space.user=\"$spaceUser\"",
"-Ppublishing.space.token=\"$spaceToken\"",
)
}
}
}

View File

@ -1,17 +1,248 @@
# KMath
## [Unreleased]
## Unreleased
### Added
- Metropolis-Hastings sampler
### Changed
### Deprecated
### Removed
### Fixed
### Security
## 0.4.0-dev-3 - 2024-02-18
### Added
- Reification. Explicit `SafeType` for algebras.
- Integer division algebras.
- Float32 geometries.
- New Attributes-kt module that could be used as stand-alone. It declares. type-safe attributes containers.
- Explicit `mutableStructureND` builders for mutable structures.
- `Buffer.asList()` zero-copy transformation.
- Wasm support.
- Parallel implementation of `LinearSpace` for Float64
- Parallel buffer factories
### Changed
- Buffer copy removed from API (added as an extension).
- Default naming for algebra and buffers now uses IntXX/FloatXX notation instead of Java types.
- Remove unnecessary inlines in basic algebras.
- QuaternionField -> QuaternionAlgebra and does not implement `Field` anymore since it is non-commutative
- kmath-geometry is split into `euclidean2d` and `euclidean3d`
- Features replaced with Attributes.
- Transposed refactored.
- Kmath-memory is moved on top of core.
### Deprecated
- ND4J engine
### Removed
- `asPolynomial` function due to scope pollution
- Codegend for ejml (450 lines of codegen for 1000 lines of code is too much)
### Fixed
- Median statistics
- Complex power of negative real numbers
- Add proper mutability for MutableBufferND rows and columns
- Generic Float32 and Float64 vectors are used in geometry algebras.
## 0.3.1 - 2023-04-09
### Added
- Wasm support for `memory`, `core`, `complex` and `functions` modules.
- Generic builders for `BufferND` and `MutableBufferND`
- `NamedMatrix` - matrix with symbol-based indexing
- `Expression` with default arguments
- Type-aliases for numbers like `Float64`
- Autodiff for generic algebra elements in core!
- Algebra now has an obligatory `bufferFactory` (#477).
### Changed
- Removed marker `Vector` type for geometry
- Geometry uses type-safe angles
- Tensor operations switched to prefix notation
- Row-wise and column-wise ND shapes in the core
- Shape is read-only
- Major refactor of tensors (only minor API changes)
- Kotlin 1.8.20
- `LazyStructure` `deffered` -> `async` to comply with coroutines code style
- Default `dot` operation in tensor algebra no longer support broadcasting. Instead `matmul` operation is added
to `DoubleTensorAlgebra`.
- Multik went MPP
### Removed
- Trajectory moved to https://github.com/SciProgCentre/maps-kt
- Polynomials moved to https://github.com/SciProgCentre/kmath-polynomial
## 0.3.0
### Added
- `ScaleOperations` interface
- `Field` extends `ScaleOperations`
- Basic integration API
- Basic MPP distributions and samplers
- `bindSymbolOrNull`
- Blocking chains and Statistics
- Multiplatform integration
- Integration for any Field element
- Extended operations for ND4J fields
- Jupyter Notebook integration module (kmath-jupyter)
- `@PerformancePitfall` annotation to mark possibly slow API
- Unified architecture for Integration and Optimization using features.
- `BigInt` operation performance improvement and fixes by @zhelenskiy (#328)
- Integration between `MST` and Symja `IExpr`
- Complex power
- Separate methods for UInt, Int and Number powers. NaN safety.
- Tensorflow prototype
- `ValueAndErrorField`
- MST compilation to WASM: #286
- Jafama integration: #176
- `contentEquals` with tolerance: #364
- Compilation to TeX for MST: #254
### Changed
- Annotations moved to `space.kscience.kmath`
- Exponential operations merged with hyperbolic functions
- Space is replaced by Group. Space is reserved for vector spaces.
- VectorSpace is now a vector space
- Buffer factories for primitives moved to MutableBuffer.Companion
- Rename `NDStructure` and `NDAlgebra` to `StructureND` and `AlgebraND` respectively
- `Real` -> `Double`
- DataSets are moved from functions to core
- Redesign advanced Chain API
- Redesign `MST`. Remove `MstExpression`.
- Move `MST` to core
- Separated benchmarks and examples
- Rewrite `kmath-ejml` without `ejml-simple` artifact, support sparse matrices
- Promote stability of kmath-ast and kmath-kotlingrad to EXPERIMENTAL.
- ColumnarData returns nullable column
- `MST` is made sealed interface
- Replace `MST.Symbolic` by `Symbol`, `Symbol` now implements MST
- Remove Any restriction on polynomials
- Add `out` variance to type parameters of `StructureND` and its implementations where possible
- Rename `DifferentiableMstExpression` to `KotlingradExpression`
- `FeatureSet` now accepts only `Feature`. It is possible to override keys and use interfaces.
- Use `Symbol` factory function instead of `StringSymbol`
- New discoverability pattern: `<Type>.algebra.<nd/etc>`
- Adjusted commons-math API for linear solvers to match conventions.
- Buffer algebra does not require size anymore
- Operations -> Ops
- Default Buffer and ND algebras are now Ops and lack neutral elements (0, 1) as well as algebra-level shapes.
- Tensor algebra takes read-only structures as input and inherits AlgebraND
- `UnivariateDistribution` renamed to `Distribution1D`
- Rework of histograms.
- `UnivariateFunction` -> `Function1D`, `MultivariateFunction` -> `FunctionND`
### Deprecated
- Specialized `DoubleBufferAlgebra`
### Removed
- Nearest in Domain. To be implemented in geometry package.
- Number multiplication and division in main Algebra chain
- `contentEquals` from Buffer. It moved to the companion.
- MSTExpression
- Expression algebra builders
- Complex and Quaternion no longer are elements.
- Second generic from DifferentiableExpression
- Algebra elements are completely removed. Use algebra contexts instead.
### Fixed
- Ring inherits RingOperations, not GroupOperations
- Univariate histogram filling
## 0.2.0
### Added
- `fun` annotation for SAM interfaces in library
- Explicit `public` visibility for all public APIs
- Better trigonometric and hyperbolic functions for `AutoDiffField` (https://github.com/mipt-npm/kmath/pull/140)
- Automatic README generation for features (#139)
- Native support for `memory`, `core` and `dimensions`
- `kmath-ejml` to supply EJML SimpleMatrix wrapper (https://github.com/mipt-npm/kmath/pull/136)
- A separate `Symbol` entity, which is used for global unbound symbol.
- A `Symbol` indexing scope.
- Basic optimization API for Commons-math.
- Chi squared optimization for array-like data in CM
- `Fitting` utility object in prob/stat
- ND4J support module submitting `NDStructure` and `NDAlgebra` over `INDArray`
- Coroutine-deterministic Monte-Carlo scope with a random number generator
- Some minor utilities to `kmath-for-real`
- Generic operation result parameter to `MatrixContext`
- New `MatrixFeature` interfaces for matrix decompositions
- Basic Quaternion vector support in `kmath-complex`.
### Changed
- Package changed from `scientifik` to `space.kscience`
- Gradle version: 6.6 -> 6.8.2
- Minor exceptions refactor (throwing `IllegalArgumentException` by argument checks instead of `IllegalStateException`)
- `Polynomial` secondary constructor made function
- Kotlin version: 1.3.72 -> 1.4.30
- `kmath-ast` doesn't depend on heavy `kotlin-reflect` library
- Full autodiff refactoring based on `Symbol`
- `kmath-prob` renamed to `kmath-stat`
- Grid generators moved to `kmath-for-real`
- Use `Point<Float64>` instead of specialized type in `kmath-for-real`
- Optimized dot product for buffer matrices moved to `kmath-for-real`
- EjmlMatrix context is an object
- Matrix LUP `inverse` renamed to `inverseWithLup`
- `NumericAlgebra` moved outside of regular algebra chain (`Ring` no longer implements it).
- Features moved to NDStructure and became transparent.
- Capitalization of LUP in many names changed to Lup.
- Refactored `NDStructure` algebra to be more simple, preferring under-the-hood conversion to explicit NDStructure types
- Refactor histograms. They are marked as prototype
- `Complex` and related features moved to a separate module `kmath-complex`
- Refactor AlgebraElement
- `symbol` method in `Algebra` renamed to `bindSymbol` to avoid ambiguity
- Add `out` projection to `Buffer` generic
### Removed
- `kmath-koma` module because it doesn't support Kotlin 1.4.
- Support of `legacy` JS backend (we will support only IR)
- `toGrid` method.
- Public visibility of `BufferAccessor2D`
- `Real` class
- StructureND identity and equals
### Fixed
- `symbol` method in `MstExtendedField` (https://github.com/mipt-npm/kmath/pull/140)
## 0.1.4
### Added
- Functional Expressions API
- Mathematical Syntax Tree, its interpreter and API
- String to MST parser (https://github.com/mipt-npm/kmath/pull/120)
- MST to JVM bytecode translator (https://github.com/mipt-npm/kmath/pull/94)
- FloatBuffer (specialized MutableBuffer over FloatArray)
- FlaggedBuffer to associate primitive numbers buffer with flags (to mark values infinite or missing, etc.)
- Specialized builder functions for all primitive buffers like `IntBuffer(25) { it + 1 }` (https://github.com/mipt-npm/kmath/pull/125)
- Specialized builder functions for all primitive buffers
like `IntBuffer(25) { it + 1 }` (https://github.com/mipt-npm/kmath/pull/125)
- Interface `NumericAlgebra` where `number` operation is available to convert numbers to algebraic elements
- Inverse trigonometric functions support in ExtendedField (`asin`, `acos`, `atan`) (https://github.com/mipt-npm/kmath/pull/114)
- Inverse trigonometric functions support in
ExtendedField (`asin`, `acos`, `atan`) (https://github.com/mipt-npm/kmath/pull/114)
- New space extensions: `average` and `averageWith`
- Local coding conventions
- Geometric Domains API in `kmath-core`
@ -20,10 +251,12 @@
- Norm support for `Complex`
### Changed
- `readAsMemory` now has `throws IOException` in JVM signature.
- Several functions taking functional types were made `inline`.
- Several functions taking functional types now have `callsInPlace` contracts.
- BigInteger and BigDecimal algebra: JBigDecimalField has companion object with default math context; minor optimizations
- BigInteger and BigDecimal algebra: JBigDecimalField has companion object with default math context; minor
optimizations
- `power(T, Int)` extension function has preconditions and supports `Field<T>`
- Memory objects have more preconditions (overflow checking)
- `tg` function is renamed to `tan` (https://github.com/mipt-npm/kmath/pull/114)
@ -31,6 +264,7 @@
- Moved probability distributions to commons-rng and to `kmath-prob`
### Fixed
- Missing copy method in Memory implementation on JS (https://github.com/mipt-npm/kmath/pull/106)
- D3.dim value in `kmath-dimensions`
- Multiplication in integer rings in `kmath-core` (https://github.com/mipt-npm/kmath/pull/101)

315
README.md
View File

@ -1,109 +1,300 @@
[![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![DOI](https://zenodo.org/badge/129486382.svg)](https://zenodo.org/badge/latestdoi/129486382)
![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg)
Bintray: [ ![Download](https://api.bintray.com/packages/mipt-npm/scientifik/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/scientifik/kmath-core/_latestVersion)
Bintray-dev: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-core/_latestVersion)
![Gradle build](https://github.com/SciProgCentre/kmath/workflows/Gradle%20build/badge.svg)
[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22)
[![Space](https://img.shields.io/badge/dynamic/xml?color=orange&label=Space&query=//metadata/versioning/latest&url=https%3A%2F%2Fmaven.pkg.jetbrains.space%2Fmipt-npm%2Fp%2Fsci%2Fmaven%2Fspace%2Fkscience%2Fkmath-core%2Fmaven-metadata.xml)](https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven/space/kscience/)
# KMath
Could be pronounced as `key-math`.
The Kotlin MATHematics library is intended as a Kotlin-based analog to Python's `numpy` library. In contrast to `numpy` and `scipy` it is modular and has a lightweight core.
## Publications
Could be pronounced as `key-math`. The **K**otlin **Math**ematics library was initially intended as a Kotlin-based
analog to Python's NumPy library. Later we found that kotlin is much more flexible language and allows superior
architecture designs. In contrast to `numpy` and `scipy` it is modular and has a lightweight core. The `numpy`-like
experience could be achieved with [kmath-for-real](/kmath-for-real) extension module.
[Documentation site](https://SciProgCentre.github.io/kmath/)
## Publications and talks
* [A conceptual article about context-oriented design](https://proandroiddev.com/an-introduction-context-oriented-programming-in-kotlin-2e79d316b0a2)
* [Another article about context-oriented design](https://proandroiddev.com/diving-deeper-into-context-oriented-programming-in-kotlin-3ecb4ec38814)
* [ACAT 2019 conference paper](https://aip.scitation.org/doi/abs/10.1063/1.5130103)
* [A talk at KotlinConf 2019 about using kotlin for science](https://youtu.be/LI_5TZ7tnOE?si=4LknX41gl_YeUbIe)
* [A talk on architecture at Joker-2021 (in Russian)](https://youtu.be/1bZ2doHiRRM?si=9w953ro9yu98X_KJ)
* [The same talk in English](https://youtu.be/yP5DIc2fVwQ?si=louZzQ1dcXV6gP10)
* [A seminar on tensor API](https://youtu.be/0H99wUs0xTM?si=6c__04jrByFQtVpo)
# Goal
* Provide a flexible and powerful API to work with mathematics abstractions in Kotlin-multiplatform (JVM and JS for now and Native in future).
* Provide a flexible and powerful API to work with mathematics abstractions in Kotlin-multiplatform (JVM, JS, Native and
Wasm).
* Provide basic multiplatform implementations for those abstractions (without significant performance optimization).
* Provide bindings and wrappers with those abstractions for popular optimized platform libraries.
## Non-goals
* Be like Numpy. It was the idea at the beginning, but we decided that we can do better in terms of API.
* Provide best performance out of the box. We have specialized libraries for that. Need only API wrappers for them.
* Be like NumPy. It was the idea at the beginning, but we decided that we can do better in API.
* Provide the best performance out of the box. We have specialized libraries for that. Need only API wrappers for them.
* Cover all cases as immediately and in one bundle. We will modularize everything and add new features gradually.
* Provide specialized behavior in the core. API is made generic on purpose, so one needs to specialize for types, like for `Double` in the core. For that we will have specialization modules like `for-real`, which will give better experience for those, who want to work with specific types.
* Provide specialized behavior in the core. API is made generic on purpose, so one needs to specialize for types, like
for `Double` in the core. For that we will have specialization modules like `kmath-for-real`, which will give better
experience for those, who want to work with specific types.
## Features
## Features and stability
Actual feature list is [here](doc/features.md)
KMath is a modular library. Different modules provide different features with different API stability guarantees. All
core modules are released with the same version, but with different API change policy. The features are described in
module definitions below. The module stability could have the following levels:
* **Algebra**
* Algebraic structures like rings, spaces and field (**TODO** add example to wiki)
* Basic linear algebra operations (sums, products, etc.), backed by the `Space` API.
* Complex numbers backed by the `Field` API (meaning that they will be usable in any structure like vectors and N-dimensional arrays).
* Advanced linear algebra operations like matrix inversion and LU decomposition.
* **PROTOTYPE**. On this level there are no compatibility guarantees. All methods and classes form those modules could
break any moment. You can still use it, but be sure to fix the specific version.
* **EXPERIMENTAL**. The general API is decided, but some changes could be made. Volatile API is marked
with `@UnstableKMathAPI` or other stability warning annotations.
* **DEVELOPMENT**. API breaking generally follows semantic versioning ideology. There could be changes in minor
versions, but not in patch versions. API is protected
with [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) tool.
* **STABLE**. The API stabilized. Breaking changes are allowed only in major releases.
* **Array-like structures** Full support of many-dimensional array-like structures
including mixed arithmetic operations and function operations over arrays and numbers (with the added benefit of static type checking).
## Modules
* **Expressions** By writing a single mathematical expression
once, users will be able to apply different types of objects to the expression by providing a context. Expressions
can be used for a wide variety of purposes from high performance calculations to code generation.
* **Histograms** Fast multi-dimensional histograms.
### [attributes-kt](attributes-kt)
> An API and basic implementation for arranging objects in a continuous memory block.
>
> **Maturity**: DEVELOPMENT
* **Streaming** Streaming operations on mathematical objects and objects buffers.
### [benchmarks](benchmarks)
>
> **Maturity**: EXPERIMENTAL
* **Type-safe dimensions** Type-safe dimensions for matrix operations.
### [examples](examples)
>
> **Maturity**: EXPERIMENTAL
* **Commons-math wrapper** It is planned to gradually wrap most parts of [Apache commons-math](http://commons.apache.org/proper/commons-math/)
library in Kotlin code and maybe rewrite some parts to better suit the Kotlin programming paradigm, however there is no fixed roadmap for that. Feel free
to submit a feature request if you want something to be done first.
* **Koma wrapper** [Koma](https://github.com/kyonifer/koma) is a well established numerics library in Kotlin, specifically linear algebra.
The plan is to have wrappers for koma implementations for compatibility with kmath API.
### [kmath-ast](kmath-ast)
>
> **Maturity**: EXPERIMENTAL
>
> **Features:**
> - [expression-language](kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/parser.kt) : Expression language and its parser
> - [mst-jvm-codegen](kmath-ast/src/jvmMain/kotlin/space/kscience/kmath/asm/asm.kt) : Dynamic MST to JVM bytecode compiler
> - [mst-js-codegen](kmath-ast/src/jsMain/kotlin/space/kscience/kmath/estree/estree.kt) : Dynamic MST to JS compiler
> - [rendering](kmath-ast/src/commonMain/kotlin/space/kscience/kmath/ast/rendering/MathRenderer.kt) : Extendable MST rendering
## Planned features
* **Messaging** A mathematical notation to support multi-language and multi-node communication for mathematical tasks.
### [kmath-commons](kmath-commons)
> Commons math binding for kmath
>
> **Maturity**: EXPERIMENTAL
* **Array statistics**
### [kmath-complex](kmath-complex)
> Complex numbers and quaternions.
>
> **Maturity**: PROTOTYPE
>
> **Features:**
> - [complex](kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Complex.kt) : Complex numbers operations
> - [quaternion](kmath-complex/src/commonMain/kotlin/space/kscience/kmath/complex/Quaternion.kt) : Quaternions and their composition
* **Integration** Univariate and multivariate integration framework.
* **Probability and distributions**
### [kmath-core](kmath-core)
> Core classes, algebra definitions, basic linear algebra
>
> **Maturity**: DEVELOPMENT
>
> **Features:**
> - [algebras](kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Algebraic structures like rings, spaces and fields.
> - [nd](kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/StructureND.kt) : Many-dimensional structures and operations on them.
> - [linear](kmath-core/src/commonMain/kotlin/space/kscience/kmath/operations/Algebra.kt) : Basic linear algebra operations (sums, products, etc.), backed by the `Space` API. Advanced linear algebra operations like matrix inversion and LU decomposition.
> - [buffers](kmath-core/src/commonMain/kotlin/space/kscience/kmath/structures/Buffers.kt) : One-dimensional structure
> - [expressions](kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions) : By writing a single mathematical expression once, users will be able to apply different types of
objects to the expression by providing a context. Expressions can be used for a wide variety of purposes from high
performance calculations to code generation.
> - [domains](kmath-core/src/commonMain/kotlin/space/kscience/kmath/domains) : Domains
> - [autodiff](kmath-core/src/commonMain/kotlin/space/kscience/kmath/expressions/SimpleAutoDiff.kt) : Automatic differentiation
> - [Parallel linear algebra](kmath-core/#) : Parallel implementation for `LinearAlgebra`
### [kmath-coroutines](kmath-coroutines)
>
> **Maturity**: EXPERIMENTAL
### [kmath-dimensions](kmath-dimensions)
> A proof of concept module for adding type-safe dimensions to structures
>
> **Maturity**: PROTOTYPE
### [kmath-ejml](kmath-ejml)
>
> **Maturity**: PROTOTYPE
>
> **Features:**
> - [ejml-vector](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlVector.kt) : Point implementations.
> - [ejml-matrix](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlMatrix.kt) : Matrix implementation.
> - [ejml-linear-space](kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/EjmlLinearSpace.kt) : LinearSpace implementations.
### [kmath-for-real](kmath-for-real)
> Extension module that should be used to achieve numpy-like behavior.
All operations are specialized to work with `Double` numbers without declaring algebraic contexts.
One can still use generic algebras though.
>
> **Maturity**: EXPERIMENTAL
>
> **Features:**
> - [DoubleVector](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/DoubleVector.kt) : Numpy-like operations for Buffers/Points
> - [DoubleMatrix](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/real/DoubleMatrix.kt) : Numpy-like operations for 2d real structures
> - [grids](kmath-for-real/src/commonMain/kotlin/space/kscience/kmath/structures/grids.kt) : Uniform grid generators
### [kmath-functions](kmath-functions)
> Functions, integration and interpolation
>
> **Maturity**: EXPERIMENTAL
>
> **Features:**
> - [piecewise](kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Piecewise.kt) : Piecewise functions.
> - [polynomials](kmath-functions/src/commonMain/kotlin/space/kscience/kmath/functions/Polynomial.kt) : Polynomial functions.
> - [linear interpolation](kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/LinearInterpolator.kt) : Linear XY interpolator.
> - [spline interpolation](kmath-functions/src/commonMain/kotlin/space/kscience/kmath/interpolation/SplineInterpolator.kt) : Cubic spline XY interpolator.
> - [integration](kmath-functions/#) : Univariate and multivariate quadratures
### [kmath-geometry](kmath-geometry)
>
> **Maturity**: PROTOTYPE
### [kmath-histograms](kmath-histograms)
>
> **Maturity**: PROTOTYPE
### [kmath-jafama](kmath-jafama)
> Jafama integration module
>
> **Maturity**: DEPRECATED
>
> **Features:**
> - [jafama-double](kmath-jafama/src/main/kotlin/space/kscience/kmath/jafama/) : Double ExtendedField implementations based on Jafama
### [kmath-jupyter](kmath-jupyter)
>
> **Maturity**: PROTOTYPE
### [kmath-kotlingrad](kmath-kotlingrad)
> Kotlin∇ integration module
>
> **Maturity**: EXPERIMENTAL
>
> **Features:**
> - [differentiable-mst-expression](kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/KotlingradExpression.kt) : MST based DifferentiableExpression.
> - [scalars-adapters](kmath-kotlingrad/src/main/kotlin/space/kscience/kmath/kotlingrad/scalarsAdapters.kt) : Conversions between Kotlin∇'s SFun and MST
### [kmath-memory](kmath-memory)
> An API and basic implementation for arranging objects in a continuous memory block.
>
> **Maturity**: DEVELOPMENT
### [kmath-multik](kmath-multik)
> JetBrains Multik connector
>
> **Maturity**: PROTOTYPE
### [kmath-nd4j](kmath-nd4j)
> ND4J NDStructure implementation and according NDAlgebra classes
>
> **Maturity**: DEPRECATED
>
> **Features:**
> - [nd4jarraystructure](kmath-nd4j/#) : NDStructure wrapper for INDArray
> - [nd4jarrayrings](kmath-nd4j/#) : Rings over Nd4jArrayStructure of Int and Long
> - [nd4jarrayfields](kmath-nd4j/#) : Fields over Nd4jArrayStructure of Float and Double
### [kmath-optimization](kmath-optimization)
>
> **Maturity**: EXPERIMENTAL
### [kmath-stat](kmath-stat)
>
> **Maturity**: EXPERIMENTAL
### [kmath-symja](kmath-symja)
> Symja integration module
>
> **Maturity**: PROTOTYPE
### [kmath-tensorflow](kmath-tensorflow)
> Google tensorflow connector
>
> **Maturity**: PROTOTYPE
### [kmath-tensors](kmath-tensors)
>
> **Maturity**: PROTOTYPE
>
> **Features:**
> - [tensor algebra](kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/api/TensorAlgebra.kt) : Basic linear algebra operations on tensors (plus, dot, etc.)
> - [tensor algebra with broadcasting](kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/core/BroadcastDoubleTensorAlgebra.kt) : Basic linear algebra operations implemented with broadcasting.
> - [linear algebra operations](kmath-tensors/src/commonMain/kotlin/space/kscience/kmath/tensors/api/LinearOpsTensorAlgebra.kt) : Advanced linear algebra operations like LU decomposition, SVD, etc.
### [kmath-viktor](kmath-viktor)
> Binding for https://github.com/JetBrains-Research/viktor
>
> **Maturity**: DEPRECATED
### [test-utils](test-utils)
>
> **Maturity**: EXPERIMENTAL
* **Fitting** Non-linear curve fitting facilities
## Multi-platform support
KMath is developed as a multi-platform library, which means that most of interfaces are declared in the [common module](kmath-core/src/commonMain). Implementation is also done in the common module wherever possible. In some cases, features are delegated to platform-specific implementations even if they could be done in the common module for performance reasons. Currently, the JVM is the main focus of development, however Kotlin/Native and Kotlin/JS contributions are also welcome.
KMath is developed as a multi-platform library, which means that most of the interfaces are declared in the
[common source sets](/kmath-core/src/commonMain) and implemented there wherever it is possible. In some cases, features
are delegated to platform-specific implementations even if they could be provided in the common module for performance
reasons. Currently, Kotlin/JVM is the primary platform, however, Kotlin/Native and Kotlin/JS contributions and
feedback are also welcome.
## Performance
Calculation performance is one of major goals of KMath in the future, but in some cases it is not possible to achieve both performance and flexibility. We expect to focus on creating convenient universal API first and then work on increasing performance for specific cases. We expect the worst KMath benchmarks will perform better than native Python, but worse than optimized native/SciPy (mostly due to boxing operations on primitive numbers). The best performance of optimized parts could be better than SciPy.
Calculation of performance is one of the major goals of KMath in the future, but in some cases it is impossible to
achieve both
performance and flexibility.
### Dependency
We expect to focus on creating a convenient universal API first and then work on increasing performance for specific
cases. We expect the worst KMath benchmarks will perform better than native Python, but worse than optimized
native/SciPy (mostly due to boxing operations on primitive numbers). The best performance of optimized parts could be
better than SciPy.
Release artifacts are accessible from bintray with following configuration (see documentation for [kotlin-multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) form more details):
## Requirements
KMath currently relies on JDK 11 for compilation and execution of Kotlin-JVM part. We recommend using GraalVM-CE or
Oracle GraalVM for execution to get better performance.
### Repositories
Release and development artifacts are accessible from mipt-npm [Space](https://www.jetbrains.com/space/)
repository `https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven` (see documentation of
[Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) for more details). The repository could
be reached through [repo.kotlin.link](https://repo.kotlin.link) proxy:
```kotlin
repositories{
maven("https://dl.bintray.com/mipt-npm/scientifik")
repositories {
maven("https://repo.kotlin.link")
}
dependencies{
api("scientifik:kmath-core:${kmathVersion}")
//api("scientifik:kmath-core-jvm:${kmathVersion}") for jvm-specific version
dependencies {
api("space.kscience:kmath-core:$version")
// api("space.kscience:kmath-core-jvm:$version") for jvm-specific version
}
```
Gradle `6.0+` is required for multiplatform artifacts.
### Development
Development builds are accessible from the reposirtory
```kotlin
repositories{
maven("https://dl.bintray.com/mipt-npm/dev")
}
```
with the same artifact names.
## Contributing
The project requires a lot of additional work. Please feel free to contribute in any way and propose new features.
The project requires a lot of additional work. The most important thing we need is feedback about what features are
required the most. Feel free to create feature requests. We are also welcome to code contributions, especially in issues
marked
with [good first issue](hhttps://github.com/SciProgCentre/kmath/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
label.

21
attributes-kt/README.md Normal file
View File

@ -0,0 +1,21 @@
# Module attributes-kt
## Usage
## Artifact:
The Maven coordinates of this project are `space.kscience:attributes-kt:0.1.0`.
**Gradle Kotlin DSL:**
```kotlin
repositories {
maven("https://repo.kotlin.link")
mavenCentral()
}
dependencies {
implementation("space.kscience:attributes-kt:0.1.0")
}
```

View File

@ -0,0 +1,104 @@
public abstract interface class space/kscience/attributes/Attribute {
}
public abstract interface class space/kscience/attributes/AttributeContainer {
public abstract fun getAttributes ()Lspace/kscience/attributes/Attributes;
}
public abstract interface class space/kscience/attributes/AttributeScope {
}
public abstract interface class space/kscience/attributes/AttributeWithDefault : space/kscience/attributes/Attribute {
public abstract fun getDefault ()Ljava/lang/Object;
}
public abstract interface class space/kscience/attributes/Attributes {
public static final field Companion Lspace/kscience/attributes/Attributes$Companion;
public abstract fun equals (Ljava/lang/Object;)Z
public fun get (Lspace/kscience/attributes/Attribute;)Ljava/lang/Object;
public abstract fun getContent ()Ljava/util/Map;
public fun getKeys ()Ljava/util/Set;
public abstract fun hashCode ()I
public abstract fun toString ()Ljava/lang/String;
}
public final class space/kscience/attributes/Attributes$Companion {
public final fun equals (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/Attributes;)Z
public final fun getEMPTY ()Lspace/kscience/attributes/Attributes;
}
public final class space/kscience/attributes/AttributesBuilder : space/kscience/attributes/Attributes {
public final fun add (Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)V
public final fun build ()Lspace/kscience/attributes/Attributes;
public fun equals (Ljava/lang/Object;)Z
public fun getContent ()Ljava/util/Map;
public fun hashCode ()I
public final fun invoke (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)V
public final fun put (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)V
public final fun putAll (Lspace/kscience/attributes/Attributes;)V
public final fun remove (Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)V
public final fun set (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)V
public fun toString ()Ljava/lang/String;
}
public final class space/kscience/attributes/AttributesBuilderKt {
public static final fun Attributes (Lkotlin/jvm/functions/Function1;)Lspace/kscience/attributes/Attributes;
}
public final class space/kscience/attributes/AttributesKt {
public static final fun Attributes (Lspace/kscience/attributes/Attribute;)Lspace/kscience/attributes/Attributes;
public static final fun Attributes (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)Lspace/kscience/attributes/Attributes;
public static final fun getOrDefault (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/AttributeWithDefault;)Ljava/lang/Object;
public static final fun isEmpty (Lspace/kscience/attributes/Attributes;)Z
public static final fun modified (Lspace/kscience/attributes/Attributes;Lkotlin/jvm/functions/Function1;)Lspace/kscience/attributes/Attributes;
public static final fun plus (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/Attributes;)Lspace/kscience/attributes/Attributes;
public static final fun withAttribute (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/Attribute;)Lspace/kscience/attributes/Attributes;
public static final fun withAttribute (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)Lspace/kscience/attributes/Attributes;
public static final fun withAttributeElement (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)Lspace/kscience/attributes/Attributes;
public static final fun withoutAttribute (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/Attribute;)Lspace/kscience/attributes/Attributes;
public static final fun withoutAttributeElement (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)Lspace/kscience/attributes/Attributes;
}
public abstract interface class space/kscience/attributes/FlagAttribute : space/kscience/attributes/Attribute {
}
public abstract class space/kscience/attributes/PolymorphicAttribute : space/kscience/attributes/Attribute {
public synthetic fun <init> (Lkotlin/reflect/KType;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getType-V0oMfBY ()Lkotlin/reflect/KType;
public fun hashCode ()I
}
public final class space/kscience/attributes/PolymorphicAttributeKt {
public static final fun get (Lspace/kscience/attributes/Attributes;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public static final fun set (Lspace/kscience/attributes/AttributesBuilder;Lkotlin/jvm/functions/Function0;Ljava/lang/Object;)V
}
public final class space/kscience/attributes/SafeType {
public static final synthetic fun box-impl (Lkotlin/reflect/KType;)Lspace/kscience/attributes/SafeType;
public static fun constructor-impl (Lkotlin/reflect/KType;)Lkotlin/reflect/KType;
public fun equals (Ljava/lang/Object;)Z
public static fun equals-impl (Lkotlin/reflect/KType;Ljava/lang/Object;)Z
public static final fun equals-impl0 (Lkotlin/reflect/KType;Lkotlin/reflect/KType;)Z
public final fun getKType ()Lkotlin/reflect/KType;
public fun hashCode ()I
public static fun hashCode-impl (Lkotlin/reflect/KType;)I
public fun toString ()Ljava/lang/String;
public static fun toString-impl (Lkotlin/reflect/KType;)Ljava/lang/String;
public final synthetic fun unbox-impl ()Lkotlin/reflect/KType;
}
public final class space/kscience/attributes/SafeTypeKt {
public static final fun getKClass-X0YbwmU (Lkotlin/reflect/KType;)Lkotlin/reflect/KClass;
}
public abstract interface class space/kscience/attributes/SetAttribute : space/kscience/attributes/Attribute {
}
public abstract interface annotation class space/kscience/attributes/UnstableAttributesAPI : java/lang/annotation/Annotation {
}
public abstract interface class space/kscience/attributes/WithType {
public abstract fun getType-V0oMfBY ()Lkotlin/reflect/KType;
}

View File

@ -0,0 +1,20 @@
plugins {
id("space.kscience.gradle.mpp")
`maven-publish`
}
version = rootProject.extra.get("attributesVersion").toString()
kscience {
jvm()
js()
native()
wasm()
}
readme {
maturity = space.kscience.gradle.Maturity.DEVELOPMENT
description = """
An API and basic implementation for arranging objects in a continuous memory block.
""".trimIndent()
}

View File

@ -0,0 +1,29 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.attributes
/**
* A marker interface for an attribute. Attributes are used as keys to access contents of type [T] in the container.
*/
public interface Attribute<T>
/**
* An attribute that could be either present or absent
*/
public interface FlagAttribute : Attribute<Unit>
/**
* An attribute with a default value
*/
public interface AttributeWithDefault<T> : Attribute<T> {
public val default: T
}
/**
* Attribute containing a set of values
*/
public interface SetAttribute<V> : Attribute<Set<V>>

View File

@ -0,0 +1,20 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.attributes
/**
* A container for [Attributes]
*/
public interface AttributeContainer {
public val attributes: Attributes
}
/**
* A scope, where attribute keys could be resolved.
* [O] is used only to resolve types in compile-time.
*/
public interface AttributeScope<O>

View File

@ -0,0 +1,157 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.attributes
/**
* A set of attributes. The implementation must guarantee that [content] keys correspond to their value types.
*/
public interface Attributes {
/**
* Raw content for this [Attributes]
*/
public val content: Map<out Attribute<*>, Any?>
/**
* Attribute keys contained in this [Attributes]
*/
public val keys: Set<Attribute<*>> get() = content.keys
/**
* Provide an attribute value. Return null if attribute is not present or if its value is null.
*/
@Suppress("UNCHECKED_CAST")
public operator fun <T> get(attribute: Attribute<T>): T? = content[attribute] as? T
override fun toString(): String
override fun equals(other: Any?): Boolean
override fun hashCode(): Int
public companion object {
public val EMPTY: Attributes = object : Attributes {
override val content: Map<out Attribute<*>, Any?> get() = emptyMap()
override fun toString(): String = "Attributes.EMPTY"
override fun equals(other: Any?): Boolean = (other as? Attributes)?.isEmpty() ?: false
override fun hashCode(): Int = Unit.hashCode()
}
public fun equals(a1: Attributes, a2: Attributes): Boolean =
a1.keys == a2.keys && a1.keys.all { a1[it] == a2[it] }
}
}
internal class MapAttributes(override val content: Map<out Attribute<*>, Any?>) : Attributes {
override fun toString(): String = "Attributes(value=${content.entries})"
override fun equals(other: Any?): Boolean = other is Attributes && Attributes.equals(this, other)
override fun hashCode(): Int = content.hashCode()
}
public fun Attributes.isEmpty(): Boolean = keys.isEmpty()
/**
* Get attribute value or default
*/
public fun <T> Attributes.getOrDefault(attribute: AttributeWithDefault<T>): T = get(attribute) ?: attribute.default
/**
* Check if there is an attribute that matches given key by type and adheres to [predicate].
*/
@Suppress("UNCHECKED_CAST")
public inline fun <T, reified A : Attribute<T>> Attributes.hasAny(predicate: (value: T) -> Boolean): Boolean =
content.any { (mapKey, mapValue) -> mapKey is A && predicate(mapValue as T) }
/**
* Check if there is an attribute of given type (subtypes included)
*/
public inline fun <reified A : Attribute<*>> Attributes.hasAny(): Boolean =
content.any { (mapKey, _) -> mapKey is A }
/**
* Check if [Attributes] contains a flag. Multiple keys that are instances of a flag could be present
*/
public inline fun <reified A : FlagAttribute> Attributes.hasFlag(): Boolean =
content.keys.any { it is A }
/**
* Create [Attributes] with an added or replaced attribute key.
*/
public fun <T, A : Attribute<T>> Attributes.withAttribute(
attribute: A,
attrValue: T,
): Attributes = MapAttributes(content + (attribute to attrValue))
public fun <A : Attribute<Unit>> Attributes.withAttribute(attribute: A): Attributes =
withAttribute(attribute, Unit)
/**
* Create a new [Attributes] by modifying the current one
*/
public fun <O> Attributes.modified(block: AttributesBuilder<O>.() -> Unit): Attributes = Attributes<O> {
putAll(this@modified)
block()
}
/**
* Create new [Attributes] by removing [attribute] key
*/
public fun Attributes.withoutAttribute(attribute: Attribute<*>): Attributes = MapAttributes(content.minus(attribute))
/**
* Add an element to a [SetAttribute]
*/
public fun <T, A : SetAttribute<T>> Attributes.withAttributeElement(
attribute: A,
attrValue: T,
): Attributes {
val currentSet: Set<T> = get(attribute) ?: emptySet()
return MapAttributes(
content + (attribute to (currentSet + attrValue))
)
}
/**
* Remove an element from [SetAttribute]
*/
public fun <T, A : SetAttribute<T>> Attributes.withoutAttributeElement(
attribute: A,
attrValue: T,
): Attributes {
val currentSet: Set<T> = get(attribute) ?: emptySet()
return MapAttributes(content + (attribute to (currentSet - attrValue)))
}
/**
* Create [Attributes] with a single key
*/
public fun <T, A : Attribute<T>> Attributes(
attribute: A,
attrValue: T,
): Attributes = MapAttributes(mapOf(attribute to attrValue))
/**
* Create Attributes with a single [Unit] valued attribute
*/
public fun <A : Attribute<Unit>> Attributes(
attribute: A,
): Attributes = MapAttributes(mapOf(attribute to Unit))
/**
* Create a new [Attributes] that overlays [other] on top of this set of attributes. New attributes are added.
* Existing attribute keys are replaced.
*/
public operator fun Attributes.plus(other: Attributes): Attributes = when {
isEmpty() -> other
other.isEmpty() -> this
else -> MapAttributes(content + other.content)
}
/**
* Create a new [Attributes] with removed [key] (if it is present).
*/
public operator fun Attributes.minus(key: Attribute<*>): Attributes =
if (content.contains(key)) MapAttributes(content.minus(key)) else this

View File

@ -0,0 +1,68 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.attributes
/**
* A builder for [Attributes].
* The builder is not thread safe
*
* @param O type marker of an owner object, for which these attributes are made
*/
public class AttributesBuilder<out O> internal constructor() : Attributes {
private val map = mutableMapOf<Attribute<*>, Any?>()
override fun toString(): String = "Attributes(value=${map.entries})"
override fun equals(other: Any?): Boolean = other is Attributes && Attributes.equals(this, other)
override fun hashCode(): Int = map.hashCode()
override val content: Map<out Attribute<*>, Any?> get() = map
public operator fun <T> set(attribute: Attribute<T>, value: T?) {
if (value == null) {
map.remove(attribute)
} else {
map[attribute] = value
}
}
public operator fun <V> Attribute<V>.invoke(value: V?) {
set(this, value)
}
public infix fun <V> Attribute<V>.put(value: V?) {
set(this, value)
}
/**
* Put all attributes for given [attributes]
*/
public fun putAll(attributes: Attributes) {
map.putAll(attributes.content)
}
public infix fun <V> SetAttribute<V>.add(attrValue: V) {
val currentSet: Set<V> = get(this) ?: emptySet()
map[this] = currentSet + attrValue
}
/**
* Remove an element from [SetAttribute]
*/
public infix fun <V> SetAttribute<V>.remove(attrValue: V) {
val currentSet: Set<V> = get(this) ?: emptySet()
map[this] = currentSet - attrValue
}
public fun build(): Attributes = MapAttributes(map)
}
/**
* Create [Attributes] with a given [builder]
* @param O the type for which attributes are built. The type is used only during compilation phase for static extension dispatch
*/
public fun <O> Attributes(builder: AttributesBuilder<O>.() -> Unit): Attributes =
AttributesBuilder<O>().apply(builder).build()

View File

@ -0,0 +1,34 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.attributes
/**
* An attribute that has a type parameter for value
* @param type parameter-type
*/
public abstract class PolymorphicAttribute<T>(public val type: SafeType<T>) : Attribute<T> {
override fun equals(other: Any?): Boolean = other != null &&
(this::class == other::class) &&
(other as? PolymorphicAttribute<*>)?.type == this.type
override fun hashCode(): Int = this::class.hashCode() + type.hashCode()
}
/**
* Get a polymorphic attribute using attribute factory
*/
@UnstableAttributesAPI
public operator fun <T> Attributes.get(attributeKeyBuilder: () -> PolymorphicAttribute<T>): T? =
get(attributeKeyBuilder())
/**
* Set a polymorphic attribute using its factory
*/
@UnstableAttributesAPI
public operator fun <O, T> AttributesBuilder<O>.set(attributeKeyBuilder: () -> PolymorphicAttribute<T>, value: T) {
set(attributeKeyBuilder(), value)
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.attributes
import kotlin.jvm.JvmInline
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.typeOf
/**
* Safe variant ok Kotlin [KType] that ensures that the type parameter is of the same type as [kType]
*
* @param kType raw [KType]
*/
@JvmInline
public value class SafeType<out T> @PublishedApi internal constructor(public val kType: KType)
public inline fun <reified T> safeTypeOf(): SafeType<T> = SafeType(typeOf<T>())
/**
* Derive Kotlin [KClass] from this type and fail if the type is not a class (should not happen)
*/
@Suppress("UNCHECKED_CAST")
@UnstableAttributesAPI
public val <T> SafeType<T>.kClass: KClass<T & Any> get() = kType.classifier as KClass<T & Any>
/**
* An interface containing [type] for dynamic type checking.
*/
public interface WithType<out T> {
public val type: SafeType<T>
}

View File

@ -0,0 +1,17 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.attributes
/**
* Marks declarations that are still experimental in the Attributes-kt APIs, which means that the design of the corresponding
* declarations has open issues that may (or may not) lead to their changes in the future. Roughly speaking, there is
* a chance of those declarations will be deprecated in the future or the semantics of their behavior may change
* in some way that may break some code.
*/
@MustBeDocumented
@Retention(value = AnnotationRetention.BINARY)
@RequiresOptIn("This API is unstable and could change in future", RequiresOptIn.Level.WARNING)
public annotation class UnstableAttributesAPI

119
benchmarks/README.md Normal file
View File

@ -0,0 +1,119 @@
# BenchmarksResult
## Report for benchmark configuration <code>main</code>
* Run on Java HotSpot(TM) 64-Bit Server VM (build 21.0.4+8-LTS-jvmci-23.1-b41) with Java process:
```
C:\Users\altavir\scoop\apps\graalvm-oracle-21jdk\current\bin\java.exe -XX:ThreadPriorityPolicy=1 -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct -XX:-UnlockExperimentalVMOptions -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant
```
* JMH 1.21 was used in `thrpt` mode with 5 warmup iterations by 10 s and 5 measurement iterations by 10 s.
### [ArrayBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`benchmarkArrayRead`|1.9E+07 &plusmn; 2.3E+05 ops/s|
|`benchmarkBufferRead`|1.4E+07 &plusmn; 8.7E+05 ops/s|
|`nativeBufferRead`|1.4E+07 &plusmn; 1.3E+06 ops/s|
### [BigIntBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`jvmAdd`|5.1E+07 &plusmn; 1.3E+06 ops/s|
|`jvmAddLarge`|5.1E+04 &plusmn; 8.2E+02 ops/s|
|`jvmMultiply`|8.5E+07 &plusmn; 9.7E+06 ops/s|
|`jvmMultiplyLarge`|2.5E+02 &plusmn; 15 ops/s|
|`jvmParsing10`|8.7E+06 &plusmn; 5.1E+05 ops/s|
|`jvmParsing16`|6.4E+06 &plusmn; 1.8E+05 ops/s|
|`jvmPower`|28 &plusmn; 0.79 ops/s|
|`jvmSmallAdd`|7.0E+07 &plusmn; 4.3E+06 ops/s|
|`kmAdd`|4.8E+07 &plusmn; 2.2E+06 ops/s|
|`kmAddLarge`|3.5E+04 &plusmn; 3.7E+03 ops/s|
|`kmMultiply`|6.7E+07 &plusmn; 1.5E+07 ops/s|
|`kmMultiplyLarge`|54 &plusmn; 4.2 ops/s|
|`kmParsing10`|4.5E+06 &plusmn; 8.3E+04 ops/s|
|`kmParsing16`|4.9E+06 &plusmn; 1.1E+05 ops/s|
|`kmPower`|10 &plusmn; 0.96 ops/s|
|`kmSmallAdd`|4.1E+07 &plusmn; 5.9E+05 ops/s|
### [BufferBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`bufferViewReadWrite`|5.8E+06 &plusmn; 1.6E+05 ops/s|
|`bufferViewReadWriteSpecialized`|5.6E+06 &plusmn; 2.6E+05 ops/s|
|`complexBufferReadWrite`|6.6E+06 &plusmn; 2.7E+05 ops/s|
|`doubleArrayReadWrite`|7.5E+06 &plusmn; 1.0E+06 ops/s|
|`doubleBufferReadWrite`|8.0E+06 &plusmn; 6.7E+05 ops/s|
### [DotBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`bufferedDot`|1.3 &plusmn; 0.020 ops/s|
|`cmDot`|0.47 &plusmn; 0.42 ops/s|
|`cmDotWithConversion`|0.76 &plusmn; 0.13 ops/s|
|`ejmlDot`|6.7 &plusmn; 0.091 ops/s|
|`ejmlDotWithConversion`|6.4 &plusmn; 0.82 ops/s|
|`multikDot`|40 &plusmn; 6.7 ops/s|
|`parallelDot`|12 &plusmn; 1.8 ops/s|
|`tensorDot`|1.2 &plusmn; 0.041 ops/s|
|`tfDot`|5.9 &plusmn; 0.49 ops/s|
### [ExpressionsInterpretersBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`asmGenericExpression`|29 &plusmn; 1.2 ops/s|
|`asmPrimitiveExpression`|43 &plusmn; 1.3 ops/s|
|`asmPrimitiveExpressionArray`|71 &plusmn; 0.38 ops/s|
|`functionalExpression`|5.6 &plusmn; 0.11 ops/s|
|`justCalculate`|69 &plusmn; 9.0 ops/s|
|`mstExpression`|7.1 &plusmn; 0.020 ops/s|
|`rawExpression`|41 &plusmn; 1.5 ops/s|
### [IntegrationBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/IntegrationBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`complexIntegration`|3.6E+03 &plusmn; 1.9E+02 ops/s|
|`doubleIntegration`|3.7E+03 &plusmn; 12 ops/s|
### [JafamaBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/JafamaBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`core`|38 &plusmn; 0.64 ops/s|
|`jafama`|52 &plusmn; 0.36 ops/s|
|`strictJafama`|52 &plusmn; 4.0 ops/s|
### [MatrixInverseBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`cmLUPInversion`|2.2E+03 &plusmn; 76 ops/s|
|`ejmlInverse`|1.3E+03 &plusmn; 5.7 ops/s|
|`kmathLupInversion`|9.5E+02 &plusmn; 1.8E+02 ops/s|
|`kmathParallelLupInversion`|9.1E+02 &plusmn; 1.4E+02 ops/s|
### [NDFieldBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`boxingFieldAdd`|7.7 &plusmn; 0.79 ops/s|
|`multikAdd`|6.5 &plusmn; 0.33 ops/s|
|`multikInPlaceAdd`|64 &plusmn; 0.79 ops/s|
|`specializedFieldAdd`|8.0 &plusmn; 0.090 ops/s|
|`tensorAdd`|9.2 &plusmn; 0.053 ops/s|
|`tensorInPlaceAdd`|17 &plusmn; 10 ops/s|
|`viktorAdd`|7.6 &plusmn; 1.2 ops/s|
### [ViktorBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`doubleFieldAddition`|7.7 &plusmn; 0.34 ops/s|
|`rawViktor`|5.9 &plusmn; 1.1 ops/s|
|`viktorFieldAddition`|7.3 &plusmn; 1.1 ops/s|
### [ViktorLogBenchmark](src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt)
| Benchmark | Score |
|:---------:|:-----:|
|`rawViktorLog`|1.4 &plusmn; 0.076 ops/s|
|`realFieldLog`|1.3 &plusmn; 0.069 ops/s|
|`viktorFieldLog`|1.3 &plusmn; 0.032 ops/s|

281
benchmarks/build.gradle.kts Normal file
View File

@ -0,0 +1,281 @@
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import kotlinx.benchmark.gradle.BenchmarksExtension
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.*
plugins {
kotlin("multiplatform")
alias(spclibs.plugins.kotlin.plugin.allopen)
alias(spclibs.plugins.kotlinx.benchmark)
}
allOpen.annotation("org.openjdk.jmh.annotations.State")
sourceSets.register("benchmarks")
repositories {
mavenCentral()
}
kotlin {
jvm()
js(IR) {
nodejs()
}
sourceSets {
all {
languageSettings {
progressiveMode = true
optIn("kotlin.contracts.ExperimentalContracts")
optIn("kotlin.ExperimentalUnsignedTypes")
optIn("space.kscience.kmath.UnstableKMathAPI")
}
}
val commonMain by getting {
dependencies {
implementation(project(":kmath-ast"))
implementation(project(":kmath-core"))
implementation(project(":kmath-coroutines"))
implementation(project(":kmath-complex"))
implementation(project(":kmath-stat"))
implementation(project(":kmath-dimensions"))
implementation(project(":kmath-for-real"))
implementation(project(":kmath-tensors"))
implementation(project(":kmath-multik"))
implementation(libs.multik.default)
implementation(spclibs.kotlinx.benchmark.runtime)
}
}
val jvmMain by getting {
dependencies {
implementation(project(":kmath-commons"))
implementation(project(":kmath-ejml"))
implementation(project(":kmath-nd4j"))
implementation(project(":kmath-kotlingrad"))
implementation(project(":kmath-viktor"))
implementation(project(":kmath-jafama"))
implementation(projects.kmath.kmathTensorflow)
implementation("org.tensorflow:tensorflow-core-platform:0.4.0")
implementation("org.nd4j:nd4j-native:1.0.0-M1")
// uncomment if your system supports AVX2
// val os = System.getProperty("os.name")
//
// if (System.getProperty("os.arch") in arrayOf("x86_64", "amd64")) when {
// os.startsWith("Windows") -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:windows-x86_64-avx2")
// os == "Linux" -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:linux-x86_64-avx2")
// os == "Mac OS X" -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:macosx-x86_64-avx2")
// } else
// implementation("org.nd4j:nd4j-native-platform:1.0.0-beta7")
}
}
}
}
// Configure benchmark
benchmark {
// Setup configurations
targets {
register("jvm")
register("js")
}
fun kotlinx.benchmark.gradle.BenchmarkConfiguration.commonConfiguration() {
warmups = 2
iterations = 5
iterationTime = 2000
iterationTimeUnit = "ms"
}
configurations.register("buffer") {
commonConfiguration()
include("BufferBenchmark")
}
configurations.register("nd") {
commonConfiguration()
include("NDFieldBenchmark")
}
configurations.register("dot") {
commonConfiguration()
include("DotBenchmark")
}
configurations.register("expressions") {
// Some extra precision
warmups = 2
iterations = 10
iterationTime = 10
iterationTimeUnit = "s"
outputTimeUnit = "s"
include("ExpressionsInterpretersBenchmark")
}
configurations.register("matrixInverse") {
commonConfiguration()
include("MatrixInverseBenchmark")
}
configurations.register("bigInt") {
commonConfiguration()
include("BigIntBenchmark")
}
configurations.register("jafamaDouble") {
commonConfiguration()
include("JafamaBenchmark")
}
configurations.register("tensorAlgebra") {
commonConfiguration()
include("TensorAlgebraBenchmark")
}
configurations.register("viktor") {
commonConfiguration()
include("ViktorBenchmark")
}
configurations.register("viktorLog") {
commonConfiguration()
include("ViktorLogBenchmark")
}
configurations.register("integration") {
commonConfiguration()
include("IntegrationBenchmark")
}
}
kotlin {
jvmToolchain(11)
compilerOptions {
optIn.addAll(
"space.kscience.kmath.UnstableKMathAPI"
)
}
}
private data class JmhReport(
val jmhVersion: String,
val benchmark: String,
val mode: String,
val threads: Int,
val forks: Int,
val jvm: String,
val jvmArgs: List<String>,
val jdkVersion: String,
val vmName: String,
val vmVersion: String,
val warmupIterations: Int,
val warmupTime: String,
val warmupBatchSize: Int,
val measurementIterations: Int,
val measurementTime: String,
val measurementBatchSize: Int,
val params: Map<String, String> = emptyMap(),
val primaryMetric: PrimaryMetric,
val secondaryMetrics: Map<String, SecondaryMetric>,
) {
interface Metric {
val score: Double
val scoreError: Double
val scoreConfidence: List<Double>
val scorePercentiles: Map<Double, Double>
val scoreUnit: String
}
data class PrimaryMetric(
override val score: Double,
override val scoreError: Double,
override val scoreConfidence: List<Double>,
override val scorePercentiles: Map<Double, Double>,
override val scoreUnit: String,
val rawDataHistogram: List<List<List<List<Double>>>>? = null,
val rawData: List<List<Double>>? = null,
) : Metric
data class SecondaryMetric(
override val score: Double,
override val scoreError: Double,
override val scoreConfidence: List<Double>,
override val scorePercentiles: Map<Double, Double>,
override val scoreUnit: String,
val rawData: List<List<Double>>,
) : Metric
}
readme {
maturity = space.kscience.gradle.Maturity.EXPERIMENTAL
val jsonMapper = jacksonObjectMapper()
fun noun(number: Number, singular: String, plural: String) = if (number.toLong() == 1L) singular else plural
extensions.findByType(BenchmarksExtension::class.java)?.configurations?.forEach { cfg ->
val propertyName =
"benchmark${cfg.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }}"
logger.info("Processing benchmark data from benchmark ${cfg.name} into readme property $propertyName")
val launches = layout.buildDirectory.dir("reports/benchmarks/${cfg.name}").get().asFile
if (!launches.exists()) return@forEach
property(propertyName) {
val resDirectory = launches.listFiles()?.maxByOrNull {
LocalDateTime.parse(it.name).atZone(ZoneId.systemDefault()).toInstant()
}
if (resDirectory == null || !(resDirectory.resolve("jvm.json")).exists()) {
"> **Can't find appropriate benchmark data. Try generating readme files after running benchmarks**."
} else {
val reports: List<JmhReport> =
jsonMapper.readValue<List<JmhReport>>(resDirectory.resolve("jvm.json"))
buildString {
appendLine("## Report for benchmark configuration <code>${cfg.name}</code>")
appendLine()
val first = reports.first()
appendLine("* Run on ${first.vmName} (build ${first.vmVersion}) with Java process:")
appendLine()
appendLine("```")
appendLine(
"${first.jvm} ${
first.jvmArgs.joinToString(" ")
}"
)
appendLine("```")
appendLine(
"* JMH ${first.jmhVersion} was used in `${first.mode}` mode with ${first.warmupIterations} warmup ${
noun(first.warmupIterations, "iteration", "iterations")
} by ${first.warmupTime} and ${first.measurementIterations} measurement ${
noun(first.measurementIterations, "iteration", "iterations")
} by ${first.measurementTime}."
)
reports.groupBy { it.benchmark.substringBeforeLast(".") }.forEach { (cl, compare) ->
appendLine("### [${cl.substringAfterLast(".")}](src/jvmMain/kotlin/${cl.replace(".","/")}.kt)")
appendLine()
appendLine("| Benchmark | Score |")
appendLine("|:---------:|:-----:|")
compare.forEach { report ->
val benchmarkName = report.benchmark.substringAfterLast(".")
val score = String.format("%.2G", report.primaryMetric.score)
val error = String.format("%.2G", report.primaryMetric.scoreError)
appendLine("|`$benchmarkName`|$score &plusmn; $error ${report.primaryMetric.scoreUnit}|")
}
}
}
}
}
}
}

View File

@ -0,0 +1,5 @@
# BenchmarksResult
${benchmarkMain}

View File

@ -0,0 +1,108 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.expressions.*
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.operations.bindSymbol
import space.kscience.kmath.operations.invoke
import space.kscience.kmath.structures.Float64
import kotlin.math.sin
import kotlin.random.Random
import space.kscience.kmath.estree.compileToExpression as estreeCompileToExpression
import space.kscience.kmath.wasm.compileToExpression as wasmCompileToExpression
@State(Scope.Benchmark)
class ExpressionsInterpretersBenchmark {
/**
* Benchmark case for [Expression] created with [expressionInExtendedField].
*/
@Benchmark
fun functionalExpression(blackhole: Blackhole) = invokeAndSum(functional, blackhole)
/**
* Benchmark case for [Expression] created with [toExpression].
*/
@Benchmark
fun mstExpression(blackhole: Blackhole) = invokeAndSum(mst, blackhole)
/**
* Benchmark case for [Expression] created with [compileToExpression].
*/
@Benchmark
fun wasmExpression(blackhole: Blackhole) = invokeAndSum(wasm, blackhole)
/**
* Benchmark case for [Expression] created with [compileToExpression].
*/
@Benchmark
fun estreeExpression(blackhole: Blackhole) = invokeAndSum(estree, blackhole)
/**
* Benchmark case for [Expression] implemented manually with `kotlin.math` functions.
*/
@Benchmark
fun rawExpression(blackhole: Blackhole) = invokeAndSum(raw, blackhole)
/**
* Benchmark case for direct computation w/o [Expression].
*/
@Benchmark
fun justCalculate(blackhole: Blackhole) {
val random = Random(0)
var sum = 0.0
repeat(times) {
val x = random.nextDouble()
sum += x * 2.0 + 2.0 / x - 16.0 / sin(x)
}
blackhole.consume(sum)
}
private fun invokeAndSum(expr: Expression<Float64>, blackhole: Blackhole) {
val random = Random(0)
var sum = 0.0
val m = HashMap<Symbol, Double>()
repeat(times) {
m[x] = random.nextDouble()
sum += expr(m)
}
blackhole.consume(sum)
}
private companion object {
private val x by symbol
private const val times = 1_000_000
private val functional = Float64Field.expression {
val x = bindSymbol(Symbol.x)
x * number(2.0) + 2.0 / x - 16.0 / sin(x)
}
private val node = MstExtendedField {
x * 2.0 + number(2.0) / x - number(16.0) / sin(x)
}
private val mst = node.toExpression(Float64Field)
@OptIn(UnstableKMathAPI::class)
private val wasm = node.wasmCompileToExpression(Float64Field)
private val estree = node.estreeCompileToExpression(Float64Field)
private val raw = Expression<Float64> { args ->
val x = args.getValue(x)
x * 2.0 + 2.0 / x - 16.0 / sin(x)
}
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import java.nio.IntBuffer
@State(Scope.Benchmark)
internal class ArrayBenchmark {
@Benchmark
fun benchmarkArrayRead(blackhole: Blackhole) {
var res = 0
for (i in 1..size) res += array[size - i]
blackhole.consume(res)
}
@Benchmark
fun benchmarkBufferRead(blackhole: Blackhole) {
var res = 0
for (i in 1..size) res += arrayBuffer[size - i]
blackhole.consume(res)
}
@Benchmark
fun nativeBufferRead(blackhole: Blackhole) {
var res = 0
for (i in 1..size) res += nativeBuffer[size - i]
blackhole.consume(res)
}
private companion object {
private const val size = 1000
private val array = IntArray(size) { it }
private val arrayBuffer = IntBuffer.wrap(array)
private val nativeBuffer = IntBuffer.allocate(size).also { for (i in 0 until size) it.put(i, i) }
}
}

View File

@ -0,0 +1,112 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Blackhole
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.operations.BigIntField
import space.kscience.kmath.operations.JBigIntegerField
import space.kscience.kmath.operations.invoke
import space.kscience.kmath.operations.parseBigInteger
import java.math.BigInteger
@UnstableKMathAPI
@State(Scope.Benchmark)
internal class BigIntBenchmark {
val kmSmallNumber = BigIntField.number(100)
val jvmSmallNumber = JBigIntegerField.number(100)
val kmNumber = BigIntField.number(Int.MAX_VALUE)
val jvmNumber = JBigIntegerField.number(Int.MAX_VALUE)
val kmLargeNumber = BigIntField { number(11).pow(100_000U) }
val jvmLargeNumber: BigInteger = JBigIntegerField { number(11).pow(100_000) }
val bigExponent = 50_000
@Benchmark
fun kmSmallAdd(blackhole: Blackhole) = BigIntField {
blackhole.consume(kmSmallNumber + kmSmallNumber + kmSmallNumber)
}
@Benchmark
fun jvmSmallAdd(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume(jvmSmallNumber + jvmSmallNumber + jvmSmallNumber)
}
@Benchmark
fun kmAdd(blackhole: Blackhole) = BigIntField {
blackhole.consume(kmNumber + kmNumber + kmNumber)
}
@Benchmark
fun jvmAdd(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume(jvmNumber + jvmNumber + jvmNumber)
}
@Benchmark
fun kmAddLarge(blackhole: Blackhole) = BigIntField {
blackhole.consume(kmLargeNumber + kmLargeNumber + kmLargeNumber)
}
@Benchmark
fun jvmAddLarge(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume(jvmLargeNumber + jvmLargeNumber + jvmLargeNumber)
}
@Benchmark
fun kmMultiply(blackhole: Blackhole) = BigIntField {
blackhole.consume(kmNumber * kmNumber * kmNumber)
}
@Benchmark
fun kmMultiplyLarge(blackhole: Blackhole) = BigIntField {
blackhole.consume(kmLargeNumber * kmLargeNumber)
}
@Benchmark
fun jvmMultiply(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume(jvmNumber * jvmNumber * jvmNumber)
}
@Benchmark
fun jvmMultiplyLarge(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume(jvmLargeNumber * jvmLargeNumber)
}
@Benchmark
fun kmPower(blackhole: Blackhole) = BigIntField {
blackhole.consume(kmNumber.pow(bigExponent.toUInt()))
}
@Benchmark
fun jvmPower(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume(jvmNumber.pow(bigExponent))
}
@Benchmark
fun kmParsing16(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume("0x7f57ed8b89c29a3b9a85c7a5b84ca3929c7b7488593".parseBigInteger())
}
@Benchmark
fun kmParsing10(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume("236656783929183747565738292847574838922010".parseBigInteger())
}
@Benchmark
fun jvmParsing10(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume("236656783929183747565738292847574838922010".toBigInteger(10))
}
@Benchmark
fun jvmParsing16(blackhole: Blackhole) = JBigIntegerField {
blackhole.consume("7f57ed8b89c29a3b9a85c7a5b84ca3929c7b7488593".toBigInteger(16))
}
}

View File

@ -0,0 +1,80 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.complex.Complex
import space.kscience.kmath.complex.ComplexField
import space.kscience.kmath.complex.complex
import space.kscience.kmath.operations.invoke
import space.kscience.kmath.structures.Buffer
import space.kscience.kmath.structures.Float64Buffer
import space.kscience.kmath.structures.getDouble
import space.kscience.kmath.structures.permute
@State(Scope.Benchmark)
internal class BufferBenchmark {
@Benchmark
fun doubleArrayReadWrite(blackhole: Blackhole) {
val buffer = DoubleArray(size) { it.toDouble() }
var res = 0.0
(0 until size).forEach {
res += buffer[it]
}
blackhole.consume(res)
}
@Benchmark
fun doubleBufferReadWrite(blackhole: Blackhole) {
val buffer = Float64Buffer(size) { it.toDouble() }
var res = 0.0
(0 until size).forEach {
res += buffer[it]
}
blackhole.consume(res)
}
@Benchmark
fun bufferViewReadWrite(blackhole: Blackhole) {
val buffer = Float64Buffer(size) { it.toDouble() }.permute(reversedIndices)
var res = 0.0
(0 until size).forEach {
res += buffer[it]
}
blackhole.consume(res)
}
@Benchmark
fun bufferViewReadWriteSpecialized(blackhole: Blackhole) {
val buffer = Float64Buffer(size) { it.toDouble() }.permute(reversedIndices)
var res = 0.0
(0 until size).forEach {
res += buffer.getDouble(it)
}
blackhole.consume(res)
}
@Benchmark
fun complexBufferReadWrite(blackhole: Blackhole) = ComplexField {
val buffer = Buffer.complex(size / 2) { Complex(it.toDouble(), -it.toDouble()) }
var res = zero
(0 until size / 2).forEach {
res += buffer[it]
}
blackhole.consume(res)
}
private companion object {
private const val size = 100
private val reversedIndices = IntArray(size) { it }.apply { reverse() }
}
}

View File

@ -0,0 +1,93 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.commons.linear.CMLinearSpace
import space.kscience.kmath.ejml.EjmlLinearSpaceDDRM
import space.kscience.kmath.linear.Float64ParallelLinearSpace
import space.kscience.kmath.linear.invoke
import space.kscience.kmath.linear.linearSpace
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.tensorflow.produceWithTF
import space.kscience.kmath.tensors.core.tensorAlgebra
import kotlin.random.Random
@State(Scope.Benchmark)
internal class DotBenchmark {
companion object {
val random = Random(12224)
const val dim = 1000
//creating invertible matrix
val matrix1 = Float64Field.linearSpace.buildMatrix(dim, dim) { _, _ ->
random.nextDouble()
}
val matrix2 = Float64Field.linearSpace.buildMatrix(dim, dim) { _, _ ->
random.nextDouble()
}
val cmMatrix1 = CMLinearSpace { matrix1.toCM() }
val cmMatrix2 = CMLinearSpace { matrix2.toCM() }
val ejmlMatrix1 = EjmlLinearSpaceDDRM { matrix1.toEjml() }
val ejmlMatrix2 = EjmlLinearSpaceDDRM { matrix2.toEjml() }
}
@Benchmark
fun tfDot(blackhole: Blackhole) {
blackhole.consume(
Float64Field.produceWithTF {
matrix1 dot matrix1
}
)
}
@Benchmark
fun cmDotWithConversion(blackhole: Blackhole) = CMLinearSpace {
blackhole.consume(matrix1 dot matrix2)
}
@Benchmark
fun cmDot(blackhole: Blackhole) = CMLinearSpace {
blackhole.consume(cmMatrix1 dot cmMatrix2)
}
@Benchmark
fun ejmlDot(blackhole: Blackhole) = EjmlLinearSpaceDDRM {
blackhole.consume(ejmlMatrix1 dot ejmlMatrix2)
}
@Benchmark
fun ejmlDotWithConversion(blackhole: Blackhole) = EjmlLinearSpaceDDRM {
blackhole.consume(matrix1 dot matrix2)
}
@Benchmark
fun multikDot(blackhole: Blackhole) = with(multikAlgebra) {
blackhole.consume(matrix1 dot matrix2)
}
@Benchmark
fun tensorDot(blackhole: Blackhole) = with(Float64Field.tensorAlgebra) {
blackhole.consume(matrix1 dot matrix2)
}
@Benchmark
fun bufferedDot(blackhole: Blackhole) = with(Float64Field.linearSpace) {
blackhole.consume(matrix1 dot matrix2)
}
@Benchmark
fun parallelDot(blackhole: Blackhole) = with(Float64ParallelLinearSpace) {
blackhole.consume(matrix1 dot matrix2)
}
}

View File

@ -0,0 +1,125 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.asm.compileToExpression
import space.kscience.kmath.expressions.*
import space.kscience.kmath.operations.Algebra
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.operations.bindSymbol
import space.kscience.kmath.operations.invoke
import space.kscience.kmath.structures.Float64
import kotlin.math.sin
import kotlin.random.Random
@State(Scope.Benchmark)
internal class ExpressionsInterpretersBenchmark {
/**
* Benchmark case for [Expression] created with [expressionInExtendedField].
*/
@Benchmark
fun functionalExpression(blackhole: Blackhole) = invokeAndSum(functional, blackhole)
/**
* Benchmark case for [Expression] created with [toExpression].
*/
@Benchmark
fun mstExpression(blackhole: Blackhole) = invokeAndSum(mst, blackhole)
/**
* Benchmark case for [Expression] created with [compileToExpression].
*/
@Benchmark
fun asmGenericExpression(blackhole: Blackhole) = invokeAndSum(asmGeneric, blackhole)
/**
* Benchmark case for [Expression] created with [compileToExpression].
*/
@Benchmark
fun asmPrimitiveExpressionArray(blackhole: Blackhole) {
val random = Random(0)
var sum = 0.0
val m = DoubleArray(1)
repeat(times) {
m[xIdx] = random.nextDouble()
sum += asmPrimitive(m)
}
blackhole.consume(sum)
}
/**
* Benchmark case for [Expression] created with [compileToExpression].
*/
@Benchmark
fun asmPrimitiveExpression(blackhole: Blackhole) = invokeAndSum(asmPrimitive, blackhole)
/**
* Benchmark case for [Expression] implemented manually with `kotlin.math` functions.
*/
@Benchmark
fun rawExpression(blackhole: Blackhole) = invokeAndSum(raw, blackhole)
/**
* Benchmark case for direct computation w/o [Expression].
*/
@Benchmark
fun justCalculate(blackhole: Blackhole) {
val random = Random(0)
var sum = 0.0
repeat(times) {
val x = random.nextDouble()
sum += x * 2.0 + 2.0 / x - 16.0 / sin(x)
}
blackhole.consume(sum)
}
private fun invokeAndSum(expr: Expression<Float64>, blackhole: Blackhole) {
val random = Random(0)
var sum = 0.0
val m = HashMap<Symbol, Double>()
repeat(times) {
m[x] = random.nextDouble()
sum += expr(m)
}
blackhole.consume(sum)
}
private companion object {
private val x by symbol
private const val times = 1_000_000
private val functional = Float64Field.expression {
val x = bindSymbol(Symbol.x)
x * number(2.0) + 2.0 / x - 16.0 / sin(x)
}
private val node = MstExtendedField {
x * 2.0 + number(2.0) / x - number(16.0) / sin(x)
}
private val mst = node.toExpression(Float64Field)
private val asmPrimitive = node.compileToExpression(Float64Field)
private val xIdx = asmPrimitive.indexer.indexOf(x)
private val asmGeneric = node.compileToExpression(Float64Field as Algebra<Float64>)
private val raw = Expression<Float64> { args ->
val x = args[x]!!
x * 2.0 + 2.0 / x - 16.0 / sin(x)
}
}
}

View File

@ -0,0 +1,40 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import org.openjdk.jmh.infra.Blackhole
import space.kscience.kmath.complex.Complex
import space.kscience.kmath.complex.algebra
import space.kscience.kmath.integration.gaussIntegrator
import space.kscience.kmath.integration.integrate
import space.kscience.kmath.integration.value
import space.kscience.kmath.operations.algebra
@State(Scope.Benchmark)
internal class IntegrationBenchmark {
@Benchmark
fun doubleIntegration(blackhole: Blackhole) {
val res = Double.algebra.gaussIntegrator.integrate(0.0..1.0, intervals = 1000) { x: Double ->
//sin(1 / x)
1 / x
}.value
blackhole.consume(res)
}
@Benchmark
fun complexIntegration(blackhole: Blackhole) = with(Complex.algebra) {
val res = gaussIntegrator.integrate(0.0..1.0, intervals = 1000) { x: Double ->
// sin(1 / x) + i * cos(1 / x)
1 / x - i / x
}.value
blackhole.consume(res)
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Blackhole
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import space.kscience.kmath.jafama.JafamaDoubleField
import space.kscience.kmath.jafama.StrictJafamaDoubleField
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.operations.invoke
import kotlin.random.Random
@State(Scope.Benchmark)
internal class JafamaBenchmark {
@Benchmark
fun jafama(blackhole: Blackhole) = invokeBenchmarks(blackhole) { x ->
JafamaDoubleField { x * power(x, 4) * exp(x) / cos(x) + sin(x) }
}
@Benchmark
fun core(blackhole: Blackhole) = invokeBenchmarks(blackhole) { x ->
Float64Field { x * power(x, 4) * exp(x) / cos(x) + sin(x) }
}
@Benchmark
fun strictJafama(blackhole: Blackhole) = invokeBenchmarks(blackhole) { x ->
StrictJafamaDoubleField { x * power(x, 4) * exp(x) / cos(x) + sin(x) }
}
}
private inline fun invokeBenchmarks(blackhole: Blackhole, expr: (Double) -> Double) {
val rng = Random(0)
repeat(1000000) { blackhole.consume(expr(rng.nextDouble())) }
}

View File

@ -0,0 +1,57 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.commons.linear.CMLinearSpace
import space.kscience.kmath.commons.linear.lupSolver
import space.kscience.kmath.ejml.EjmlLinearSpaceDDRM
import space.kscience.kmath.linear.invoke
import space.kscience.kmath.linear.linearSpace
import space.kscience.kmath.linear.lupSolver
import space.kscience.kmath.linear.parallel
import space.kscience.kmath.operations.algebra
import kotlin.random.Random
@State(Scope.Benchmark)
internal class MatrixInverseBenchmark {
private companion object {
private val random = Random(1224)
private const val dim = 100
private val space = Double.algebra.linearSpace
//creating invertible matrix
private val u = space.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
private val l = space.buildMatrix(dim, dim) { i, j -> if (i >= j) random.nextDouble() else 0.0 }
private val matrix = space { l dot u }
}
@Benchmark
fun kmathLupInversion(blackhole: Blackhole) {
blackhole.consume(Double.algebra.linearSpace.lupSolver().inverse(matrix))
}
@Benchmark
fun kmathParallelLupInversion(blackhole: Blackhole) {
blackhole.consume(Double.algebra.linearSpace.parallel.lupSolver().inverse(matrix))
}
@Benchmark
fun cmLUPInversion(blackhole: Blackhole) = CMLinearSpace {
blackhole.consume(lupSolver().inverse(matrix))
}
@Benchmark
fun ejmlInverse(blackhole: Blackhole) = EjmlLinearSpaceDDRM {
blackhole.consume(matrix.toEjml().inverted())
}
}

View File

@ -0,0 +1,97 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import org.jetbrains.kotlinx.multik.api.Multik
import org.jetbrains.kotlinx.multik.api.ones
import org.jetbrains.kotlinx.multik.ndarray.data.DN
import org.jetbrains.kotlinx.multik.ndarray.data.DataType
import space.kscience.kmath.UnsafeKMathAPI
import space.kscience.kmath.nd.*
import space.kscience.kmath.nd4j.nd4j
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.structures.Float64
import space.kscience.kmath.tensors.core.DoubleTensor
import space.kscience.kmath.tensors.core.one
import space.kscience.kmath.tensors.core.tensorAlgebra
import space.kscience.kmath.viktor.viktorAlgebra
@State(Scope.Benchmark)
internal class NDFieldBenchmark {
private companion object {
private const val dim = 1000
private const val n = 100
private val shape = ShapeND(dim, dim)
private val specializedField = Float64Field.ndAlgebra
private val genericField = BufferedFieldOpsND(Float64Field)
private val nd4jField = Float64Field.nd4j
private val viktorField = Float64Field.viktorAlgebra
}
@Benchmark
fun specializedFieldAdd(blackhole: Blackhole) = with(specializedField) {
var res: StructureND<Float64> = one(shape)
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@Benchmark
fun boxingFieldAdd(blackhole: Blackhole) = with(genericField) {
var res: StructureND<Float64> = one(shape)
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@Benchmark
fun multikAdd(blackhole: Blackhole) = with(multikAlgebra) {
var res: StructureND<Float64> = one(shape)
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@Benchmark
fun viktorAdd(blackhole: Blackhole) = with(viktorField) {
var res: StructureND<Float64> = one(shape)
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@Benchmark
fun tensorAdd(blackhole: Blackhole) = with(Double.tensorAlgebra) {
var res: DoubleTensor = one(shape)
repeat(n) { res = res + 1.0 }
blackhole.consume(res)
}
@Benchmark
fun tensorInPlaceAdd(blackhole: Blackhole) = with(Double.tensorAlgebra) {
val res: DoubleTensor = one(shape)
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
@OptIn(UnsafeKMathAPI::class)
@Benchmark
fun multikInPlaceAdd(blackhole: Blackhole) = with(multikAlgebra) {
val res = Multik.ones<Double, DN>(shape.asArray(), DataType.DoubleDataType).wrap()
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
// @Benchmark
// fun nd4jAdd(blackhole: Blackhole) = with(nd4jField) {
// var res: StructureND<Float64> = one(dim, dim)
// repeat(n) { res += 1.0 }
// blackhole.consume(res)
// }
}

View File

@ -0,0 +1,39 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import space.kscience.kmath.linear.linearSpace
import space.kscience.kmath.linear.matrix
import space.kscience.kmath.linear.symmetric
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.tensors.core.symEigJacobi
import space.kscience.kmath.tensors.core.symEigSvd
import space.kscience.kmath.tensors.core.tensorAlgebra
import kotlin.random.Random
@State(Scope.Benchmark)
internal class TensorAlgebraBenchmark {
companion object {
private val random = Random(12224)
private const val dim = 30
private val matrix = Float64Field.linearSpace.matrix(dim, dim).symmetric { _, _ -> random.nextDouble() }
}
@Benchmark
fun tensorSymEigSvd(blackhole: Blackhole) = with(Double.tensorAlgebra) {
blackhole.consume(symEigSvd(matrix, 1e-10))
}
@Benchmark
fun tensorSymEigJacobi(blackhole: Blackhole) = with(Double.tensorAlgebra) {
blackhole.consume(symEigJacobi(matrix, 50, 1e-10))
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import org.jetbrains.bio.viktor.F64Array
import space.kscience.kmath.nd.ShapeND
import space.kscience.kmath.nd.StructureND
import space.kscience.kmath.nd.ndAlgebra
import space.kscience.kmath.nd.one
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.structures.Float64
import space.kscience.kmath.viktor.ViktorFieldND
@State(Scope.Benchmark)
internal class ViktorBenchmark {
@Benchmark
fun doubleFieldAddition(blackhole: Blackhole) {
with(doubleField) {
var res: StructureND<Float64> = one(shape)
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
}
@Benchmark
fun viktorFieldAddition(blackhole: Blackhole) {
with(viktorField) {
var res = one(shape)
repeat(n) { res += 1.0 }
blackhole.consume(res)
}
}
@Benchmark
fun rawViktor(blackhole: Blackhole) {
val one = F64Array.full(init = 1.0, shape = intArrayOf(dim, dim))
var res = one
repeat(n) { res = res + one }
blackhole.consume(res)
}
private companion object {
private const val dim = 1000
private const val n = 100
private val shape = ShapeND(dim, dim)
// automatically build context most suited for given type.
private val doubleField = Float64Field.ndAlgebra
private val viktorField = ViktorFieldND(dim, dim)
}
}

View File

@ -0,0 +1,58 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark
import kotlinx.benchmark.Blackhole
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import org.jetbrains.bio.viktor.F64Array
import space.kscience.kmath.nd.ShapeND
import space.kscience.kmath.nd.ndAlgebra
import space.kscience.kmath.nd.one
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.viktor.ViktorFieldND
@State(Scope.Benchmark)
internal class ViktorLogBenchmark {
@Benchmark
fun realFieldLog(blackhole: Blackhole) {
with(doubleField) {
val fortyTwo = structureND(shape) { 42.0 }
var res = one(shape)
repeat(n) { res = ln(fortyTwo) }
blackhole.consume(res)
}
}
@Benchmark
fun viktorFieldLog(blackhole: Blackhole) {
with(viktorField) {
val fortyTwo = structureND(shape) { 42.0 }
var res = one
repeat(n) { res = ln(fortyTwo) }
blackhole.consume(res)
}
}
@Benchmark
fun rawViktorLog(blackhole: Blackhole) {
val fortyTwo = F64Array.full(dim, dim, init = 42.0)
lateinit var res: F64Array
repeat(n) { res = fortyTwo.log() }
blackhole.consume(res)
}
private companion object {
private const val dim = 1000
private const val n = 100
private val shape = ShapeND(dim, dim)
// automatically build context most suited for given type.
private val doubleField = Float64Field.ndAlgebra
private val viktorField = ViktorFieldND(dim, dim)
}
}

View File

@ -0,0 +1,11 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.benchmarks
import org.jetbrains.kotlinx.multik.default.DefaultEngine
import space.kscience.kmath.multik.MultikDoubleAlgebra
val multikAlgebra = MultikDoubleAlgebra(DefaultEngine())

View File

@ -1,25 +1,72 @@
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam
plugins {
id("scientifik.publish") apply false
alias(spclibs.plugins.kscience.project)
alias(spclibs.plugins.kotlinx.kover)
}
val kmathVersion by extra("0.1.4-dev-8")
val bintrayRepo by extra("scientifik")
val githubProject by extra("kmath")
val attributesVersion by extra("0.2.0")
allprojects {
repositories {
jcenter()
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/hotkeytlt/maven")
maven("https://repo.kotlin.link")
maven("https://oss.sonatype.org/content/repositories/snapshots")
mavenCentral()
}
group = "scientifik"
version = kmathVersion
group = "space.kscience"
version = "0.4.1-dev"
}
subprojects {
if (name.startsWith("kmath")) {
apply(plugin = "scientifik.publish")
if (name.startsWith("kmath")) apply<MavenPublishPlugin>()
plugins.withId("org.jetbrains.dokka") {
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial> {
dependsOn(tasks["assemble"])
dokkaSourceSets.all {
val readmeFile = this@subprojects.projectDir.resolve("README.md")
if (readmeFile.exists()) includes.from(readmeFile)
val kotlinDirPath = "src/$name/kotlin"
val kotlinDir = file(kotlinDirPath)
if (kotlinDir.exists()) sourceLink {
localDirectory.set(kotlinDir)
remoteUrl.set(
uri("https://github.com/SciProgCentre/kmath/tree/master/${this@subprojects.name}/$kotlinDirPath").toURL()
)
}
externalDocumentationLink("https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/")
externalDocumentationLink("https://deeplearning4j.org/api/latest/")
externalDocumentationLink("https://axelclk.bitbucket.io/symja/javadoc/")
externalDocumentationLink(
"https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/",
"https://kotlin.github.io/kotlinx.coroutines/package-list",
)
externalDocumentationLink(
"https://breandan.net/kotlingrad/kotlingrad/",
"https://breandan.net/kotlingrad/kotlingrad/kotlingrad/package-list",
)
}
}
}
}
}
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")
ksciencePublish {
pom("https://github.com/SciProgCentre/kmath") {
useApache2Licence()
useSPCTeam()
}
repository("spc", "https://maven.sciprog.center/kscience")
sonatype("https://oss.sonatype.org")
}
apiValidation.nonPublicMarkers.add("space.kscience.kmath.UnstableKMathAPI")

View File

@ -1,125 +0,0 @@
# Algebraic Structures and Algebraic Elements
The mathematical operations in KMath are generally separated from mathematical objects. This means that to perform an
operation, say `+`, one needs two objects of a type `T` and an algebra context, which draws appropriate operation up,
say `Space<T>`. Next one needs to run the actual operation in the context:
```kotlin
import scientifik.kmath.operations.*
val a: T = ...
val b: T = ...
val space: Space<T> = ...
val c = space { a + b }
```
At first glance, this distinction seems to be a needless complication, but in fact one needs to remember that in
mathematics, one could draw up different operations on same objects. For example, one could use different types of
geometry for vectors.
## Algebraic Structures
Mathematical contexts have the following hierarchy:
**Algebra** ← **Space****Ring** ← **Field**
These interfaces follow real algebraic structures:
- [Space](https://mathworld.wolfram.com/VectorSpace.html) defines addition, its neutral element (i.e. 0) and scalar
multiplication;
- [Ring](http://mathworld.wolfram.com/Ring.html) adds multiplication and its neutral element (i.e. 1);
- [Field](http://mathworld.wolfram.com/Field.html) adds division operation.
A typical implementation of `Field<T>` is the `RealField` which works on doubles, and `VectorSpace` for `Space<T>`.
In some cases algebra context can hold additional operations like `exp` or `sin`, and then it inherits appropriate
interface. Also, contexts may have operations, which produce elements outside of the context. For example, `Matrix.dot`
operation produces a matrix with new dimensions, which can be incompatible with initial matrix in terms of linear
operations.
## Algebraic Element
To achieve more familiar behavior (where you apply operations directly to mathematical objects), without involving
contexts KMath submits special type objects called `MathElement`. A `MathElement` is basically some object coupled to
a mathematical context. For example `Complex` is the pair of real numbers representing real and imaginary parts,
but it also holds reference to the `ComplexField` singleton, which allows performing direct operations on `Complex`
numbers without explicit involving the context like:
```kotlin
import scientifik.kmath.operations.*
// Using elements
val c1 = Complex(1.0, 1.0)
val c2 = Complex(1.0, -1.0)
val c3 = c1 + c2 + 3.0.toComplex()
// Using context
val c4 = ComplexField { c1 + i - 2.0 }
```
Both notations have their pros and cons.
The hierarchy for algebraic elements follows the hierarchy for the corresponding algebraic structures.
**MathElement** ← **SpaceElement****RingElement** ← **FieldElement**
`MathElement<C>` is the generic common ancestor of the class with context.
One major distinction between algebraic elements and algebraic contexts is that elements have three type
parameters:
1. The type of elements, the field operates on.
2. The self-type of the element returned from operation (which has to be an algebraic element).
3. The type of the algebra over first type-parameter.
The middle type is needed for of algebra members do not store context. For example, it is impossible to add a context
to regular `Double`. The element performs automatic conversions from context types and back. One should use context
operations in all performance-critical places. The performance of element operations is not guaranteed.
## Spaces and Fields
KMath submits both contexts and elements for builtin algebraic structures:
```kotlin
import scientifik.kmath.operations.*
val c1 = Complex(1.0, 2.0)
val c2 = ComplexField.i
val c3 = c1 + c2
// or
val c3 = ComplexField { c1 + c2 }
```
Also, `ComplexField` features special operations to mix complex and real numbers, for example:
```kotlin
import scientifik.kmath.operations.*
val c1 = Complex(1.0, 2.0)
val c2 = ComplexField { c1 - 1.0 } // Returns: Complex(re=0.0, im=2.0)
val c3 = ComplexField { c1 - i * 2.0 }
```
**Note**: In theory it is possible to add behaviors directly to the context, but as for now Kotlin does not support
that. Watch [KT-10468](https://youtrack.jetbrains.com/issue/KT-10468) and
[KEEP-176](https://github.com/Kotlin/KEEP/pull/176) for updates.
## Nested fields
Contexts allow one to build more complex structures. For example, it is possible to create a `Matrix` from complex
elements like so:
```kotlin
val element = NDElement.complex(shape = intArrayOf(2, 2)) { index: IntArray ->
Complex(index[0].toDouble() - index[1].toDouble(), index[0].toDouble() + index[1].toDouble())
}
```
The `element` in this example is a member of the `Field` of 2D structures, each element of which is a member of its own
`ComplexField`. It is important one does not need to create a special n-d class to hold complex
numbers and implement operations on it, one just needs to provide a field for its elements.
**Note**: Fields themselves do not solve the problem of JVM boxing, but it is possible to solve with special contexts like
`MemorySpec`.

View File

@ -1,73 +0,0 @@
# Context-oriented mathematics
## The problem
A known problem for implementing mathematics in statically-typed languages (but not only in them) is that different
sets of mathematical operators can be defined on the same mathematical objects. Sometimes there is no single way to
treat some operations, including basic arithmetic operations, on a Java/Kotlin `Number`. Sometimes there are different ways to
define the same structure, such as Euclidean and elliptic geometry vector spaces over real vectors. Another problem arises when
one wants to add some kind of behavior to an existing entity. In dynamic languages those problems are usually solved
by adding dynamic context-specific behaviors at runtime, but this solution has a lot of drawbacks.
## Context-oriented approach
One possible solution to these problems is to divorce numerical representations from behaviors.
For example in Kotlin one can define a separate class which represents some entity without any operations,
ex. a complex number:
```kotlin
data class Complex(val re: Double, val im: Double)
```
And then to define a separate class or singleton, representing an operation on those complex numbers:
```kotlin
object ComplexOperations {
operator fun Complex.plus(other: Complex) = Complex(re + other.re, im + other.im)
operator fun Complex.minus(other: Complex) = Complex(re - other.re, im - other.im)
}
```
In Java, applying such external operations could be very cumbersome, but Kotlin has a unique feature which allows us
implement this naturally: [extensions with receivers](https://kotlinlang.org/docs/reference/extensions.html#extension-functions).
In Kotlin, an operation on complex number could be implemented as:
```kotlin
with(ComplexOperations) { c1 + c2 - c3 }
```
Kotlin also allows the creation of functions with receivers:
```kotlin
fun ComplexOperations.doSomethingWithComplex(c1: Complex, c2: Complex, c3: Complex) = c1 + c2 - c3
ComplexOperations.doComethingWithComplex(c1, c2, c3)
```
In fact, whole parts of a program may be run within a mathematical context or even multiple nested contexts.
In KMath, contexts are not only responsible for operations, but also for raw object creation and advanced features.
## Other possibilities
### Type classes
An obvious candidate to get more or less the same functionality is the type class, which allows one to bind a behavior to
a specific type without modifying the type itself. On the plus side, type classes do not require explicit context
declaration, so the code looks cleaner. On the minus side, if there are different sets of behaviors for the same types,
it is impossible to combine them into one module. Also, unlike type classes, context can have parameters or even
state. For example in KMath, sizes and strides for `NDElement` or `Matrix` could be moved to context to optimize
performance in case of a large amount of structures.
### Wildcard imports and importing-on-demand
Sometimes, one may wish to use a single context throughout a file. In this case, is possible to import all members
from a package or file, via `import context.complex.*`. Effectively, this is the same as enclosing an entire file
with a single context. However when using multiple contexts, this technique can introduce operator ambiguity, due to
namespace pollution. If there are multiple scoped contexts which define the same operation, it is still possible to
to import specific operations as needed, without using an explicit context with extension functions, for example:
```
import context.complex.op1
import context.quaternion.op2
```

View File

@ -1,26 +0,0 @@
# Expressions
**Experimental: this API is in early stage and could change any time**
Expressions is an experimental feature which allows to construct lazily or immediately calculated parametric mathematical
expressions.
The potential use-cases for it (so far) are following:
* Lazy evaluation (in general simple lambda is better, but there are some border cases)
* Automatic differentiation in single-dimension and in multiple dimensions
* Generation of mathematical syntax trees with subsequent code generation for other languages
* Maybe symbolic computations (needs additional research)
The workhorse of this API is `Expression` interface which exposes single `operator fun invoke(arguments: Map<String, T>): T`
method. `ExpressionContext` is used to generate expressions and introduce variables.
Currently there are two implementations:
* Generic `ExpressionField` in `kmath-core` which allows construction of custom lazy expressions
* Auto-differentiation expression in `kmath-commons` module allows to use full power of `DerivativeStructure`
from commons-math. **TODO: add example**

View File

@ -1,17 +0,0 @@
# Features
* [Algebra](./algebra.md) - [Context-based](./contexts.md) operations on different primitives and structures.
* [NDStructures](./nd-structure.md)
* [Linear algebra](./linear.md) - Matrices, operations and linear equations solving. To be moved to separate module. Currently supports basic
api and multiple library back-ends.
* [Histograms](./histograms.md) - Multidimensional histogram calculation and operations.
* [Expressions](./expressions.md)
* Commons math integration
* Koma integration

View File

@ -1,19 +0,0 @@
## Basic linear algebra layout
KMath support for linear algebra organized in a context-oriented way. Meaning that operations are in most cases declared
in context classes, and are not the members of classes that store data. This allows more flexible approach to maintain multiple
back-ends. The new operations added as extensions to contexts instead of being member functions of data structures.
Two major contexts used for linear algebra and hyper-geometry:
* `VectorSpace` forms a mathematical space on top of array-like structure (`Buffer` and its typealias `Point` used for geometry).
* `MatrixContext` forms a space-like context for 2d-structures. It does not store matrix size and therefore does not implement
`Space` interface (it is not possible to create zero element without knowing the matrix size).
## Vector spaces
## Matrix operations
## Back-end overview

86
docs/algebra.md Normal file
View File

@ -0,0 +1,86 @@
# Algebraic Structures and Algebraic Elements
The mathematical operations in KMath are generally separated from mathematical objects. This means that to perform an
operation, say `+`, one needs two objects of a type `T` and an algebra context, which draws appropriate operation up,
say `Group<T>`. Next one needs to run the actual operation in the context:
```kotlin
import space.kscience.kmath.operations.*
val a: T = ...
val b: T = ...
val group: Group<T> = ...
val c = group { a + b }
```
At first glance, this distinction seems to be a needless complication, but in fact one needs to remember that in
mathematics, one could draw up different operations on same objects. For example, one could use different types of
geometry for vectors.
## Algebraic Structures
Primary mathematical contexts have the following hierarchy:
`Field <: Ring <: Group <: Algebra`
These interfaces follow real algebraic structures:
- [Group](https://mathworld.wolfram.com/Group.html) defines addition, its identity element (i.e., 0) and additive
inverse (-x);
- [Ring](http://mathworld.wolfram.com/Ring.html) adds multiplication and its identity element (i.e., 1);
- [Field](http://mathworld.wolfram.com/Field.html) adds division operation.
A typical implementation of `Field<T>` is the `DoubleField` which works on doubles, and `VectorSpace` for `Space<T>`.
In some cases algebra context can hold additional operations like `exp` or `sin`, and then it inherits appropriate
interface. Also, contexts may have operations, which produce elements outside the context. For example, `Matrix.dot`
operation produces a matrix with new dimensions, which can be incompatible with initial matrix in linear operations.
## Spaces and Fields
KMath introduces contexts for builtin algebraic structures:
```kotlin
import space.kscience.kmath.operations.*
val c1 = Complex(1.0, 2.0)
val c2 = ComplexField.i
val c3 = c1 + c2
// or
val c3 = ComplexField { c1 + c2 }
```
Also, `ComplexField` features special operations to mix complex and real numbers, for example:
```kotlin
import space.kscience.kmath.operations.*
val c1 = Complex(1.0, 2.0)
val c2 = ComplexField { c1 - 1.0 } // Returns: Complex(re=0.0, im=2.0)
val c3 = ComplexField { c1 - i * 2.0 }
```
**Note**: In theory it is possible to add behaviors directly to the context, but as for now Kotlin does not support
that. Watch [KT-10468](https://youtrack.jetbrains.com/issue/KT-10468) and
[KEEP-176](https://github.com/Kotlin/KEEP/pull/176) for updates.
## Nested fields
Contexts allow one to build more complex structures. For example, it is possible to create a `Matrix` from complex
elements like so:
```kotlin
val element = NDElement.complex(shape = intArrayOf(2, 2)) { index: IntArray ->
Complex(index[0].toDouble() - index[1].toDouble(), index[0].toDouble() + index[1].toDouble())
}
```
The `element` in this example is a member of the `Field` of 2D structures, each element of which is a member of its own
`ComplexField`. It is important one does not need to create a special n-d class to hold complex numbers and implement
operations on it, one just needs to provide a field for its elements.
**Note**: Fields themselves do not solve the problem of JVM boxing, but it is possible to solve with special contexts
like
`MemorySpec`.

View File

@ -1,17 +1,20 @@
# Buffers
Buffer is one of main building blocks of kmath. It is a basic interface allowing random-access read and write (with `MutableBuffer`).
There are different types of buffers:
Buffer is one of main building blocks of kmath. It is a basic interface allowing random-access read and write (
with `MutableBuffer`). There are different types of buffers:
* Primitive buffers wrapping like `RealBuffer` which are wrapping primitive arrays.
* Primitive buffers wrapping like `DoubleBuffer` which are wrapping primitive arrays.
* Boxing `ListBuffer` wrapping a list
* Functionally defined `VirtualBuffer` which does not hold a state itself, but provides a function to calculate value
* `MemoryBuffer` allows direct allocation of objects in continuous memory block.
Some kmath features require a `BufferFactory` class to operate properly. A general convention is to use functions defined in
`Buffer` and `MutableBuffer` companion classes. For example factory `Buffer.Companion::auto` in most cases creates the most suitable
buffer for given reified type (for types with custom memory buffer it still better to use their own `MemoryBuffer.create()` factory).
Some kmath features require a `BufferFactory` class to operate properly. A general convention is to use functions
defined in
`Buffer` and `MutableBuffer` companion classes. For example factory `Buffer.Companion::auto` in most cases creates the
most suitable buffer for given reified type (for types with custom memory buffer it still better to use their
own `MemoryBuffer.create()` factory).
## Buffer performance
One should avoid using default boxing buffer wherever it is possible. Try to use primitive buffers or memory buffers instead
One should avoid using default boxing buffer wherever it is possible. Try to use primitive buffers or memory buffers
instead.

View File

@ -1,34 +1,35 @@
# Coding Conventions
KMath code follows general [Kotlin conventions](https://kotlinlang.org/docs/reference/coding-conventions.html), but
with a number of small changes and clarifications.
Generally, KMath code follows
general [Kotlin coding conventions](https://kotlinlang.org/docs/reference/coding-conventions.html), but with a number of
small changes and clarifications.
## Utility Class Naming
Filename should coincide with a name of one of the classes contained in the file or start with small letter and
describe its contents.
Filename should coincide with a name of one of the classes contained in the file or start with small letter and describe
its contents.
The code convention [here](https://kotlinlang.org/docs/reference/coding-conventions.html#source-file-names) says that
file names should start with a capital letter even if file does not contain classes. Yet starting utility classes and
The code convention [here](https://kotlinlang.org/docs/reference/coding-conventions.html#source-file-names) says that
file names should start with a capital letter even if file does not contain classes. Yet starting utility classes and
aggregators with a small letter seems to be a good way to visually separate those files.
This convention could be changed in future in a non-breaking way.
## Private Variable Naming
Private variables' names may start with underscore `_` for of the private mutable variable is shadowed by the public
Private variables' names may start with underscore `_` for of the private mutable variable is shadowed by the public
read-only value with the same meaning.
This rule does not permit underscores in names, but it is sometimes useful to "underscore" the fact that public and
This rule does not permit underscores in names, but it is sometimes useful to "underscore" the fact that public and
private versions draw up the same entity. It is allowed only for private variables.
This convention could be changed in future in a non-breaking way.
## Functions and Properties One-liners
Use one-liners when they occupy single code window line both for functions and properties with getters like
`val b: String get() = "fff"`. The same should be performed with multiline expressions when they could be
Use one-liners when they occupy single code window line both for functions and properties with getters like
`val b: String get() = "fff"`. The same should be performed with multiline expressions when they could be
cleanly separated.
There is no universal consensus whenever use `fun a() = ...` or `fun a() { return ... }`. Yet from reader outlook
There is no universal consensus whenever use `fun a() = ...` or `fun a() { return ... }`. Yet from reader outlook
one-lines seem to better show that the property or function is easily calculated.

73
docs/contexts.md Normal file
View File

@ -0,0 +1,73 @@
# Context-oriented mathematics
## The problem
A known problem for implementing mathematics in statically-typed languages (but not only in them) is that different sets
of mathematical operators can be defined on the same mathematical objects. Sometimes there is no single way to treat
some operations, including basic arithmetic operations, on a Java/Kotlin `Number`. Sometimes there are different ways to
define the same structure, such as Euclidean and elliptic geometry vector spaces over real vectors. Another problem
arises when one wants to add some kind of behavior to an existing entity. In dynamic languages those problems are
usually solved by adding dynamic context-specific behaviors at runtime, but this solution has a lot of drawbacks.
## Context-oriented approach
One possible solution to these problems is to divorce numerical representations from behaviors. For example in Kotlin
one can define a separate class representing some entity without any operations, ex. a complex number:
```kotlin
data class Complex(val re: Double, val im: Double)
```
And then to define a separate class or singleton, representing an operation on those complex numbers:
```kotlin
object ComplexOperations {
operator fun Complex.plus(other: Complex) = Complex(re + other.re, im + other.im)
operator fun Complex.minus(other: Complex) = Complex(re - other.re, im - other.im)
}
```
In Java, applying such external operations could be cumbersome, but Kotlin has a unique feature that allows us
implement this
naturally: [extensions with receivers](https://kotlinlang.org/docs/reference/extensions.html#extension-functions). In
Kotlin, an operation on complex number could be implemented as:
```kotlin
with(ComplexOperations) { c1 + c2 - c3 }
```
Kotlin also allows the creation of functions with receivers:
```kotlin
fun ComplexOperations.doSomethingWithComplex(c1: Complex, c2: Complex, c3: Complex) = c1 + c2 - c3
ComplexOperations.doComethingWithComplex(c1, c2, c3)
```
In fact, whole parts of a program may be run within a mathematical context or even multiple nested contexts.
In KMath, contexts are not only responsible for operations, but also for raw object creation and advanced features.
## Other possibilities
### Type classes
An obvious candidate to get more or less the same functionality is the type class, which allows one to bind a behavior
to a specific type without modifying the type itself. On the plus side, type classes do not require explicit context
declaration, so the code looks cleaner. On the minus side, if there are different sets of behaviors for the same types,
it is impossible to combine them into one module. Also, unlike type classes, context can have parameters or even state.
For example in KMath, sizes and strides for `NDElement` or `Matrix` could be moved to context to optimize performance in
case of a large amount of structures.
### Wildcard imports and importing-on-demand
Sometimes, one may wish to use a single context throughout a file. In this case, is possible to import all members from
a package or file, via `import context.complex.*`. Effectively, this is the same as enclosing an entire file with a
single context. However, when using multiple contexts, this technique can introduce operator ambiguity, due to namespace
pollution. If there are multiple scoped contexts that define the same operation, it is still possible to import
specific operations as needed, without using an explicit context with extension functions, for example:
```
import context.complex.op1
import context.quaternion.op2
```

1020
docs/diagrams/core.puml Normal file

File diff suppressed because it is too large Load Diff

24
docs/expressions.md Normal file
View File

@ -0,0 +1,24 @@
# Expressions
Expressions is a feature, which allows constructing lazily or immediately calculated parametric mathematical
expressions.
The potential use-cases for it (so far) are following:
* lazy evaluation (in general simple lambda is better, but there are some border cases);
* automatic differentiation in single-dimension and in multiple dimensions;
* generation of mathematical syntax trees with subsequent code generation for other languages;
* symbolic computations, especially differentiation (and some other actions with `kmath-symja` integration with
Symja's `IExpr`&mdash;integration, simplification, and more);
* visualization with `kmath-jupyter`.
The workhorse of this API is `Expression` interface, which exposes
single `operator fun invoke(arguments: Map<Symbol, T>): T`
method. `ExpressionAlgebra` is used to generate expressions and introduce variables.
Currently there are two implementations:
* Generic `ExpressionField` in `kmath-core` which allows construction of custom lazy expressions
* Auto-differentiation expression in `kmath-commons` module allows using full power of `DerivativeStructure`
from commons-math. **TODO: add example**

67
docs/images/KM.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 249 KiB

62
docs/images/KM_mono.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

101
docs/images/KMath.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 278 KiB

397
docs/images/KMath_mono.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 118 KiB

36
docs/linear.md Normal file
View File

@ -0,0 +1,36 @@
## Basic linear algebra layout
KMath support for linear algebra organized in a context-oriented way, which means that operations are in most cases
declared in context classes, and are not the members of classes that store data. This allows more flexible approach to
maintain multiple back-ends. The new operations added as extensions to contexts instead of being member functions of
data structures.
The main context for linear algebra over matrices and vectors is `LinearSpace`, which defines addition and dot products
of matrices and vectors:
```kotlin
import space.kscience.kmath.linear.*
LinearSpace.Companion.real {
val vec = buildVector(10) { i -> i.toDouble() }
val mat = buildMatrix(10, 10) { i, j -> i.toDouble() + j }
// Addition
vec + vec
mat + mat
// Multiplication by scalar
vec * 2.0
mat * 2.0
// Dot product
mat dot vec
mat dot mat
}
```
## Backends overview
### EJML
### Commons Math

View File

@ -8,38 +8,45 @@ One of the most sought after features of mathematical libraries is the high-perf
structures. In `kmath` performance depends on which particular context was used for operation.
Let us consider following contexts:
```kotlin
// automatically build context most suited for given type.
val autoField = NDField.auto(RealField, dim, dim)
// specialized nd-field for Double. It works as generic Double field as well
val autoField = NDField.auto(DoubleField, dim, dim)
// specialized nd-field for Double. It works as generic Double field as well.
val specializedField = NDField.real(dim, dim)
//A generic boxing field. It should be used for objects, not primitives.
val genericField = NDField.buffered(RealField, dim, dim)
val genericField = NDField.buffered(DoubleField, dim, dim)
```
Now let us perform several tests and see which implementation is best suited for each case:
Now let us perform several tests and see, which implementation is best suited for each case:
## Test case
In order to test performance we will take 2d-structures with `dim = 1000` and add a structure filled with `1.0`
To test performance we will take 2d-structures with `dim = 1000` and add a structure filled with `1.0`
to it `n = 1000` times.
## Specialized
The code to run this looks like:
```kotlin
specializedField.run {
var res: NDBuffer<Double> = one
var res: NDBuffer<Float64> = one
repeat(n) {
res += 1.0
}
}
```
The performance of this code is the best of all tests since it inlines all operations and is specialized for operation
with doubles. We will measure everything else relative to this one, so time for this test will be `1x` (real time
on my computer is about 4.5 seconds). The only problem with this approach is that it requires to specify type
from the beginning. Everyone do so anyway, so it is the recommended approach.
on my computer is about 4.5 seconds). The only problem with this approach is that it requires specifying type
from the beginning. Everyone does so anyway, so it is the recommended approach.
## Automatic
Let's do the same with automatic field inference:
```kotlin
autoField.run {
var res = one
@ -48,13 +55,16 @@ Let's do the same with automatic field inference:
}
}
```
Ths speed of this operation is approximately the same as for specialized case since `NDField.auto` just
returns the same `RealNDField` in this case. Of course it is usually better to use specialized method to be sure.
returns the same `RealNDField` in this case. Of course, it is usually better to use specialized method to be sure.
## Lazy
Lazy field does not produce a structure when asked, instead it generates an empty structure and fills it on-demand
using coroutines to parallelize computations.
When one calls
```kotlin
lazyField.run {
var res = one
@ -63,12 +73,14 @@ When one calls
}
}
```
The result will be calculated almost immediately but the result will be empty. In order to get the full result
The result will be calculated almost immediately but the result will be empty. To get the full result
structure one needs to call all its elements. In this case computation overhead will be huge. So this field never
should be used if one expects to use the full result structure. Though if one wants only small fraction, it could
save a lot of time.
This field still could be used with reasonable performance if call code is changed:
```kotlin
lazyField.run {
val res = one.map {
@ -82,30 +94,37 @@ This field still could be used with reasonable performance if call code is chang
res.elements().forEach { it.second }
}
```
In this case it completes in about `4x-5x` time due to boxing.
## Boxing
The boxing field produced by
```kotlin
genericField.run {
var res: NDBuffer<Double> = one
var res: NDBuffer<Float64> = one
repeat(n) {
res += 1.0
}
}
```
obviously is the slowest one, because it requires to box and unbox the `double` on each operation. It takes about
is the slowest one, because it requires boxing and unboxing the `double` on each operation. It takes about
`15x` time (**TODO: there seems to be a problem here, it should be slow, but not that slow**). This field should
never be used for primitives.
## Element operation
Let us also check the speed for direct operations on elements:
```kotlin
var res = genericField.one
repeat(n) {
res += 1.0
}
```
One would expect to be at least as slow as field operation, but in fact, this one takes only `2x` time to complete.
It happens, because in this particular case it does not use actual `NDField` but instead calculated directly
via extension function.
@ -114,13 +133,18 @@ via extension function.
Usually it is bad idea to compare the direct numerical operation performance in different languages, but it hard to
work completely without frame of reference. In this case, simple numpy code:
```python
import numpy as np
res = np.ones((1000,1000))
for i in range(1000):
res = res + 1.0
```
gives the completion time of about `1.1x`, which means that specialized kotlin code in fact is working faster (I think it is
gives the completion time of about `1.1x`, which means that specialized kotlin code in fact is working faster (I think
it is
because better memory management). Of course if one writes `res += 1.0`, the performance will be different,
but it would be differenc case, because numpy overrides `+=` with in-place operations. In-place operations are
but it would be different case, because numpy overrides `+=` with in-place operations. In-place operations are
available in `kmath` with `MutableNDStructure` but there is no field for it (one can still work with mapping
functions).

223
docs/polynomials.md Normal file
View File

@ -0,0 +1,223 @@
# Polynomials and Rational Functions
KMath provides a way to work with uni- and multivariate polynomials and rational functions. It includes full support of
arithmetic operations of integers, **constants** (elements of ring polynomials are build over), variables (for certain
multivariate implementations), polynomials and rational functions encapsulated in so-called **polynomial space** and *
*rational function space** and some other utilities such as algebraic differentiation and substitution.
## Concrete realizations
There are 3 approaches to represent polynomials:
1. For univariate polynomials one can represent and store polynomial as a list of coefficients for each power of the
variable. I.e. polynomial $a_0 + \dots + a_n x^n $ can be represented as a finite sequence $(a_0; \dots; a_n)$. (
Compare to sequential definition of polynomials.)
2. For multivariate polynomials one can represent and store polynomial as a matching (in programming it is called "map"
or "dictionary", in math it is
called [functional relation](https://en.wikipedia.org/wiki/Binary_relation#Special_types_of_binary_relations)) of
each "**term signature**" (that describes what variables and in what powers appear in the term) with corresponding
coefficient of the term. But there are 2 possible approaches of term signature representation:
1. One can number all the variables, so term signature can be represented as a sequence describing powers of the
variables. I.e. signature of term $c \\; x_0^{d_0} \dots x_n^{d_n} $ (for natural or zero $d_i $) can be
represented as a finite sequence $(d_0; \dots; d_n)$.
2. One can represent variables as objects ("**labels**"), so term signature can be also represented as a matching of
each appeared variable with its power in the term. I.e. signature of term $c \\; x_0^{d_0} \dots x_n^{d_n} $ (for
natural non-zero $d_i $) can be represented as a finite matching $(x_0 \to d_1; \dots; x_n \to d_n)$.
All that three approaches are implemented by "list", "numbered", and "labeled" versions of polynomials and polynomial
spaces respectively. Whereas all rational functions are represented as fractions with corresponding polynomial numerator
and denominator, and rational functions' spaces are implemented in the same way as usual field of rational numbers (or
more precisely, as any field of fractions over integral domain) should be implemented.
So here are a bit of details. Let `C` by type of constants. Then:
1. `ListPolynomial`, `ListPolynomialSpace`, `ListRationalFunction` and `ListRationalFunctionSpace` implement the first
scenario. `ListPolynomial` stores polynomial $a_0 + \dots + a_n x^n $ as a coefficients
list `listOf(a_0, ..., a_n)` (of type `List<C>`).
They also have variation `ScalableListPolynomialSpace` that replaces former polynomials and
implements `ScaleOperations`.
2. `NumberedPolynomial`, `NumberedPolynomialSpace`, `NumberedRationalFunction` and `NumberedRationalFunctionSpace`
implement second scenario. `NumberedPolynomial` stores polynomials as structures of type `Map<List<UInt>, C>`.
Signatures are stored as `List<UInt>`. To prevent ambiguity signatures should not end with zeros.
3. `LabeledPolynomial`, `LabeledPolynomialSpace`, `LabeledRationalFunction` and `LabeledRationalFunctionSpace` implement
third scenario using common `Symbol` as variable type. `LabeledPolynomial` stores polynomials as structures of
type `Map<Map<Symbol, UInt>, C>`. Signatures are stored as `Map<Symbol, UInt>`. To prevent ambiguity each signature
should not map any variable to zero.
### Example: `ListPolynomial`
For example, polynomial $2 - 3x + x^2 $ (with `Int` coefficients) is represented
```kotlin
val polynomial: ListPolynomial<Int> = ListPolynomial(listOf(2, -3, 1))
// or
val polynomial: ListPolynomial<Int> = ListPolynomial(2, -3, 1)
```
All algebraic operations can be used in corresponding space:
```kotlin
val computationResult = Int.algebra.listPolynomialSpace {
ListPolynomial(2, -3, 1) + ListPolynomial(0, 6) == ListPolynomial(2, 3, 1)
}
println(computationResult) // true
```
For more see [examples](../examples/src/main/kotlin/space/kscience/kmath/functions/polynomials.kt).
### Example: `NumberedPolynomial`
For example, polynomial $3 + 5 x_1 - 7 x_0^2 x_2 $ (with `Int` coefficients) is represented
```kotlin
val polynomial: NumberedPolynomial<Int> = NumberedPolynomial(
mapOf(
listOf<UInt>() to 3,
listOf(0u, 1u) to 5,
listOf(2u, 0u, 1u) to -7,
)
)
// or
val polynomial: NumberedPolynomial<Int> = NumberedPolynomial(
listOf<UInt>() to 3,
listOf(0u, 1u) to 5,
listOf(2u, 0u, 1u) to -7,
)
```
All algebraic operations can be used in corresponding space:
```kotlin
val computationResult = Int.algebra.numberedPolynomialSpace {
NumberedPolynomial(
listOf<UInt>() to 3,
listOf(0u, 1u) to 5,
listOf(2u, 0u, 1u) to -7,
) + NumberedPolynomial(
listOf(0u, 1u) to -5,
listOf(0u, 0u, 0u, 4u) to 4,
) == NumberedPolynomial(
listOf<UInt>() to 3,
listOf(0u, 1u) to 0,
listOf(2u, 0u, 1u) to -7,
listOf(0u, 0u, 0u, 4u) to 4,
)
}
println(computationResult) // true
```
For more see [examples](../examples/src/main/kotlin/space/kscience/kmath/functions/polynomials.kt).
### Example: `LabeledPolynomial`
For example, polynomial $3 + 5 y - 7 x^2 z $ (with `Int` coefficients) is represented
```kotlin
val polynomial: LabeledPolynomial<Int> = LabeledPolynomial(
mapOf(
mapOf<Symbol, UInt>() to 3,
mapOf(y to 1u) to 5,
mapOf(x to 2u, z to 1u) to -7,
)
)
// or
val polynomial: LabeledPolynomial<Int> = LabeledPolynomial(
mapOf<Symbol, UInt>() to 3,
mapOf(y to 1u) to 5,
mapOf(x to 2u, z to 1u) to -7,
)
```
All algebraic operations can be used in corresponding space:
```kotlin
val computationResult = Int.algebra.labeledPolynomialSpace {
LabeledPolynomial(
listOf<UInt>() to 3,
listOf(0u, 1u) to 5,
listOf(2u, 0u, 1u) to -7,
) + LabeledPolynomial(
listOf(0u, 1u) to -5,
listOf(0u, 0u, 0u, 4u) to 4,
) == LabeledPolynomial(
listOf<UInt>() to 3,
listOf(0u, 1u) to 0,
listOf(2u, 0u, 1u) to -7,
listOf(0u, 0u, 0u, 4u) to 4,
)
}
println(computationResult) // true
```
For more see [examples](../examples/src/main/kotlin/space/kscience/kmath/functions/polynomials.kt).
## Abstract entities (interfaces and abstract classes)
```mermaid
classDiagram
Polynomial <|-- ListPolynomial
Polynomial <|-- NumberedPolynomial
Polynomial <|-- LabeledPolynomial
RationalFunction <|-- ListRationalFunction
RationalFunction <|-- NumberedRationalFunction
RationalFunction <|-- LabeledRationalFunction
Ring <|-- PolynomialSpace
PolynomialSpace <|-- MultivariatePolynomialSpace
PolynomialSpace <|-- PolynomialSpaceOverRing
Ring <|-- RationalFunctionSpace
RationalFunctionSpace <|-- MultivariateRationalFunctionSpace
RationalFunctionSpace <|-- RationalFunctionSpaceOverRing
RationalFunctionSpace <|-- RationalFunctionSpaceOverPolynomialSpace
RationalFunctionSpace <|-- PolynomialSpaceOfFractions
RationalFunctionSpaceOverPolynomialSpace <|-- MultivariateRationalFunctionSpaceOverMultivariatePolynomialSpace
MultivariateRationalFunctionSpace <|-- MultivariateRationalFunctionSpaceOverMultivariatePolynomialSpace
MultivariateRationalFunctionSpace <|-- MultivariatePolynomialSpaceOfFractions
PolynomialSpaceOfFractions <|-- MultivariatePolynomialSpaceOfFractions
```
There are implemented `Polynomial` and `RationalFunction` interfaces as abstractions of polynomials and rational
functions respectively (although, there is not a lot of logic in them) and `PolynomialSpace`
and `RationalFunctionSpace` (that implement `Ring` interface) as abstractions of polynomials' and rational functions'
spaces respectively. More precisely, that means they allow to declare common logic of interaction with such objects and
spaces:
- `Polynomial` does not provide any logic. It is marker interface.
- `RationalFunction` provides numerator and denominator of rational function and destructuring declaration for them.
- `PolynomialSpace` provides all possible arithmetic interactions of integers, constants (of type `C`), and
polynomials (of type `P`) like addition, subtraction, multiplication, and some others and common properties like
degree of polynomial.
- `RationalFunctionSpace` provides the same as `PolynomialSpace` but also for rational functions: all possible
arithmetic interactions of integers, constants (of type `C`), polynomials (of type `P`), and rational functions (of
type `R`) like addition, subtraction, multiplication, division (in some cases), and some others and common properties
like degree of polynomial.
Then to add abstraction of similar behaviour with variables (in multivariate case) there are
implemented `MultivariatePolynomialSpace` and `MultivariateRationalFunctionSpace`. They just include variables (of
type `V`) in the interactions of the entities.
Also, to remove boilerplates there were provided helping subinterfaces and abstract subclasses:
- `PolynomialSpaceOverRing` allows to replace implementation of interactions of integers and constants with
implementations from provided ring over constants (of type `A: Ring<C>`).
- `RationalFunctionSpaceOverRing` &mdash; the same but for `RationalFunctionSpace`.
- `RationalFunctionSpaceOverPolynomialSpace` &mdash; the same but "the inheritance" includes interactions with
polynomials from provided `PolynomialSpace`.
- `PolynomialSpaceOfFractions` is actually abstract subclass of `RationalFunctionSpace` that implements all fractions
boilerplates with provided (`protected`) constructor of rational functions by polynomial numerator and denominator.
- `MultivariateRationalFunctionSpaceOverMultivariatePolynomialSpace` and `MultivariatePolynomialSpaceOfFractions`
&mdash; the same stories of operators inheritance and fractions boilerplates respectively but in multivariate case.
## Utilities
For all kinds of polynomials there are provided (implementation details depend on kind of polynomials) such common
utilities as:
1. differentiation and anti-differentiation,
2. substitution, invocation and functional representation.

14
docs/readme.md Normal file
View File

@ -0,0 +1,14 @@
# Documentation
* [Algebra](algebra.md): [context-based](contexts.md) operations on different primitives and structures.
* [NDStructures](nd-structure.md)
* [Linear algebra](linear.md): matrices, operations and linear equations solving. To be moved to separate module.
Currently, supports basic API and multiple library back-ends.
* [Histograms](histograms.md): multidimensional histogram calculation and operations.
* [Expressions](expressions.md)
* Commons math integration

16
docs/templates/ARTIFACT-TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,16 @@
## Artifact:
The Maven coordinates of this project are `${group}:${name}:${version}`.
**Gradle:**
```kotlin
repositories {
maven("https://repo.kotlin.link")
mavenCentral()
}
dependencies {
implementation("${group}:${name}:${version}")
}
```

109
docs/templates/README-TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,109 @@
[![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![DOI](https://zenodo.org/badge/129486382.svg)](https://zenodo.org/badge/latestdoi/129486382)
![Gradle build](https://github.com/SciProgCentre/kmath/workflows/Gradle%20build/badge.svg)
[![Maven Central](https://img.shields.io/maven-central/v/space.kscience/kmath-core.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22)
[![Space](https://img.shields.io/badge/dynamic/xml?color=orange&label=Space&query=//metadata/versioning/latest&url=https%3A%2F%2Fmaven.pkg.jetbrains.space%2Fmipt-npm%2Fp%2Fsci%2Fmaven%2Fspace%2Fkscience%2Fkmath-core%2Fmaven-metadata.xml)](https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven/space/kscience/)
# KMath
Could be pronounced as `key-math`. The **K**otlin **Math**ematics library was initially intended as a Kotlin-based
analog to Python's NumPy library. Later we found that kotlin is much more flexible language and allows superior
architecture designs. In contrast to `numpy` and `scipy` it is modular and has a lightweight core. The `numpy`-like
experience could be achieved with [kmath-for-real](/kmath-for-real) extension module.
[Documentation site](https://SciProgCentre.github.io/kmath/)
## Publications and talks
* [A conceptual article about context-oriented design](https://proandroiddev.com/an-introduction-context-oriented-programming-in-kotlin-2e79d316b0a2)
* [Another article about context-oriented design](https://proandroiddev.com/diving-deeper-into-context-oriented-programming-in-kotlin-3ecb4ec38814)
* [ACAT 2019 conference paper](https://aip.scitation.org/doi/abs/10.1063/1.5130103)
* [A talk at KotlinConf 2019 about using kotlin for science](https://youtu.be/LI_5TZ7tnOE?si=4LknX41gl_YeUbIe)
* [A talk on architecture at Joker-2021 (in Russian)](https://youtu.be/1bZ2doHiRRM?si=9w953ro9yu98X_KJ)
* [The same talk in English](https://youtu.be/yP5DIc2fVwQ?si=louZzQ1dcXV6gP10)
* [A seminar on tensor API](https://youtu.be/0H99wUs0xTM?si=6c__04jrByFQtVpo)
# Goal
* Provide a flexible and powerful API to work with mathematics abstractions in Kotlin-multiplatform (JVM, JS, Native and
Wasm).
* Provide basic multiplatform implementations for those abstractions (without significant performance optimization).
* Provide bindings and wrappers with those abstractions for popular optimized platform libraries.
## Non-goals
* Be like NumPy. It was the idea at the beginning, but we decided that we can do better in API.
* Provide the best performance out of the box. We have specialized libraries for that. Need only API wrappers for them.
* Cover all cases as immediately and in one bundle. We will modularize everything and add new features gradually.
* Provide specialized behavior in the core. API is made generic on purpose, so one needs to specialize for types, like
for `Double` in the core. For that we will have specialization modules like `kmath-for-real`, which will give better
experience for those, who want to work with specific types.
## Features and stability
KMath is a modular library. Different modules provide different features with different API stability guarantees. All
core modules are released with the same version, but with different API change policy. The features are described in
module definitions below. The module stability could have the following levels:
* **PROTOTYPE**. On this level there are no compatibility guarantees. All methods and classes form those modules could
break any moment. You can still use it, but be sure to fix the specific version.
* **EXPERIMENTAL**. The general API is decided, but some changes could be made. Volatile API is marked
with `@UnstableKMathAPI` or other stability warning annotations.
* **DEVELOPMENT**. API breaking generally follows semantic versioning ideology. There could be changes in minor
versions, but not in patch versions. API is protected
with [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) tool.
* **STABLE**. The API stabilized. Breaking changes are allowed only in major releases.
## Modules
${modules}
## Multi-platform support
KMath is developed as a multi-platform library, which means that most of the interfaces are declared in the
[common source sets](/kmath-core/src/commonMain) and implemented there wherever it is possible. In some cases, features
are delegated to platform-specific implementations even if they could be provided in the common module for performance
reasons. Currently, Kotlin/JVM is the primary platform, however, Kotlin/Native and Kotlin/JS contributions and
feedback are also welcome.
## Performance
Calculation of performance is one of the major goals of KMath in the future, but in some cases it is impossible to
achieve both
performance and flexibility.
We expect to focus on creating a convenient universal API first and then work on increasing performance for specific
cases. We expect the worst KMath benchmarks will perform better than native Python, but worse than optimized
native/SciPy (mostly due to boxing operations on primitive numbers). The best performance of optimized parts could be
better than SciPy.
## Requirements
KMath currently relies on JDK 11 for compilation and execution of Kotlin-JVM part. We recommend using GraalVM-CE or
Oracle GraalVM for execution to get better performance.
### Repositories
Release and development artifacts are accessible from mipt-npm [Space](https://www.jetbrains.com/space/)
repository `https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven` (see documentation of
[Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) for more details). The repository could
be reached through [repo.kotlin.link](https://repo.kotlin.link) proxy:
```kotlin
repositories {
maven("https://repo.kotlin.link")
}
dependencies {
api("${group}:kmath-core:$version")
// api("${group}:kmath-core-jvm:$version") for jvm-specific version
}
```
## Contributing
The project requires a lot of additional work. The most important thing we need is feedback about what features are
required the most. Feel free to create feature requests. We are also welcome to code contributions, especially in issues
marked
with [good first issue](hhttps://github.com/SciProgCentre/kmath/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
label.

4
examples/README.md Normal file
View File

@ -0,0 +1,4 @@
# Module examples

View File

@ -1,74 +1,75 @@
import org.jetbrains.kotlin.allopen.gradle.AllOpenExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
java
kotlin("jvm")
kotlin("plugin.allopen") version "1.3.72"
id("kotlinx.benchmark") version "0.2.0-dev-8"
}
configure<AllOpenExtension> {
annotation("org.openjdk.jmh.annotations.State")
}
repositories {
maven("http://dl.bintray.com/kyonifer/maven")
maven("https://dl.bintray.com/mipt-npm/scientifik")
maven("https://dl.bintray.com/mipt-npm/dev")
mavenCentral()
}
sourceSets {
register("benchmarks")
maven("https://repo.kotlin.link")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
}
dependencies {
implementation(project(":kmath-ast"))
implementation(project(":kmath-kotlingrad"))
implementation(project(":kmath-core"))
implementation(project(":kmath-coroutines"))
implementation(project(":kmath-commons"))
implementation(project(":kmath-prob"))
implementation(project(":kmath-koma"))
implementation(project(":kmath-complex"))
implementation(project(":kmath-functions"))
implementation(project(":kmath-optimization"))
implementation(project(":kmath-stat"))
implementation(project(":kmath-viktor"))
implementation(project(":kmath-dimensions"))
implementation(project(":kmath-bignum"))
implementation(project(":kmath-memory"))
implementation("com.kyonifer:koma-core-ejml:0.12")
implementation("org.jetbrains.kotlinx:kotlinx-io-jvm:0.2.0-npm-dev-6")
implementation("org.slf4j:slf4j-simple:1.7.30")
"benchmarksImplementation"("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:0.2.0-dev-8")
"benchmarksImplementation"(sourceSets.main.get().output.plus(sourceSets.main.get().runtimeClasspath))
implementation(project(":kmath-ejml"))
implementation(project(":kmath-nd4j"))
implementation(project(":kmath-tensors"))
implementation(project(":kmath-symja"))
implementation(project(":kmath-for-real"))
//jafama
implementation(project(":kmath-jafama"))
//multik
implementation(project(":kmath-multik"))
implementation(libs.multik.default)
//datetime
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
implementation("org.nd4j:nd4j-native:1.0.0-beta7")
// uncomment if your system supports AVX2
// val os = System.getProperty("os.name")
//
// if (System.getProperty("os.arch") in arrayOf("x86_64", "amd64")) when {
// os.startsWith("Windows") -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:windows-x86_64-avx2")
// os == "Linux" -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:linux-x86_64-avx2")
// os == "Mac OS X" -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:macosx-x86_64-avx2")
// } else
implementation("org.nd4j:nd4j-native-platform:1.0.0-beta7")
implementation("org.slf4j:slf4j-simple:1.7.32")
// plotting
implementation("space.kscience:plotlykt-server:0.7.0")
}
// Configure benchmark
benchmark {
// Setup configurations
targets {
// This one matches sourceSet name above
register("benchmarks")
}
configurations {
register("fast") {
warmups = 5 // number of warmup iterations
iterations = 3 // number of iterations
iterationTime = 500 // time in seconds per iteration
iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds
kotlin {
jvmToolchain(11)
sourceSets.all {
languageSettings {
optIn("kotlin.contracts.ExperimentalContracts")
optIn("kotlin.ExperimentalUnsignedTypes")
optIn("space.kscience.kmath.UnstableKMathAPI")
}
}
}
kotlin.sourceSets.all {
with(languageSettings) {
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
tasks.withType<KotlinJvmCompile> {
compilerOptions {
freeCompilerArgs.addAll("-Xjvm-default=all", "-Xopt-in=kotlin.RequiresOptIn", "-Xlambdas=indy")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = Scientifik.JVM_TARGET.toString()
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
}
readme {
maturity = space.kscience.gradle.Maturity.EXPERIMENTAL
}

View File

@ -0,0 +1,418 @@
{
"cells": [
{
"cell_type": "code",
"source": [
"%use kmath(0.3.1-dev-5)\n",
"%use plotly(0.5.0)\n",
"@file:DependsOn(\"space.kscience:kmath-commons:0.3.1-dev-5\")"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "lQbSB87rNAn9lV6poArVWW",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "code",
"source": [
"//Uncomment to work in Jupyter classic or DataLore\n",
"//Plotly.jupyter.notebook()"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "0UP158hfccGgjQtHz0wAi6",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "markdown",
"source": [
"# The model\n",
"\n",
"Defining the input data format, the statistic abstraction and the statistic implementation based on a weighted sum of elements."
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"class XYValues(val xValues: DoubleArray, val yValues: DoubleArray) {\n",
" init {\n",
" require(xValues.size == yValues.size)\n",
" }\n",
"}\n",
"\n",
"fun interface XYStatistic {\n",
" operator fun invoke(values: XYValues): Double\n",
"}\n",
"\n",
"class ConvolutionalXYStatistic(val weights: DoubleArray) : XYStatistic {\n",
" override fun invoke(values: XYValues): Double {\n",
" require(weights.size == values.yValues.size)\n",
" val norm = values.yValues.sum()\n",
" return values.yValues.zip(weights) { value, weight -> value * weight }.sum()/norm\n",
" }\n",
"}"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "Zhgz1Ui91PWz0meJiQpHol",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "markdown",
"source": [
"# Generator\n",
"Generate sample data for parabolas and hyperbolas"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"fun generateParabolas(xValues: DoubleArray, a: Double, b: Double, c: Double): XYValues {\n",
" val yValues = xValues.map { x -> a * x * x + b * x + c }.toDoubleArray()\n",
" return XYValues(xValues, yValues)\n",
"}\n",
"\n",
"fun generateHyperbols(xValues: DoubleArray, gamma: Double, x0: Double, y0: Double): XYValues {\n",
" val yValues = xValues.map { x -> y0 + gamma / (x - x0) }.toDoubleArray()\n",
" return XYValues(xValues, yValues)\n",
"}"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"val xValues = (1.0..10.0).step(1.0).toDoubleArray()\n",
"\n",
"val xy = generateHyperbols(xValues, 1.0, 0.0, 0.0)\n",
"\n",
"Plotly.plot {\n",
" scatter {\n",
" this.x.doubles = xValues\n",
" this.y.doubles = xy.yValues\n",
" }\n",
"}"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "ZE2atNvFzQsCvpAF8KK4ch",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "markdown",
"source": [
"Create a default statistic with uniform weights"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"val statistic = ConvolutionalXYStatistic(DoubleArray(xValues.size){1.0})\n",
"statistic(xy)"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "EA5HaydTddRKYrtAUwd29h",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "code",
"source": [
"import kotlin.random.Random\n",
"\n",
"val random = Random(1288)\n",
"\n",
"val parabolas = buildList{\n",
" repeat(500){\n",
" add(\n",
" generateParabolas(\n",
" xValues, \n",
" random.nextDouble(), \n",
" random.nextDouble(), \n",
" random.nextDouble()\n",
" )\n",
" )\n",
" }\n",
"}\n",
"\n",
"val hyperbolas: List<XYValues> = buildList{\n",
" repeat(500){\n",
" add(\n",
" generateHyperbols(\n",
" xValues, \n",
" random.nextDouble()*10, \n",
" random.nextDouble(), \n",
" random.nextDouble()\n",
" )\n",
" )\n",
" }\n",
"}"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "t5t6IYmD7Q1ykeo9uijFfQ",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "code",
"source": [
"Plotly.plot { \n",
" scatter { \n",
" x.doubles = xValues\n",
" y.doubles = parabolas[257].yValues\n",
" }\n",
" scatter { \n",
" x.doubles = xValues\n",
" y.doubles = hyperbolas[252].yValues\n",
" }\n",
" }"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "oXB8lmju7YVYjMRXITKnhO",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "code",
"source": [
"Plotly.plot { \n",
" histogram { \n",
" name = \"parabolae\"\n",
" x.numbers = parabolas.map { statistic(it) }\n",
" }\n",
" histogram { \n",
" name = \"hyperbolae\"\n",
" x.numbers = hyperbolas.map { statistic(it) }\n",
" }\n",
"}"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "8EIIecUZrt2NNrOkhxG5P0",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "code",
"source": [
"val lossFunction: (XYStatistic) -> Double = { statistic ->\n",
" - abs(parabolas.sumOf { statistic(it) } - hyperbolas.sumOf { statistic(it) })\n",
"}"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "h7UmglJW5zXkAfKHK40oIL",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "markdown",
"source": [
"Using commons-math optimizer to optimize weights"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"import org.apache.commons.math3.optim.*\n",
"import org.apache.commons.math3.optim.nonlinear.scalar.*\n",
"import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.*\n",
"\n",
"val optimizer = SimplexOptimizer(1e-1, Double.MAX_VALUE)\n",
"\n",
"val result = optimizer.optimize(\n",
" ObjectiveFunction { point ->\n",
" lossFunction(ConvolutionalXYStatistic(point))\n",
" },\n",
" NelderMeadSimplex(xValues.size),\n",
" InitialGuess(DoubleArray(xValues.size){ 1.0 }),\n",
" GoalType.MINIMIZE,\n",
" MaxEval(100000)\n",
")"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "0EG3K4aCUciMlgGQKPvJ57",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "markdown",
"source": [
"Print resulting weights of optimization"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"result.point"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "LelUlY0ZSlJEO9yC6SLk5B",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "code",
"source": [
"Plotly.plot { \n",
" scatter { \n",
" y.doubles = result.point\n",
" }\n",
"}"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "AuFOq5t9KpOIkGrOLsVXNf",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "markdown",
"source": [
"# The resulting statistic distribution"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"val resultStatistic = ConvolutionalXYStatistic(result.point)\n",
"Plotly.plot { \n",
" histogram { \n",
" name = \"parabolae\"\n",
" x.numbers = parabolas.map { resultStatistic(it) }\n",
" }\n",
" histogram { \n",
" name = \"hyperbolae\"\n",
" x.numbers = hyperbolas.map { resultStatistic(it) }\n",
" }\n",
"}"
],
"execution_count": null,
"outputs": [],
"metadata": {
"datalore": {
"node_id": "zvmq42DRdM5mZ3SpzviHwI",
"type": "CODE",
"hide_input_from_viewers": false,
"hide_output_from_viewers": false
}
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
}
}
],
"metadata": {
"kernelspec": {
"display_name": "Kotlin",
"language": "kotlin",
"name": "kotlin"
},
"datalore": {
"version": 1,
"computation_mode": "JUPYTER",
"package_manager": "pip",
"base_environment": "default",
"packages": []
}
},
"nbformat": 4,
"nbformat_minor": 4
}

View File

@ -1,41 +0,0 @@
package scientifik.kmath.bignum
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.JBigDecimalField
import scientifik.kmath.operations.invoke
import kotlin.random.Random
@State(Scope.Benchmark)
class BigDecimalBenchmark {
final var times: Int = 10000
@Benchmark
fun java() {
val random = Random(0)
var sum = JBigDecimalField.zero
repeat(times) {
sum += JBigDecimalField {
number(random.nextDouble(-1000000000.0, 1000000000.0)) / random.nextDouble(-1000000.0, 1000000.0)
}
}
println("java:$sum")
}
@Benchmark
fun bignum() {
val random = Random(0)
var sum = BigDecimalField.zero
repeat(times) {
sum += BigDecimalField {
number(random.nextDouble(-1000000000.0, 1000000000.0)) / random.nextDouble(-1000000.0, 1000000.0)
}
}
println("bignum:$sum")
}
}

View File

@ -1,38 +0,0 @@
package scientifik.kmath.bignum
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.BigIntField
import scientifik.kmath.operations.JBigIntegerField
import scientifik.kmath.operations.invoke
import kotlin.random.Random
@State(Scope.Benchmark)
class BigIntegerBenchmark {
final var times: Int = 1000000
@Benchmark
fun java() {
val random = Random(0)
var sum = JBigIntegerField.zero
repeat(times) { sum += JBigIntegerField { number(random.nextInt()) * random.nextInt() } }
println("java:$sum")
}
@Benchmark
fun bignum() {
val random = Random(0)
var sum = BigIntegerRing.zero
repeat(times) { sum += BigIntegerRing { number(random.nextInt()) * random.nextInt() } }
println("bignum:$sum")
}
@Benchmark
fun bigint() {
val random = Random(0)
var sum = BigIntField.zero
repeat(times) { sum += BigIntField { number(random.nextInt()) * random.nextInt() } }
println("bigint:$sum")
}
}

View File

@ -1,48 +0,0 @@
package scientifik.kmath.structures
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import java.nio.IntBuffer
@State(Scope.Benchmark)
class ArrayBenchmark {
@Benchmark
fun benchmarkArrayRead() {
var res = 0
for (i in 1..size) {
res += array[size - i]
}
}
@Benchmark
fun benchmarkBufferRead() {
var res = 0
for (i in 1..size) {
res += arrayBuffer.get(size - i)
}
}
@Benchmark
fun nativeBufferRead() {
var res = 0
for (i in 1..size) {
res += nativeBuffer.get(size - i)
}
}
companion object {
val size = 1000
val array = IntArray(size) { it }
val arrayBuffer = IntBuffer.wrap(array)
val nativeBuffer = IntBuffer.allocate(size).also {
for (i in 0 until size) {
it.put(i, i)
}
}
}
}

View File

@ -1,33 +0,0 @@
package scientifik.kmath.structures
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.complex
@State(Scope.Benchmark)
class BufferBenchmark {
@Benchmark
fun genericRealBufferReadWrite() {
val buffer = RealBuffer(size){it.toDouble()}
(0 until size).forEach {
buffer[it]
}
}
@Benchmark
fun complexBufferReadWrite() {
val buffer = MutableBuffer.complex(size / 2){Complex(it.toDouble(), -it.toDouble())}
(0 until size / 2).forEach {
buffer[it]
}
}
companion object {
const val size = 100
}
}

View File

@ -1,50 +0,0 @@
package scientifik.kmath.structures
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
@State(Scope.Benchmark)
class NDFieldBenchmark {
@Benchmark
fun autoFieldAdd() {
bufferedField {
var res: NDBuffer<Double> = one
repeat(n) { res += one }
}
}
@Benchmark
fun autoElementAdd() {
var res = genericField.one
repeat(n) { res += 1.0 }
}
@Benchmark
fun specializedFieldAdd() {
specializedField {
var res: NDBuffer<Double> = one
repeat(n) { res += 1.0 }
}
}
@Benchmark
fun boxingFieldAdd() {
genericField {
var res: NDBuffer<Double> = one
repeat(n) { res += one }
}
}
companion object {
val dim = 1000
val n = 100
val bufferedField = NDField.auto(RealField, dim, dim)
val specializedField = NDField.real(dim, dim)
val genericField = NDField.boxing(RealField, dim, dim)
}
}

View File

@ -1,61 +0,0 @@
package scientifik.kmath.structures
import org.jetbrains.bio.viktor.F64Array
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
import scientifik.kmath.viktor.ViktorNDField
@State(Scope.Benchmark)
class ViktorBenchmark {
final val dim = 1000
final val n = 100
// automatically build context most suited for given type.
final val autoField: BufferedNDField<Double, RealField> = NDField.auto(RealField, dim, dim)
final val realField: RealNDField = NDField.real(dim, dim)
final val viktorField: ViktorNDField = ViktorNDField(intArrayOf(dim, dim))
@Benchmark
fun automaticFieldAddition() {
autoField {
var res = one
repeat(n) { res += one }
}
}
@Benchmark
fun viktorFieldAddition() {
viktorField {
var res = one
repeat(n) { res += one }
}
}
@Benchmark
fun rawViktor() {
val one = F64Array.full(init = 1.0, shape = *intArrayOf(dim, dim))
var res = one
repeat(n) { res = res + one }
}
@Benchmark
fun realdFieldLog() {
realField {
val fortyTwo = produce { 42.0 }
var res = one
repeat(n) { res = ln(fortyTwo) }
}
}
@Benchmark
fun rawViktorLog() {
val fortyTwo = F64Array.full(dim, dim, init = 42.0)
var res: F64Array
repeat(n) {
res = fortyTwo.log()
}
}
}

View File

@ -1,11 +0,0 @@
package scientifik.kmath.utils
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.system.measureTimeMillis
internal inline fun measureAndPrint(title: String, block: () -> Unit) {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
val time = measureTimeMillis(block)
println("$title completed in $time millis")
}

View File

@ -1,71 +0,0 @@
package scientifik.kmath.ast
import scientifik.kmath.asm.compile
import scientifik.kmath.expressions.Expression
import scientifik.kmath.expressions.expressionInField
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.RealField
import kotlin.random.Random
import kotlin.system.measureTimeMillis
private class ExpressionsInterpretersBenchmark {
private val algebra: Field<Double> = RealField
fun functionalExpression() {
val expr = algebra.expressionInField {
variable("x") * const(2.0) + const(2.0) / variable("x") - const(16.0)
}
invokeAndSum(expr)
}
fun mstExpression() {
val expr = algebra.mstInField {
symbol("x") * number(2.0) + number(2.0) / symbol("x") - number(16.0)
}
invokeAndSum(expr)
}
fun asmExpression() {
val expr = algebra.mstInField {
symbol("x") * number(2.0) + number(2.0) / symbol("x") - number(16.0)
}.compile()
invokeAndSum(expr)
}
private fun invokeAndSum(expr: Expression<Double>) {
val random = Random(0)
var sum = 0.0
repeat(1000000) {
sum += expr("x" to random.nextDouble())
}
println(sum)
}
}
fun main() {
val benchmark = ExpressionsInterpretersBenchmark()
val fe = measureTimeMillis {
benchmark.functionalExpression()
}
println("fe=$fe")
val mst = measureTimeMillis {
benchmark.mstExpression()
}
println("mst=$mst")
val asm = measureTimeMillis {
benchmark.asmExpression()
}
println("asm=$asm")
}

View File

@ -1,71 +0,0 @@
package scientifik.kmath.commons.prob
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import org.apache.commons.rng.sampling.distribution.ZigguratNormalizedGaussianSampler
import org.apache.commons.rng.simple.RandomSource
import scientifik.kmath.chains.BlockingRealChain
import scientifik.kmath.prob.*
import java.time.Duration
import java.time.Instant
private suspend fun runChain(): Duration {
val generator = RandomGenerator.fromSource(RandomSource.MT, 123L)
val normal = Distribution.normal(NormalSamplerMethod.Ziggurat)
val chain = normal.sample(generator) as BlockingRealChain
val startTime = Instant.now()
var sum = 0.0
repeat(10000001) { counter ->
sum += chain.nextDouble()
if (counter % 100000 == 0) {
val duration = Duration.between(startTime, Instant.now())
val meanValue = sum / counter
println("Chain sampler completed $counter elements in $duration: $meanValue")
}
}
return Duration.between(startTime, Instant.now())
}
private fun runDirect(): Duration {
val provider = RandomSource.create(RandomSource.MT, 123L)
val sampler = ZigguratNormalizedGaussianSampler(provider)
val startTime = Instant.now()
var sum = 0.0
repeat(10000001) { counter ->
sum += sampler.sample()
if (counter % 100000 == 0) {
val duration = Duration.between(startTime, Instant.now())
val meanValue = sum / counter
println("Direct sampler completed $counter elements in $duration: $meanValue")
}
}
return Duration.between(startTime, Instant.now())
}
/**
* Comparing chain sampling performance with direct sampling performance
*/
fun main() {
runBlocking(Dispatchers.Default) {
val chainJob = async {
runChain()
}
val directJob = async {
runDirect()
}
println("Chain: ${chainJob.await()}")
println("Direct: ${directJob.await()}")
}
}

View File

@ -1,32 +0,0 @@
package scientifik.kmath.commons.prob
import kotlinx.coroutines.runBlocking
import scientifik.kmath.chains.Chain
import scientifik.kmath.chains.collectWithState
import scientifik.kmath.prob.Distribution
import scientifik.kmath.prob.RandomGenerator
import scientifik.kmath.prob.normal
data class AveragingChainState(var num: Int = 0, var value: Double = 0.0)
fun Chain<Double>.mean(): Chain<Double> = collectWithState(AveragingChainState(), { it.copy() }) { chain ->
val next = chain.next()
num++
value += next
return@collectWithState value / num
}
fun main() {
val normal = Distribution.normal()
val chain = normal.sample(RandomGenerator.default).mean()
runBlocking {
repeat(10001) { counter ->
val mean = chain.next()
if (counter % 1000 == 0) {
println("[$counter] Average value is $mean")
}
}
}
}

View File

@ -1,55 +0,0 @@
package scientifik.kmath.linear
import koma.matrix.ejml.EJMLMatrixFactory
import scientifik.kmath.commons.linear.CMMatrixContext
import scientifik.kmath.commons.linear.inverse
import scientifik.kmath.commons.linear.toCM
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
import scientifik.kmath.structures.Matrix
import kotlin.contracts.ExperimentalContracts
import kotlin.random.Random
import kotlin.system.measureTimeMillis
@ExperimentalContracts
fun main() {
val random = Random(1224)
val dim = 100
//creating invertible matrix
val u = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
val l = Matrix.real(dim, dim) { i, j -> if (i >= j) random.nextDouble() else 0.0 }
val matrix = l dot u
val n = 5000 // iterations
MatrixContext.real {
repeat(50) { val res = inverse(matrix) }
val inverseTime = measureTimeMillis { repeat(n) { val res = inverse(matrix) } }
println("[kmath] Inversion of $n matrices $dim x $dim finished in $inverseTime millis")
}
//commons-math
val commonsTime = measureTimeMillis {
CMMatrixContext {
val cm = matrix.toCM() //avoid overhead on conversion
repeat(n) { val res = inverse(cm) }
}
}
println("[commons-math] Inversion of $n matrices $dim x $dim finished in $commonsTime millis")
//koma-ejml
val komaTime = measureTimeMillis {
(KomaMatrixContext(EJMLMatrixFactory(), RealField)) {
val km = matrix.toKoma() //avoid overhead on conversion
repeat(n) {
val res = inverse(km)
}
}
}
println("[koma-ejml] Inversion of $n matrices $dim x $dim finished in $komaTime millis")
}

View File

@ -1,49 +0,0 @@
package scientifik.kmath.linear
import koma.matrix.ejml.EJMLMatrixFactory
import scientifik.kmath.commons.linear.CMMatrixContext
import scientifik.kmath.commons.linear.toCM
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
import scientifik.kmath.structures.Matrix
import kotlin.random.Random
import kotlin.system.measureTimeMillis
fun main() {
val random = Random(12224)
val dim = 1000
//creating invertible matrix
val matrix1 = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
val matrix2 = Matrix.real(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
// //warmup
// matrix1 dot matrix2
CMMatrixContext {
val cmMatrix1 = matrix1.toCM()
val cmMatrix2 = matrix2.toCM()
val cmTime = measureTimeMillis {
cmMatrix1 dot cmMatrix2
}
println("CM implementation time: $cmTime")
}
(KomaMatrixContext(EJMLMatrixFactory(), RealField)) {
val komaMatrix1 = matrix1.toKoma()
val komaMatrix2 = matrix2.toKoma()
val komaTime = measureTimeMillis {
komaMatrix1 dot komaMatrix2
}
println("Koma-ejml implementation time: $komaTime")
}
val genericTime = measureTimeMillis {
val res = matrix1 dot matrix2
}
println("Generic implementation time: $genericTime")
}

View File

@ -1,19 +0,0 @@
package scientifik.kmath.operations
import scientifik.kmath.structures.NDElement
import scientifik.kmath.structures.NDField
import scientifik.kmath.structures.complex
fun main() {
val element = NDElement.complex(2, 2) { index: IntArray ->
Complex(index[0].toDouble() - index[1].toDouble(), index[0].toDouble() + index[1].toDouble())
}
val compute = (NDField.complex(8)) {
val a = produce { (it) -> i * it - it.toDouble() }
val b = 3
val c = Complex(1.0, 1.0)
(a pow b) + c
}
}

View File

@ -1,53 +0,0 @@
package scientifik.kmath.structures
import scientifik.kmath.linear.transpose
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.ComplexField
import scientifik.kmath.operations.invoke
import kotlin.system.measureTimeMillis
fun main() {
val dim = 1000
val n = 1000
val realField = NDField.real(dim, dim)
val complexField = NDField.complex(dim, dim)
val realTime = measureTimeMillis {
realField {
var res: NDBuffer<Double> = one
repeat(n) {
res += 1.0
}
}
}
println("Real addition completed in $realTime millis")
val complexTime = measureTimeMillis {
complexField {
var res: NDBuffer<Complex> = one
repeat(n) { res += 1.0 }
}
}
println("Complex addition completed in $complexTime millis")
}
fun complexExample() {
//Create a context for 2-d structure with complex values
ComplexField {
nd(4, 8) {
//a constant real-valued structure
val x = one * 2.5
operator fun Number.plus(other: Complex) = Complex(this.toDouble() + other.re, other.im)
//a structure generator specific to this context
val matrix = produce { (k, l) -> k + l * i }
//Perform sum
val sum = matrix + x + 1.0
//Represent the sum as 2d-structure and transpose
sum.as2D().transpose()
}
}
}

View File

@ -1,68 +0,0 @@
package scientifik.kmath.structures
import kotlinx.coroutines.GlobalScope
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.system.measureTimeMillis
internal inline fun measureAndPrint(title: String, block: () -> Unit) {
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
val time = measureTimeMillis(block)
println("$title completed in $time millis")
}
fun main() {
val dim = 1000
val n = 1000
// automatically build context most suited for given type.
val autoField = NDField.auto(RealField, dim, dim)
// specialized nd-field for Double. It works as generic Double field as well
val specializedField = NDField.real(dim, dim)
//A generic boxing field. It should be used for objects, not primitives.
val genericField = NDField.boxing(RealField, dim, dim)
measureAndPrint("Automatic field addition") {
autoField {
var res: NDBuffer<Double> = one
repeat(n) { res += number(1.0) }
}
}
measureAndPrint("Element addition") {
var res = genericField.one
repeat(n) { res += 1.0 }
}
measureAndPrint("Specialized addition") {
specializedField {
var res: NDBuffer<Double> = one
repeat(n) { res += 1.0 }
}
}
measureAndPrint("Lazy addition") {
val res = specializedField.one.mapAsync(GlobalScope) {
var c = 0.0
repeat(n) {
c += 1.0
}
c
}
res.elements().forEach { it.second }
}
measureAndPrint("Generic addition") {
//genericField.run(action)
genericField {
var res: NDBuffer<Double> = one
repeat(n) {
res += one // couldn't avoid using `one` due to resolution ambiguity }
}
}
}
}

View File

@ -1,36 +0,0 @@
package scientifik.kmath.structures
import kotlin.system.measureTimeMillis
fun main(args: Array<String>) {
val n = 6000
val array = DoubleArray(n * n) { 1.0 }
val buffer = RealBuffer(array)
val strides = DefaultStrides(intArrayOf(n, n))
val structure = BufferNDStructure(strides, buffer)
measureTimeMillis {
var res: Double = 0.0
strides.indices().forEach { res = structure[it] }
} // warmup
val time1 = measureTimeMillis {
var res: Double = 0.0
strides.indices().forEach { res = structure[it] }
}
println("Structure reading finished in $time1 millis")
val time2 = measureTimeMillis {
var res: Double = 0.0
strides.indices().forEach { res = buffer[strides.offset(it)] }
}
println("Buffer reading finished in $time2 millis")
val time3 = measureTimeMillis {
var res: Double = 0.0
strides.indices().forEach { res = array[strides.offset(it)] }
}
println("Array reading finished in $time3 millis")
}

View File

@ -1,38 +0,0 @@
package scientifik.kmath.structures
import kotlin.system.measureTimeMillis
fun main(args: Array<String>) {
val n = 6000
val structure = NDStructure.build(intArrayOf(n, n), Buffer.Companion::auto) { 1.0 }
structure.mapToBuffer { it + 1 } // warm-up
val time1 = measureTimeMillis {
val res = structure.mapToBuffer { it + 1 }
}
println("Structure mapping finished in $time1 millis")
val array = DoubleArray(n * n) { 1.0 }
val time2 = measureTimeMillis {
val target = DoubleArray(n * n)
val res = array.forEachIndexed { index, value ->
target[index] = value + 1
}
}
println("Array mapping finished in $time2 millis")
val buffer = RealBuffer(DoubleArray(n * n) { 1.0 })
val time3 = measureTimeMillis {
val target = RealBuffer(DoubleArray(n * n))
val res = array.forEachIndexed { index, value ->
target[index] = value + 1
}
}
println("Buffer mapping finished in $time3 millis")
}

View File

@ -1,32 +0,0 @@
package scientifik.kmath.structures
import scientifik.kmath.dimensions.D2
import scientifik.kmath.dimensions.D3
import scientifik.kmath.dimensions.DMatrixContext
import scientifik.kmath.dimensions.Dimension
import scientifik.kmath.operations.RealField
fun DMatrixContext<Double, RealField>.simple() {
val m1 = produce<D2, D3> { i, j -> (i + j).toDouble() }
val m2 = produce<D3, D2> { i, j -> (i + j).toDouble() }
//Dimension-safe addition
m1.transpose() + m2
}
object D5 : Dimension {
override val dim: UInt = 5u
}
fun DMatrixContext<Double, RealField>.custom() {
val m1 = produce<D2, D5> { i, j -> (i + j).toDouble() }
val m2 = produce<D5, D2> { i, j -> (i - j).toDouble() }
val m3 = produce<D2, D2> { i, j -> (i - j).toDouble() }
(m1 dot m2) + m3
}
fun main(): Unit = with(DMatrixContext.real) {
simple()
custom()
}

View File

@ -0,0 +1,26 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.ast
import space.kscience.kmath.ast.rendering.FeaturedMathRendererWithPostProcess
import space.kscience.kmath.ast.rendering.LatexSyntaxRenderer
import space.kscience.kmath.ast.rendering.MathMLSyntaxRenderer
import space.kscience.kmath.ast.rendering.renderWithStringBuilder
fun main() {
val mst = "exp(sqrt(x))-asin(2*x)/(2e10+x^3)/(-12)".parseMath()
val syntax = FeaturedMathRendererWithPostProcess.Default.render(mst)
println("MathSyntax:")
println(syntax)
println()
val latex = LatexSyntaxRenderer.renderWithStringBuilder(syntax)
println("LaTeX:")
println(latex)
println()
val mathML = MathMLSyntaxRenderer.renderWithStringBuilder(syntax)
println("MathML:")
println(mathML)
}

View File

@ -0,0 +1,26 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.ast
import space.kscience.kmath.asm.compileToExpression
import space.kscience.kmath.expressions.MstExtendedField
import space.kscience.kmath.expressions.Symbol.Companion.x
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.operations.invoke
fun main() {
val expr = MstExtendedField {
x * 2.0 + number(2.0) / x - number(16.0) + asinh(x) / sin(x)
}.compileToExpression(Float64Field)
val m = DoubleArray(expr.indexer.symbols.size)
val xIdx = expr.indexer.indexOf(x)
repeat(10000000) {
m[xIdx] = 1.0
expr(m)
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.ast
import space.kscience.kmath.expressions.Symbol.Companion.x
import space.kscience.kmath.expressions.derivative
import space.kscience.kmath.expressions.invoke
import space.kscience.kmath.expressions.toExpression
import space.kscience.kmath.kotlingrad.toKotlingradExpression
import space.kscience.kmath.operations.Float64Field
/**
* In this example, *x<sup>2</sup> &minus; 4 x &minus; 44* function is differentiated with Kotlin, and the
* derivation result is compared with valid derivative in a certain point.
*/
fun main() {
val actualDerivative = "x^2-4*x-44"
.parseMath()
.toKotlingradExpression(Float64Field)
.derivative(x)
val expectedDerivative = "2*x-4".parseMath().toExpression(Float64Field)
check(actualDerivative(x to 123.0) == expectedDerivative(x to 123.0))
}

View File

@ -0,0 +1,27 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.ast
import space.kscience.kmath.expressions.Symbol.Companion.x
import space.kscience.kmath.expressions.derivative
import space.kscience.kmath.expressions.invoke
import space.kscience.kmath.expressions.toExpression
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.symja.toSymjaExpression
/**
* In this example, *x<sup>2</sup> &minus; 4 x &minus; 44* function is differentiated with Symja, and the
* derivation result is compared with valid derivative in a certain point.
*/
fun main() {
val actualDerivative = "x^2-4*x-44"
.parseMath()
.toSymjaExpression(Float64Field)
.derivative(x)
val expectedDerivative = "2*x-4".parseMath().toExpression(Float64Field)
check(actualDerivative(x to 123.0) == expectedDerivative(x to 123.0))
}

View File

@ -0,0 +1,92 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.expressions
import space.kscience.kmath.UnstableKMathAPI
// Only kmath-core is needed.
// Let's declare some variables
val x by symbol
val y by symbol
val z by symbol
@OptIn(UnstableKMathAPI::class)
fun main() {
// Let's define some random expression.
val someExpression = Double.autodiff.differentiate {
// We bind variables `x` and `y` to the builder scope,
val x = bindSymbol(x)
val y = bindSymbol(y)
// Then we use the bindings to define expression `xy + x + y - 1`
x * y + x + y - 1
}
// Then we can evaluate it at any point ((-1, -1) in the case):
println(someExpression(x to -1.0, y to -1.0))
// >>> -2.0
// We can also construct its partial derivatives:
val dxExpression = someExpression.derivative(x) // ∂/∂x. Must be `y+1`
val dyExpression = someExpression.derivative(y) // ∂/∂y. Must be `x+1`
val dxdxExpression = someExpression.derivative(x, x) // ∂^2/∂x^2. Must be `0`
// We can evaluate them as well
println(dxExpression(x to 57.0, y to 6.0))
// >>> 7.0
println(dyExpression(x to -1.0, y to 179.0))
// >>> 0.0
println(dxdxExpression(x to 239.0, y to 30.0))
// >>> 0.0
// You can also provide extra arguments that obviously won't affect the result:
println(dxExpression(x to 57.0, y to 6.0, z to 42.0))
// >>> 7.0
println(dyExpression(x to -1.0, y to 179.0, z to 0.0))
// >>> 0.0
println(dxdxExpression(x to 239.0, y to 30.0, z to 100_000.0))
// >>> 0.0
// But in case you forgot to specify bound symbol's value, exception is thrown:
println(runCatching { someExpression(z to 4.0) })
// >>> Failure(java.lang.IllegalStateException: Symbol 'x' is not supported in ...)
// The reason is that the expression is evaluated lazily,
// and each `bindSymbol` operation actually substitutes the provided symbol with the corresponding value.
// For example, let there be an expression
val simpleExpression = Double.autodiff.differentiate {
val x = bindSymbol(x)
x pow 2
}
// When you evaluate it via
simpleExpression(x to 1.0, y to 57.0, z to 179.0)
// lambda above has the context of map `{x: 1.0, y: 57.0, z: 179.0}`.
// When x is bound, you can think of it as substitution `x -> 1.0`.
// Other values are unused which does not make any problem to us.
// But in the case the corresponding value is not provided,
// we cannot bind the variable. Thus, exception is thrown.
// There is also a function `bindSymbolOrNull` that fixes the problem:
val fixedExpression = Double.autodiff.differentiate {
val x = bindSymbolOrNull(x) ?: const(8.0)
x pow -2
}
println(fixedExpression())
// >>> 0.015625
// It works!
// The expression provides a bunch of operations:
// 1. Constant bindings (via `const` and `number`).
// 2. Variable bindings (via `bindVariable`, `bindVariableOrNull`).
// 3. Arithmetic operations (via `+`, `-`, `*`, and `-`).
// 4. Exponentiation (via `pow` or `power`).
// 5. `exp` and `ln`.
// 6. Trigonometrical functions (`sin`, `cos`, `tan`, `cot`).
// 7. Inverse trigonometrical functions (`asin`, `acos`, `atan`, `acot`).
// 8. Hyperbolic functions and inverse hyperbolic functions.
}

View File

@ -0,0 +1,113 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.fit
import kotlinx.html.br
import kotlinx.html.h3
import space.kscience.kmath.commons.optimization.CMOptimizer
import space.kscience.kmath.distributions.NormalDistribution
import space.kscience.kmath.expressions.autodiff
import space.kscience.kmath.expressions.symbol
import space.kscience.kmath.operations.asIterable
import space.kscience.kmath.operations.toList
import space.kscience.kmath.optimization.*
import space.kscience.kmath.random.RandomGenerator
import space.kscience.kmath.real.DoubleVector
import space.kscience.kmath.real.map
import space.kscience.kmath.real.step
import space.kscience.kmath.stat.chiSquaredExpression
import space.kscience.plotly.*
import space.kscience.plotly.models.ScatterMode
import space.kscience.plotly.models.TraceValues
import kotlin.math.pow
import kotlin.math.sqrt
// Forward declaration of symbols that will be used in expressions.
private val a by symbol
private val b by symbol
private val c by symbol
/**
* Shortcut to use buffers in plotly
*/
operator fun TraceValues.invoke(vector: DoubleVector) {
numbers = vector.asIterable()
}
/**
* Least squares fie with auto-differentiation. Uses `kmath-commons` and `kmath-for-real` modules.
*/
suspend fun main() {
//A generator for a normally distributed values
val generator = NormalDistribution(0.0, 1.0)
//A chain/flow of random values with the given seed
val chain = generator.sample(RandomGenerator.default(112667))
//Create a uniformly distributed x values like numpy.arrange
val x = 1.0..100.0 step 1.0
//Perform an operation on each x value (much more effective, than numpy)
val y = x.map { it ->
val value = it.pow(2) + it + 1
value + chain.next() * sqrt(value)
}
// this will also work, but less effective:
// val y = x.pow(2)+ x + 1 + chain.nextDouble()
// create same errors for all xs
val yErr = y.map { sqrt(it) }//RealVector.same(x.size, sigma)
// compute differentiable chi^2 sum for given model ax^2 + bx + c
val chi2 = Double.autodiff.chiSquaredExpression(x, y, yErr) { arg ->
//bind variables to autodiff context
val a = bindSymbol(a)
val b = bindSymbol(b)
//Include default value for c if it is not provided as a parameter
val c = bindSymbolOrNull(c) ?: one
a * arg.pow(2) + b * arg + c
}
//minimize the chi^2 in given starting point. Derivatives are not required, they are already included.
val result = chi2.optimizeWith(
CMOptimizer,
mapOf(a to 1.5, b to 0.9, c to 1.0),
) {
FunctionOptimizationTarget(OptimizationDirection.MINIMIZE)
}
//display a page with plot and numerical results
val page = Plotly.page {
plot {
scatter {
mode = ScatterMode.markers
x(x)
y(y)
error_y {
array = yErr.toList()
}
name = "data"
}
scatter {
mode = ScatterMode.lines
x(x)
y(x.map { result.result[a]!! * it.pow(2) + result.result[b]!! * it + 1 })
name = "fit"
}
}
br()
h3 {
+"Fit result: $result"
}
h3 {
+"Chi2/dof = ${result.resultValue / (x.size - 3)}"
}
}
page.makeFile()
}

View File

@ -0,0 +1,112 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.fit
import kotlinx.html.br
import kotlinx.html.h3
import space.kscience.attributes.Attributes
import space.kscience.kmath.data.XYErrorColumnarData
import space.kscience.kmath.distributions.NormalDistribution
import space.kscience.kmath.expressions.Symbol
import space.kscience.kmath.expressions.autodiff
import space.kscience.kmath.expressions.binding
import space.kscience.kmath.expressions.symbol
import space.kscience.kmath.operations.asIterable
import space.kscience.kmath.operations.toList
import space.kscience.kmath.optimization.*
import space.kscience.kmath.random.RandomGenerator
import space.kscience.kmath.real.map
import space.kscience.kmath.real.step
import space.kscience.plotly.*
import space.kscience.plotly.models.ScatterMode
import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.sqrt
// Forward declaration of symbols that will be used in expressions.
private val a by symbol
private val b by symbol
private val c by symbol
private val d by symbol
private val e by symbol
/**
* Least squares fie with auto-differentiation. Uses `kmath-commons` and `kmath-for-real` modules.
*/
suspend fun main() {
//A generator for a normally distributed values
val generator = NormalDistribution(0.0, 1.0)
//A chain/flow of random values with the given seed
val chain = generator.sample(RandomGenerator.default(112667))
//Create a uniformly distributed x values like numpy.arrange
val x = 1.0..100.0 step 1.0
//Perform an operation on each x value (much more effective, than numpy)
val y = x.map { it ->
val value = it.pow(2) + it + 1
value + chain.next() * sqrt(value)
}
// this will also work, but less effective:
// val y = x.pow(2)+ x + 1 + chain.nextDouble()
// create same errors for all xs
val yErr = y.map { sqrt(abs(it)) }
require(yErr.asIterable().all { it > 0 }) { "All errors must be strictly positive" }
val result = XYErrorColumnarData.of(x, y, yErr).fitWith(
QowOptimizer,
Double.autodiff,
mapOf(a to 0.9, b to 1.2, c to 2.0, e to 1.0, d to 1.0, e to 0.0),
attributes = Attributes(OptimizationParameters, listOf(a, b, c, d))
) { arg ->
//bind variables to autodiff context
val a by binding
val b by binding
//Include default value for c if it is not provided as a parameter
val c = bindSymbolOrNull(c) ?: one
val d by binding
val e by binding
a * arg.pow(2) + b * arg + c + d * arg.pow(3) + e / arg
}
println("Resulting chi2/dof: ${result.chiSquaredOrNull}/${result.dof}")
//display a page with plot and numerical results
val page = Plotly.page {
plot {
scatter {
mode = ScatterMode.markers
x(x)
y(y)
error_y {
array = yErr.toList()
}
name = "data"
}
scatter {
mode = ScatterMode.lines
x(x)
y(x.map { result.model(result.startPoint + result.result + (Symbol.x to it)) })
name = "fit"
}
}
br()
h3 {
+"Fit result: ${result.result}"
}
h3 {
+"Chi2/dof = ${result.chiSquaredOrNull!! / result.dof}"
}
}
page.makeFile()
}

View File

@ -0,0 +1,37 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.functions
import space.kscience.kmath.complex.Complex
import space.kscience.kmath.complex.ComplexField
import space.kscience.kmath.complex.ComplexField.div
import space.kscience.kmath.complex.ComplexField.minus
import space.kscience.kmath.complex.algebra
import space.kscience.kmath.integration.gaussIntegrator
import space.kscience.kmath.integration.integrate
import space.kscience.kmath.integration.value
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.structures.Float64
import kotlin.math.pow
fun main() {
//Define a function
val function: Function1D<Float64> = { x -> 3 * x.pow(2) + 2 * x + 1 }
//get the result of the integration
val result = Float64Field.gaussIntegrator.integrate(0.0..10.0, function = function)
//the value is nullable because in some cases the integration could not succeed
println(result.value)
repeat(100000) {
Complex.algebra.gaussIntegrator.integrate(0.0..1.0, intervals = 1000) { x: Double ->
// sin(1 / x) + i * cos(1 / x)
1 / x - ComplexField.i / x
}.value
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.functions
import space.kscience.kmath.interpolation.SplineInterpolator
import space.kscience.kmath.interpolation.interpolatePolynomials
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.structures.Float64
import space.kscience.plotly.Plotly
import space.kscience.plotly.UnstablePlotlyAPI
import space.kscience.plotly.makeFile
import space.kscience.plotly.models.functionXY
import space.kscience.plotly.scatter
import kotlin.math.PI
import kotlin.math.sin
@OptIn(UnstablePlotlyAPI::class)
fun main() {
val data = (0..10).map {
val x = it.toDouble() / 5 * PI
x to sin(x)
}
val polynomial: PiecewisePolynomial<Float64> = SplineInterpolator(Float64Field).interpolatePolynomials(data)
val function = polynomial.asFunction(Float64Field, 0.0)
val cmInterpolate = org.apache.commons.math3.analysis.interpolation.SplineInterpolator().interpolate(
data.map { it.first }.toDoubleArray(),
data.map { it.second }.toDoubleArray()
)
Plotly.plot {
scatter {
name = "interpolated"
x.numbers = data.map { it.first }
y.numbers = x.doubles.map { function(it) }
}
scatter {
name = "original"
functionXY(0.0..(2 * PI), 0.1) { sin(it) }
}
scatter {
name = "cm"
x.numbers = data.map { it.first }
y.numbers = x.doubles.map { cmInterpolate.value(it) }
}
}.makeFile()
}

View File

@ -0,0 +1,46 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.functions
import space.kscience.kmath.interpolation.interpolatePolynomials
import space.kscience.kmath.interpolation.splineInterpolator
import space.kscience.kmath.operations.Float64Field
import space.kscience.kmath.real.map
import space.kscience.kmath.real.step
import space.kscience.kmath.structures.Float64
import space.kscience.plotly.Plotly
import space.kscience.plotly.UnstablePlotlyAPI
import space.kscience.plotly.makeFile
import space.kscience.plotly.models.functionXY
import space.kscience.plotly.scatter
@OptIn(UnstablePlotlyAPI::class)
fun main() {
val function: Function1D<Float64> = { x ->
if (x in 30.0..50.0) {
1.0
} else {
0.0
}
}
val xs = 0.0..100.0 step 0.5
val ys = xs.map(function)
val polynomial: PiecewisePolynomial<Float64> = Float64Field.splineInterpolator.interpolatePolynomials(xs, ys)
val polyFunction = polynomial.asFunction(Float64Field, 0.0)
Plotly.plot {
scatter {
name = "interpolated"
functionXY(25.0..55.0, 0.1) { polyFunction(it) }
}
scatter {
name = "original"
functionXY(25.0..55.0, 0.1) { function(it) }
}
}.makeFile()
}

View File

@ -0,0 +1,33 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.functions
import space.kscience.kmath.integration.gaussIntegrator
import space.kscience.kmath.integration.integrate
import space.kscience.kmath.integration.value
import space.kscience.kmath.nd.StructureND
import space.kscience.kmath.nd.structureND
import space.kscience.kmath.nd.withNdAlgebra
import space.kscience.kmath.operations.algebra
import space.kscience.kmath.structures.Float64
import kotlin.math.pow
fun main(): Unit = Double.algebra.withNdAlgebra(2, 2) {
//Produce a diagonal StructureND
fun diagonal(v: Double) = structureND { (i, j) ->
if (i == j) v else 0.0
}
//Define a function in a nd space
val function: (Double) -> StructureND<Float64> = { x: Double -> 3 * x.pow(2) + 2 * diagonal(x) + 1 }
//get the result of the integration
val result = gaussIntegrator.integrate(0.0..10.0, function = function)
//the value is nullable because in some cases the integration could not succeed
println(result.value)
}

View File

@ -0,0 +1,15 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.jafama
import space.kscience.kmath.operations.invoke
fun main() {
val a = 2.0
val b = StrictJafamaDoubleField { exp(a) }
println(JafamaDoubleField { b + a })
println(StrictJafamaDoubleField { ln(b) })
}

View File

@ -0,0 +1,31 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.linear
import kotlin.random.Random
import kotlin.time.measureTime
fun main() = with(Float64ParallelLinearSpace) {
val random = Random(12224)
val dim = 1000
//creating invertible matrix
val matrix1 = buildMatrix(dim, dim) { i, j ->
if (i <= j) random.nextDouble() else 0.0
}
val matrix2 = buildMatrix(dim, dim) { i, j ->
if (i <= j) random.nextDouble() else 0.0
}
val time = measureTime {
repeat(30) {
matrix1 dot matrix2
}
}
println(time)
}

View File

@ -0,0 +1,40 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.linear
import space.kscience.kmath.commons.linear.CMLinearSpace
import space.kscience.kmath.ejml.EjmlLinearSpaceDDRM
import space.kscience.kmath.nd.StructureND
import space.kscience.kmath.operations.algebra
import space.kscience.kmath.structures.Float64
import kotlin.random.Random
fun main() {
val dim = 46
val random = Random(123)
val u = Float64.algebra.linearSpace.buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
listOf(CMLinearSpace, EjmlLinearSpaceDDRM).forEach { algebra ->
with(algebra) {
//create a simmetric matrix
val matrix = buildMatrix(dim, dim) { row, col ->
if (row >= col) u[row, col] else u[col, row]
}
val eigen = matrix.getOrComputeAttribute(EIG) ?: error("Failed to compute eigenvalue decomposition")
check(
StructureND.contentEquals(
matrix,
eigen.v dot eigen.d dot eigen.v.transposed(),
1e-4
)
) { "$algebra decomposition failed" }
println("$algebra eigenvalue decomposition complete and checked" )
}
}
}

View File

@ -0,0 +1,34 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.linear
import space.kscience.kmath.real.*
import space.kscience.kmath.structures.Float64
import space.kscience.kmath.structures.Float64Buffer
fun main() {
val x0 = DoubleVector(0.0, 0.0, 0.0)
val sigma = DoubleVector(1.0, 1.0, 1.0)
val gaussian: (Point<Float64>) -> Double = { x ->
require(x.size == x0.size)
kotlin.math.exp(-((x - x0) / sigma).square().sum())
}
fun ((Point<Float64>) -> Double).grad(x: Point<Float64>): Point<Float64> {
require(x.size == x0.size)
return Float64Buffer(x.size) { i ->
val h = sigma[i] / 5
val dVector = Float64Buffer(x.size) { if (it == i) h else 0.0 }
val f1 = this(x + dVector / 2)
val f0 = this(x - dVector / 2)
(f1 - f0) / h
}
}
println(gaussian.grad(x0))
}

View File

@ -0,0 +1,27 @@
/*
* Copyright 2018-2024 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.linear
import kotlin.random.Random
import kotlin.time.measureTime
fun main(): Unit = with(Float64LinearSpace) {
val random = Random(1224)
val dim = 500
//creating invertible matrix
val u = buildMatrix(dim, dim) { i, j -> if (i <= j) random.nextDouble() else 0.0 }
val l = buildMatrix(dim, dim) { i, j -> if (i >= j) random.nextDouble() else 0.0 }
val matrix = l dot u
val time = measureTime {
repeat(20) {
lupSolver().inverse(matrix)
}
}
println(time)
}

Some files were not shown because too many files have changed in this diff Show More