https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
mathematics
  • b

    breandan

    02/06/2019, 3:04 PM
    @altavir Have you thought about using F-bounded quantification in your algebra? It’s a nice way to get concrete types out of an abstract structure while only defining behavior once on the most generic type. For example, try to define an extension function
    buffer.min()
    over an arbitrary buffer whose elements are subtypes of
    Comparable
    where
    min()
    returns a specific type (i.e. not a
    Comparable
    )? Can you implement it using a single function?
    a
    • 2
    • 21
  • m

    Micah Church

    02/21/2019, 5:04 AM
    I'm having difficulties with getting gradle to use the kmath repository, I have followed the steps for the dependency and repository as provided by the link but I cant seem to find the right Tag to put there
    👍 1
    a
    • 2
    • 23
  • m

    Micah Church

    02/21/2019, 7:00 AM
    Where could I find documentation for initialization of the Buffer structure? Edit never mind I'm pretty sure I'll figure it out soon
    a
    • 2
    • 5
  • m

    Micah Church

    02/21/2019, 8:13 AM
    I'm not really sure if this would be something for this project, I know when it comes to large matrices simple operations like dot product, transposition etc can be very slow due to the number of elements. A while back was looking into cache oblivious algorithms, so in the case of matrix multiplication it would divide the matrix into smaller block matrices that would at run time determine the optimal size to put data into the caches of the cpu, these oblivious algorithms, some search algorithms as well, ran at nearly constant speed in terms of effiencey regardless of the dimensions. Like I said not sure if it would be something for hear or elsewhere but attempting to implement some on intensive algorithms may be useful. For instance I know that tensorflow at points can be very slow just due to tensor operations
    a
    • 2
    • 8
  • m

    Micah Church

    02/21/2019, 2:30 PM
    I keep getting an error related to Import scientifik.kmath.transform its saying it's an unresolved reference, everything else is imported and works fine
    a
    • 2
    • 17
  • m

    Micah Church

    02/22/2019, 6:22 AM
    Due to my limited familiarity with Kotlin, and Java in general I think it would be in everyone's best interest if I attempted to start in on the documentation of what is already implemented. This way i waste as little of everyone's time as is possible. It would also be good for my familiarity with the language. I will attempt and a documentation of something that isnt documented as well as at least one example. If it alright with you I could send an example one and based on your input kind of go my own way from there. Then I could let you know at the end when I'm done with say documenting Complex. Please let me know what you think of this for I dont want to bother anyone with rudimentary questions, in the meantime I will also try to get the aformentioned stuff done that I am already working on namely the checking of the fourier transform
    a
    • 2
    • 3
  • t

    thomasnield

    03/23/2019, 2:49 PM
    Presentation proposal for KotlinConf submitted.
    a
    • 2
    • 8
  • t

    thomasnield

    03/23/2019, 2:53 PM
    @altavir I am going to resume my use case for kmath hopefully this week. I kind of want to learn how to build MIP solvers from scratch (minus the matrix work which kmath will do) so I can create hybrid optimization models at work. I've got a massive, critical project at work using simulated annealing, and it seems to work great. But I want to explore linear/integer programming solutions and see if I can avoid 3rd party solvers by using my own heuristics and hybrid models.
    a
    • 2
    • 4
  • b

    bjonnh

    03/26/2019, 11:33 PM
    As soon as matrix stuff is here, I'll give it a try for my spin simulator.
    a
    • 2
    • 3
  • b

    bjonnh

    04/12/2019, 2:34 AM
    @altavir how dynamic are these additional metadata? wouldn't that add some overhead for each matrix? Is that something other libs do?
    a
    • 2
    • 3
  • a

    Ahmed hamuda

    04/12/2019, 10:33 AM
    Hi @altavir in this class you use a
    apache-commons
    as an external library for transforms: https://github.com/mipt-npm/kmath/blob/master/kmath-commons/src/main/kotlin/scientifik/kmath/transform/Transformations.kt but it can be compiled for other platforms (kolin/native, kotlin/js) ?
    a
    • 2
    • 3
  • a

    Ahmed hamuda

    04/13/2019, 7:34 PM
    Welcome @altavir at bottom of this doc https://github.com/mipt-npm/kmath/blob/master/doc/algebra.md there's note
    Fields themselves do not solve the problem of JVM boxing, but it is possible to solve with special contexts like MemorySpec.
    What do you mean with jvm boxing?
    a
    • 2
    • 1
  • t

    thomasnield

    04/21/2019, 2:31 PM
    @altavir Awesome! I think this exciting and just in time when my need to do linear algebra is starting to intensify. Regarding priorities with performance, I agree. @elizarov posted something relevant the other day: https://twitter.com/relizarov/status/1119290897705906178
    a
    • 2
    • 1
  • a

    Ahmed hamuda

    04/28/2019, 9:19 PM
    Hello every body i’m trying the lib, i wanna do some thing like in picture but the nd struct not have setter, what’s the alternative way?
    a
    • 2
    • 5
  • a

    altavir

    05/12/2019, 1:19 PM
    A new article: https://medium.com/@altavir/diving-deeper-into-context-oriented-programming-in-kotlin-3ecb4ec38814 . Second and third examples are about mathematics.
    👍 7
    b
    • 2
    • 2
  • a

    altavir

    06/05/2019, 5:20 PM
    I am thinking about names and pronunciation. Currently we have
    kmath
    , which could be pronounced as
    key-math
    , which sounds good, and similar to ktor. On the other hand, we have
    plotly.kt
    which could be pronounced as
    plotly-kit
    , it is probably even better. Do we need to rename
    kmath
    to
    math.kt
    (kould be pronounced as
    math-kit
    ), while it is not so popular and the name could be changed painlessly.
    t
    h
    • 3
    • 20
  • t

    thomasnield

    06/05/2019, 10:40 PM
    @altavir have operators not been plugged in yet as extension functions or something? I can help here if you like.
    a
    • 2
    • 2
  • t

    thomasnield

    06/05/2019, 10:40 PM
    -.kt
    a
    • 2
    • 1
  • t

    thomasnield

    06/05/2019, 10:40 PM
    Also I do think we will need to bring in a few random distribution functions.
    a
    • 2
    • 1
  • t

    thomasnield

    06/06/2019, 4:57 PM
    -.m
    a
    • 2
    • 1
  • t

    thomasnield

    06/06/2019, 5:04 PM
    @altavir yes, let me see if I can run with that and hammer out a number of top-level functions I find necessary. Then we can find a home for them
    a
    • 2
    • 1
  • t

    thomasnield

    06/06/2019, 5:06 PM
    I'd like this to have a NumPy-like interface, but less Pythony and more Kotlin
    a
    • 2
    • 7
  • t

    thomasnield

    06/06/2019, 6:42 PM
    I created an experimental repository here. https://github.com/thomasnield/numky
    a
    • 2
    • 3
  • t

    thomasnield

    06/07/2019, 3:10 PM
    @altavir we definitely need some random distributions.
    a
    • 2
    • 5
  • a

    altavir

    06/09/2019, 5:10 AM
    Frankly speaking, I was waiting for a question about why random number generation from distribution is coroutine-based. But since it never came, I can answer it (since It is important). There are several concerns, like remote chain sampling, but for now I am thinking about a feature very important to Monte-Carlo sampling. Namely, ability to use PRNG with fixed seed in a deterministic way even with parallel execution (it is important for testing). This feature does not exist in most frameworks (I believe they have something like this in Julia, but it has limitations). In kotlint, I believe, it could be done by attaching RNG or at least its seed to the coroutine context, which in turn requires deterministic order of context initialization. The issue is here: https://github.com/mipt-npm/kmath/issues/65 and I invite everyone (especially @elizarov and coroutine specialists) to the discussion. It won't be implemented in near future, but I think that if we can manage it, it would be quite an achievement.
    😮 1
    • 1
    • 1
  • m

    mccorby

    06/09/2019, 2:57 PM
    Hi, Can KMath work with
    BigInteger
    ?
    a
    b
    • 3
    • 6
  • b

    breandan

    06/21/2019, 6:07 AM
    Nice example of a shape-safe linear algebra API in Rust: https://www.nalgebra.org/vectors_and_matrices/
    a
    • 2
    • 7
  • a

    altavir

    06/21/2019, 9:36 AM
    @breandan Here you are: https://github.com/mipt-npm/kmath/blob/dimensions/kmath-dimensions/src/commonTest/kotlin/scientifik/kmath/dimensions/DMatrixContextTest.kt This is all I can do today, but it seems to be lie what you wanted. I have not tried to work with with custom dimensions, but it should work as well.
    b
    • 2
    • 2
  • b

    breandan

    08/14/2019, 8:50 PM
    DSL for building mathematical functions which supports type-safe variable capture and partial application: https://github.com/breandan/kotlingrad/blob/master/src/main/kotlin/edu/umontreal/kotlingrad/samples/VariableCapture.kt
    👍 2
    🤯 1
    a
    • 2
    • 8
  • m

    mccorby

    09/21/2019, 5:52 AM
    How could I create and operate on a multidimensional structure? I can do it with
    Matrix
    butI get a bit lost when I try to do it with a more generic structure
    a
    • 2
    • 6
Powered by Linen
Title
m

mccorby

09/21/2019, 5:52 AM
How could I create and operate on a multidimensional structure? I can do it with
Matrix
butI get a bit lost when I try to do it with a more generic structure
a

altavir

09/21/2019, 7:48 AM
Documentation is not the best at the moment. First of all, you need to understand what is the type of the items. Second, you need to provide a context both for items and for the structure itself. Basically, you create a field (/ring/space) for your ND structures and operate inside (as in with/run) of it. Like it is done here: https://github.com/mipt-npm/kmath/blob/master/examples/src/main/kotlin/scientifik/kmath/structures/NDField.kt. This looks rather complicated so if all you want is to work with real numbers, you should look into post above and use ready extensions for real numbers.
The complicated structure is done to provide a base for different types of nd structure content.
m

mccorby

09/21/2019, 7:52 AM
Thanks, Alex. I need to work with BigInteger numbers. I need then to add context and structure, don’t I?
a

altavir

09/21/2019, 7:56 AM
No, actually, you don't at least for BigDecimal. Not sure about BigInteger. We have a context for them and all that is left is to male
NDField.boxing(BigDecimalField, dim, dim).run{...}
. And it is exactly why we do architecture this way.
I have to start a lecture now, but I will answer all questions at the evening.
m

mccorby

09/21/2019, 8:40 AM
👍
View count: 1