Code Monkey home page Code Monkey logo

kone's Introduction

Hi there 👋

I'm student at St. Petersburg (State) University. I am learning how to be ✨cool✨. I'm joking, only mathematics📐.

Also I like programming something in spare time. For example, I made a game with my classmates in lockdown in 2020. And you can find some LaTeX repos of my libraries, lecture notes etc. here.

Currently, for a long while I am learning Kotlin and I love it.


kone's People

Contributors

lounres avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

kone's Issues

[Misc/Planimetrics Calculation] Features

Enhancements

  • Add affine entities:
    • Angles.
    • Vectors.
    • Lengths.
  • Implement more construction functionality:
    • Random point on line.
    • Random line through point.
    • Random point on conic.
    • Random tangent to conic.
    • Finiteness conditions and checks of points and lines.
    • Finite point.
    • Finite line.
    • Divide segment in ratio a/b.
    • Parallel line through point.
    • Perpendicular line through point.
    • Parallelism and perpendicularity test for couple of line.
    • Segment bisector.
    • Transformations:
      • Reflection through line.
      • Reflection through point.
      • Translation.
      • Rotation.
      • Homothety.
      • Rotation homothety.
    • Angle equality condition.
    • Angle bisector condition.
    • Incenter/excenter condition (system of conditions).
    • 4 points cocycling condition.
    • Certain conic definitions:
      • Ellipse by foci and major axis.
      • Hyberbola by foci and major axis.
      • Parabola by focus and directrix.
      • Conic by focus, directrix and eccentricity.
    • Projection of point/line to conic by another point/line.
  • Implement more construction functionality (after "assume" feature is implemented):
    • Angle bisector.
    • Incenter/excenter.
    • Conic tangent from point.
    • Conic intersection with line.
    • Conics intersection.

Brand-new features

  • Assume polynomial conditions. The feature provides functionality to assume some polynomial conditions and check other statements under them. Also, it provides context for containing such conditions, enhanced manipulating with polynomial statements in the contexts, and ability to inherit such context to structure computation. Syntax illustration:

    Rational.field.planimetricProblem { // It's a Planimetric Problem Context equipped with Planimetrics Computation Context.
        val A by Point
        val B by Point
        val C by Point
        val l by Line
        
        assume(A liesOn l)
        assume { B liesOn l }
        
        println(C isLyingOn l)
        // >>> false
        
        subproblem {
            assume(collinearityCondition(A, B, C))
        
            println(C isLyingOn l)
            // >>> true
        }
        
        println(C isLyingOn l)
        // >>> false
    }

    Needs:

Rearrange submodules

  • Move kone- modules to kone directory.
  • Move utility modules to util directory.

Create framework for making complex computations more flexible

Make a framework that will provide out of the box such features:

  1. Pause and resume computation serialising interim computation state
    Framework should be able to pause and resume end user's computation regardless of whether program will be stopped or not. Paused computation must be able to be resumed without (or with minimal) change of program source code. Interim computation state must be able to be serialised in a file. The file may (and apparently will) be used to serialise and deserialise the computational state. The serialisation may be delegated to end user. But it will awesome to come up with API to minimise user work. Also interim partial output data must be able to be serialised and returned.

  2. Compute parallelly
    The framework must provide API for parallelising end user's computation.

  3. UI
    The framework must provide ability to plug in CLI, web UI or any other UI. UI must contain elements for:

    1. stopping and pausing,
    2. progress bar and/or interim output data,
    3. (?) other components derived from interim results.

    The default web UI backend must just serve interim data. The default web UI frontend must be very simple. Web UI must be able to be changed (with inheritance or whatever) by end user including frontend replacement.

Add supprot of different data structures and algorithms

Data structures

  • Cyclic Doubly Linked List

Algorithms

  • Convex Hull construction
    Needs:
    • Cyclic Doubly Linked List
  • 2D Voronoi Diagram construction
    Needs:
    • Convex Hull extension
  • 3D Voronoi Diagram construction
    Needs:
    • ?..
  • ? nD Voronoi Diagram construction
    Needs:
    • ?..

[Polynomial] Simplified polynomial's coefficients retrieving API

Implement API for retrieving coefficients of multivariate polynomials like:

val polynomial: LabelledPolynomial<C> = ...

val coefficient1 = polynomial[{ x pow 3u; y pow 1u; z pow 15u }] // Signature description as in DSL1
val coefficient2 = polynomial[mapOf(x to 3u, y to 1u, z to 15u)] // Just a `get` function delegated by `polynomial` to `polynomial.coefficients`

Add utilities

  • kotlinx.benchmark
  • Kover
  • binary-compatibility-validator
  • Linting (sonarLint/sonarQube/sonarCloud/sonarScanner, diktat, ktlint, diktat)

Main/:new:: Implement combinatorial collections extensions

There is need in:

  1. Cartesian product of several collections
  2. Cartesian power
  3. $k$-permutations and $k$-combinations of elements from some collection
  4. All possible combinations of some elements from some collection (including empty combination and (copy of) the collection itself)

[Collections] [Hooks] API enhancment

  1. Fix temporary collections API and come up with a new one (like from Java API but better?).

  2. Hooks. A part of abstract algorithms works like (or precisely are) dynamic algorithms. It means there is an input data that is changing and the output should be changed along. It also means that there should be an API to simplify representation of such relationship.

    Suggestion is that there should be a Hook interface which declares API for hooking on changes viewers. In that case all the algorithms can be represented as a simple object which state depends on its arguments and, hence, can be called "views". For example,

    /**
     * @param C type that is representing data change
     * @param I type of intermediate data representation
     */
    interface Hook<C, I> {
        fun hookOn(callback: I.(change: C) -> Unit)
    }
    interface View<E> {
        val value: E
    } 
    
    // ...
    
    sealed interface ListChange<E> {
        data class Assign<E>(val index: Int, val oldElement: E, val newElement: E): ListChange<E>
        data class Insert<E>(val index: Int, val newElement: E): ListChange<E>
        data class Remove<E>(val index: Int, val oldElement: E): ListChange<E>
    }
    interface MutableListHook<E>: MutableList<E>, Hook<ListChange<E>, List<E>>
    class MutableListHookImpl<E>(private val list: MutableList<E>): MutableList<E> by list, MutableListHook<E> {
        private val hooks = mutableListOf<List<E>.(ListChange<E>) -> Unit>()
        override fun hookOn(callback: List<E>.(change: ListChange<E>) -> Unit) { hooks.add(callback) }
        private fun trigger(change: ListChange<E>) { hooks.forEach { list.it(change) } }
    
        override fun add(element: E): Boolean {
            trigger(ListChange.Insert(list.size, element))
            return list.add(element)
        }
        // ...
    }
    
    // ...
    
    class DynamicMaximumValueView<E>(hook: MutableListHook<E>, comparator: Comparator<E>): View<E> {
        private val heap = MaxHeap(hook, comparator)
        init {
            hook.hookOn {
                when (it) {
                    is ListChange.Assign -> {
                        heap.remove(it.oldElement)
                        heap.add(it.newElement)
                    }
                    is ListChange.Insert -> {
                        heap.add(it.newElement)
                    }
                    is ListChange.Remove -> {
                        heap.remove(it.oldElement)
                    }
                }
            }
        }
        override val value: E get() = heap.head
    }

[Util/CollectionOperations] Implement `maxes`-like functions

public fun <T: Comparable<T>> List<T>.maxes(count: Int): List<T> = buildList(count) {
    val iterator = iterator()
    repeat(count) {
        if (!iterator.hasNext()) throw NoSuchElementException()
        this.add(iterator.next())
    }
    while (iterator.hasNext()) {
        val e = iterator.next()
        var index = count - 1
        this[index] = e
        while (index >= 1) {
            if (this[index-1] >= e) break
            this[index] = this[index-1]
            this[index-1] = e
            index--
        }
    }
}

Utils/Map: Add operator that computes lambdas on virtual merge map

There may be a use case (in equality of labelled or numbered polynomials) for operator like

fun <K, V1, V2> checkOnMerge(
    map1: Map<K, V1>,
    map2: Map<K, V2>,
    check1: (key: K, value: V1) -> Boolean,
    check2: (key: K, value: V2) -> Boolean,
    checkUnion: (key: K, value1: V1, value2: V2) -> Boolean,
) : Boolean

that checks if check1 is true on all unique keys from map1, check2 is true on all unique keys from map2, and checkUnion is true on all common keys from map1 and map2.

Also, there could be operator:

fun <K, V1, V2, R> foldOnMerge(
    map1: Map<K, V1>,
    map2: Map<K, V2>,
    acc: R,
    change1: (acc: R, key: K, value: V1) -> R,
    change2: (acc: R, key: K, value: V2) -> R,
    changeUnion: (acc: R, key: K, value1: V1, value2: V2) -> R,
) : R

that is mix of previous function and fold: for each key of any of map1 or map2 it changes accumulator acc with either change1, change2, or changeUnion depending on whether the key is unique for any of the maps or their common key.

Move (very) experimental Kotlin features to other branches

Make main branch just a Kotlin multiplatform branch and copy and modify environment and implementations for the features in their own branches

Features:

  • main (without extra features)
  • context receivers
  • 1.7.20-Beta
  • 1.7.20-Beta + K2 compiler
  • 1.7.20-Beta + rangeUntil operator

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.