Package space.kscience.kmath.operations

Types

Link copied to clipboard
interface Algebra<T>

Represents an algebraic structure.

Link copied to clipboard
class BigInt : Comparable<BigInt>
Link copied to clipboard
object BigIntField : Field<BigInt> , NumbersAddOps<BigInt> , ScaleOperations<BigInt>

Kotlin Multiplatform implementation of Big Integer numbers (KBigInteger).

Link copied to clipboard
object BooleanAlgebra : LogicAlgebra<Boolean>

An implementation of LogicAlgebra for primitive booleans

Link copied to clipboard
interface BufferAlgebra<T, out A : Algebra<T>> : Algebra<Buffer<T>>

An algebra over Buffer

Link copied to clipboard
class BufferField<T, A : Field<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>, size: Int) : BufferFieldOps<T, A> , Field<Buffer<T>> , WithSize
Link copied to clipboard
open class BufferFieldOps<T, A : Field<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>) : BufferRingOps<T, A> , BufferAlgebra<T, A> , FieldOps<Buffer<T>> , ScaleOperations<Buffer<T>>
Link copied to clipboard
open class BufferRingOps<T, A : Ring<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>) : BufferAlgebra<T, A> , RingOps<Buffer<T>>
Link copied to clipboard
typealias BufferTransform<T, R> = (Buffer<T>) -> Buffer<R>

Typealias for buffer transformations.

Link copied to clipboard
object ByteRing : Ring<Byte> , Norm<Byte, Byte> , NumericAlgebra<Byte>

A field for Byte without boxing. Does not produce appropriate ring element.

Link copied to clipboard
class DoubleBufferField(size: Int) : DoubleBufferOps, ExtendedField<Buffer<Double>>
Link copied to clipboard
Link copied to clipboard
object DoubleField : ExtendedField<Double> , Norm<Double, Double> , ScaleOperations<Double>

A field for Double without boxing. Does not produce appropriate field element.

Link copied to clipboard
object DoubleL2Norm : Norm<Point<Double>, Double>
Link copied to clipboard
interface ExponentialOperations<T> : Algebra<T>

A container for operations related to exp and ln functions.

Link copied to clipboard
interface ExtendedField<T> : ExtendedFieldOps<T> , Field<T> , PowerOperations<T> , NumericAlgebra<T>

Advanced Number-like field that implements basic operations.

Link copied to clipboard
interface ExtendedFieldOps<T> : FieldOps<T> , TrigonometricOperations<T> , ExponentialOperations<T> , ScaleOperations<T>

Advanced Number-like semifield that implements basic operations.

Link copied to clipboard
interface Field<T> : Ring<T> , FieldOps<T> , ScaleOperations<T> , NumericAlgebra<T>

Represents field i.e., algebraic structure with three operations: associative, commutative addition and multiplication, and division. This interface differs from the eponymous mathematical definition: fields in KMath also support associative multiplication by scalar.

Link copied to clipboard
interface FieldOps<T> : RingOps<T>

Represents field without multiplicative and additive identities i.e., algebraic structure with associative, binary, commutative operations add and multiply; binary operation divide as multiplication of left operand by reciprocal of right one.

Link copied to clipboard
object FloatField : ExtendedField<Float> , Norm<Float, Float>

A field for Float without boxing. Does not produce appropriate field element.

Link copied to clipboard
interface Group<T> : GroupOps<T>

Represents group i.e., algebraic structure with associative, binary operation add.

Link copied to clipboard
interface GroupOps<T> : Algebra<T>

Represents group without neutral element (also known as inverse semigroup) i.e., algebraic structure with associative, binary operation add.

Link copied to clipboard
object IntRing : Ring<Int> , Norm<Int, Int> , NumericAlgebra<Int>

A field for Int without boxing. Does not produce corresponding ring element.

Link copied to clipboard
class JBigDecimalField(mathContext: MathContext) : JBigDecimalFieldBase

A field over BigDecimal.

Link copied to clipboard

An abstract field over BigDecimal.

Link copied to clipboard
object JBigIntegerField : Ring<BigInteger> , NumericAlgebra<BigInteger>

A field over BigInteger.

Link copied to clipboard
annotation class KMathContext

Stub for DSL the Algebra is.

Link copied to clipboard
interface LogicAlgebra<T : Any> : Algebra<T>

An algebra for generic boolean logic

Link copied to clipboard
object LongRing : Ring<Long> , Norm<Long, Long> , NumericAlgebra<Long>

A field for Double without boxing. Does not produce appropriate ring element.

Link copied to clipboard
interface Norm<in T : Any, out R>

A container for norm functional on element.

Link copied to clipboard
interface NumbersAddOps<T> : RingOps<T> , NumericAlgebra<T>

A combination of NumericAlgebra and Ring that adds intrinsic simple operations on numbers like T+1 TODO to be removed and replaced by extensions after multiple receivers are there

Link copied to clipboard
interface NumericAlgebra<T> : Algebra<T>

An algebraic structure where elements can have numeric representation.

Link copied to clipboard
interface PowerOperations<T> : FieldOps<T>

A context extension to include power operations based on exponentiation.

Link copied to clipboard
interface Ring<T> : Group<T> , RingOps<T>

Represents ring i.e., algebraic structure with two associative binary operations called "addition" and "multiplication" and their neutral elements.

Link copied to clipboard
interface RingOps<T> : GroupOps<T>

Represents ring without multiplicative and additive identities i.e., algebraic structure with associative, binary, commutative operation add and associative, operation multiply distributive over add.

Link copied to clipboard
interface ScaleOperations<T> : Algebra<T>

Scale by scalar operations

Link copied to clipboard
object ShortRing : Ring<Short> , Norm<Short, Short> , NumericAlgebra<Short>

A field for Short without boxing. Does not produce appropriate ring element.

Link copied to clipboard
typealias SuspendBufferTransform<T, R> = suspend (Buffer<T>) -> Buffer<R>

Typealias for buffer transformations with suspend function.

Link copied to clipboard
interface TrigonometricOperations<T> : Algebra<T>

A container for trigonometric operations for specific type.

Link copied to clipboard
interface WithSize

Functions

Link copied to clipboard
fun abs(x: BigInt): BigInt

Returns the absolute value of the given value x.

fun <T : Comparable<T>> Group<T>.abs(value: T): T

Absolute of the comparable value

Link copied to clipboard
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.acos(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.acosh(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.asin(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.asinh(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T> Buffer<T>.asIterable(): Iterable<T>

Creates an iterable that returns all elements from this Buffer.

Link copied to clipboard
fun <T> Buffer<T>.asSequence(): Sequence<T>

Creates a sequence that returns all elements from this Buffer.

Link copied to clipboard
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.atan(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.atanh(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, S : Group<T>, ScaleOperations<T>> S.average(data: Iterable<T>): T

Returns an average value of elements in the iterable in this Group.

fun <T, S : Group<T>, ScaleOperations<T>> S.average(data: Sequence<T>): T

Returns an average value of elements in the sequence in this Group.

Link copied to clipboard
fun <T, S : Group<T>, ScaleOperations<T>> Iterable<T>.averageWith(space: S): T

Returns an average value of elements in the iterable in this Group.

fun <T, S : Group<T>, ScaleOperations<T>> Sequence<T>.averageWith(space: S): T

Returns an average value of elements in the sequence in this Group.

Link copied to clipboard
inline fun Buffer.Companion.bigInt(size: Int, initializer: (Int) -> BigInt): Buffer<BigInt>
inline fun MutableBuffer.Companion.bigInt(size: Int, initializer: (Int) -> BigInt): MutableBuffer<BigInt>
Link copied to clipboard
fun <T> Algebra<T>.bindSymbol(symbol: Symbol): T
Link copied to clipboard
fun <T> Algebra<T>.bindSymbolOrNull(symbol: Symbol): T?
Link copied to clipboard
fun <T, A : BufferAlgebra<T, *>, WithSize> A.buffer(initializer: (Int) -> T): Buffer<T>
fun BufferField<Double, *>.buffer(vararg elements: Number): Buffer<Double>
inline fun BigInt.Companion.buffer(size: Int, initializer: (Int) -> BigInt): Buffer<BigInt>
fun <T> BufferAlgebra<T, *>.buffer(size: Int, initializer: (Int) -> T): Buffer<T>
Link copied to clipboard
fun <T, A : Field<T>> A.bufferAlgebra(bufferFactory: BufferFactory<T>): BufferFieldOps<T, A>
Link copied to clipboard
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.cos(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.cosh(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.exp(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
inline fun <T : Any, R> Buffer<T>.fold(initial: R, operation: (R, T) -> R): R

Fold given buffer according to operation

Link copied to clipboard
inline operator fun <A : Algebra<*>, R> A.invoke(block: A.() -> R): R

Call a block with an Algebra as receiver.

Link copied to clipboard
expect fun Number.isInteger(): Boolean

Check if number is an integer from platform point of view

actual fun Number.isInteger(): Boolean

Check if number is an integer

actual fun Number.isInteger(): Boolean

Check if number is an integer

actual fun Number.isInteger(): Boolean

Check if number is an integer

Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.ln(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
inline fun <T : Any, R : Any> Buffer<T>.map(block: (T) -> R): Buffer<R>

Create a new buffer from this one with the given mapping function and using Buffer.Companion.auto buffer factory.

inline fun <T : Any, R : Any> Buffer<T>.map(bufferFactory: BufferFactory<R>, crossinline block: (T) -> R): Buffer<R>

Create a new buffer from this one with the given mapping function. Provided bufferFactory is used to construct the new buffer.

Link copied to clipboard
inline fun <T : Any, R : Any> Buffer<T>.mapIndexed(bufferFactory: BufferFactory<R> = Buffer.Companion::auto, crossinline block: (index: Int, T) -> R): Buffer<R>

Create a new buffer from this one with the given indexed mapping function. Provided BufferFactory is used to construct the new buffer.

Link copied to clipboard
inline fun BigInt.mutableBuffer(size: Int, initializer: (Int) -> BigInt): Buffer<BigInt>
Link copied to clipboard
fun String.parseBigInteger(): BigInt?

Returns null if a valid number cannot be read from a string

Link copied to clipboard
fun <T, A : PowerOperations<T>> BufferAlgebra<T, A>.pow(arg: Buffer<T>, pow: Number): Buffer<T>
Link copied to clipboard
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.sin(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.sinh(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T> Group<T>.sum(data: Iterable<T>): T

Returns the sum of all elements in the iterable in this Group.

fun <T> Group<T>.sum(data: Sequence<T>): T

Returns the sum of all elements in the sequence in this Group.

Link copied to clipboard
fun <T> Iterable<T>.sumWith(group: Group<T>): T

Returns the sum of all elements in the iterable in provided space.

fun <T> Sequence<T>.sumWith(group: Group<T>): T

Returns the sum of all elements in the sequence in provided space.

Link copied to clipboard
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.tan(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.tanh(arg: Buffer<T>): Buffer<T>
Link copied to clipboard
fun Int.toBigInt(): BigInt

Convert this Int to BigInt

fun Long.toBigInt(): BigInt

Convert this Long to BigInt

fun UInt.toBigInt(): BigInt

Convert UInt to BigInt

fun ULong.toBigInt(): BigInt

Convert ULong to BigInt

fun UIntArray.toBigInt(sign: Byte): BigInt

Create a BigInt with this array of magnitudes with protective copy

Link copied to clipboard
fun <T> Buffer<T>.toList(): List<T>

Returns a new List containing all elements of this buffer.

Link copied to clipboard
fun <T> Buffer<T>.toMutableList(): MutableList<T>

Returns a new MutableList filled with all elements of this buffer. NOTE: this method uses a protective copy, so it should not be used in performance-critical code.

Link copied to clipboard
inline fun <T> Buffer<T>.toTypedArray(): Array<T>

Returns a new Array containing all elements of this buffer. NOTE: this method uses a protective copy, so it should not be used in performance-critical code.

Link copied to clipboard
fun <T, A : Field<T>> BufferFieldOps<T, A>.withSize(size: Int): BufferField<T, A>

Generate full buffer field from given buffer operations

Link copied to clipboard
inline fun <T1 : Any, T2 : Any, R : Any> Buffer<T1>.zip(other: Buffer<T2>, bufferFactory: BufferFactory<R> = Buffer.Companion::auto, crossinline transform: (T1, T2) -> R): Buffer<R>

Zip two buffers using given transform.

Properties

Link copied to clipboard
val BigInt.algebra: BigIntField
Link copied to clipboard
val Double.Companion.algebra: DoubleField
Link copied to clipboard
val Float.Companion.algebra: FloatField
Link copied to clipboard
val Int.Companion.algebra: IntRing
Link copied to clipboard
val Short.Companion.algebra: ShortRing
Link copied to clipboard
val Byte.Companion.algebra: ByteRing
Link copied to clipboard
val Long.Companion.algebra: LongRing
Link copied to clipboard
val ShortRing.bufferAlgebra: BufferRingOps<Short, ShortRing>
Link copied to clipboard
val DoubleField.bufferAlgebra: BufferFieldOps<Double, DoubleField>
Link copied to clipboard
val <T> NumericAlgebra<T>.e: T

The e mathematical constant.

Link copied to clipboard
val BigIntField.nd: BufferedRingOpsND<BigInt, BigIntField>
Link copied to clipboard
val <T> NumericAlgebra<T>.pi: T

The π mathematical constant.