This content originally appeared on DEV Community and was authored by Al
This will be a quick one as this is more of a way point for me to catalogue the progress than it is for me to 100% explain it. I don't know how it all work in entirety, but I have been able to find facets in with it can operate theoretically better. Namely, utilizing matrix data to send specific and cost effective cost data. For this exercise we are going to test out a matrix in which has an axis on its span (I am fairly sure at least). That kind of matrix would look something like this:
fun matricGen() =
"""
1000000
0100000
0010000
0001000
0000100
0000010
0000001
""".trimIndent()
Its still technically a square. I digress. This is important as it allows us to easer do various object transforms and rotables as the spin of the object evenly falls on the span of its axis.
I just want you to think for a second about how you would digest that information.
A couple seconds and we are good.
We digest it as is and utilize the power of pattern recognition and the various and universal usages of regular expressions. I can grab the index of all the one values without and headache or real hassle or worry. In fact, with Kotlin, I can digest all of that accurately in 1 line:
var indiceValues = Regex("[1]{1,}").findAll(matricGen()).map{it.range.start}
That will allow me to grab all the 2d graphical points on the index without have to write a loop of even having to double the project to 2 lines.
Index|`Value|
0 | 1
9 | 1
18 | 1
27 | 1
- | 1
- | 1
- |
This content originally appeared on DEV Community and was authored by Al
Al | Sciencx (2021-05-31T16:06:14+00:00) Multidimensional Matrix digestion through Regex/Kotlin and one line of code.. Retrieved from https://www.scien.cx/2021/05/31/multidimensional-matrix-digestion-through-regex-kotlin-and-one-line-of-code/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.