https://kotlinlang.org logo
#mathematics
Title
# mathematics
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
👍
3 Views