Package space.kscience.kmath.operations

Types

Algebra
Link copied to clipboard
common
interface Algebra<T>
Represents an algebraic structure.
BigInt
Link copied to clipboard
common
class BigInt : Comparable<BigInt>
BigIntField
Link copied to clipboard
common
object BigIntField : Field<BigInt> , NumbersAddOps<BigInt> , ScaleOperations<BigInt>
Kotlin Multiplatform implementation of Big Integer numbers (KBigInteger).
BooleanAlgebra
Link copied to clipboard
common
object BooleanAlgebra : LogicAlgebra<Boolean>
An implementation of LogicAlgebra for primitive booleans
BufferAlgebra
Link copied to clipboard
common
interface BufferAlgebra<T, out A : Algebra<T>> : Algebra<Buffer<T>>
An algebra over Buffer
BufferField
Link copied to clipboard
common
class BufferField<T, A : Field<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>, size: Int) : BufferFieldOps<T, A> , Field<Buffer<T>> , WithSize
BufferFieldOps
Link copied to clipboard
common
open class BufferFieldOps<T, A : Field<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>) : BufferRingOps<T, A> , BufferAlgebra<T, A> , FieldOps<Buffer<T>> , ScaleOperations<Buffer<T>>
BufferRingOps
Link copied to clipboard
common
open class BufferRingOps<T, A : Ring<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>) : BufferAlgebra<T, A> , RingOps<Buffer<T>>
BufferTransform
Link copied to clipboard
common
typealias BufferTransform<T, R> = (Buffer<T>) -> Buffer<R>

Typealias for buffer transformations.

ByteRing
Link copied to clipboard
common
object ByteRing : Ring<Byte> , Norm<Byte, Byte> , NumericAlgebra<Byte>
A field for Byte without boxing.
DoubleBufferField
Link copied to clipboard
common
class DoubleBufferField(size: Int) : DoubleBufferOps, ExtendedField<Buffer<Double>>
DoubleBufferOps
Link copied to clipboard
common
abstract class DoubleBufferOps : ExtendedFieldOps<Buffer<Double>> , Norm<Buffer<Double>, Double>
DoubleField
Link copied to clipboard
common
object DoubleField : ExtendedField<Double> , Norm<Double, Double> , ScaleOperations<Double>
A field for Double without boxing.
DoubleL2Norm
Link copied to clipboard
common
object DoubleL2Norm : Norm<Point<Double>, Double>
ExponentialOperations
Link copied to clipboard
common
interface ExponentialOperations<T> : Algebra<T>
A container for operations related to exp and ln functions.
ExtendedField
Link copied to clipboard
common
interface ExtendedField<T> : ExtendedFieldOps<T> , Field<T> , NumericAlgebra<T>
Advanced Number-like field that implements basic operations.
ExtendedFieldOps
Link copied to clipboard
common
Advanced Number-like semifield that implements basic operations.
Field
Link copied to clipboard
common
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.
FieldOps
Link copied to clipboard
common
interface FieldOps<T> : RingOps<T>
Represents field without multiplicative and additive identities i.e.
FloatField
Link copied to clipboard
common
object FloatField : ExtendedField<Float> , Norm<Float, Float>
A field for Float without boxing.
Group
Link copied to clipboard
common
interface Group<T> : GroupOps<T>
Represents group i.e.
GroupOps
Link copied to clipboard
common
interface GroupOps<T> : Algebra<T>
Represents group without neutral element (also known as inverse semigroup) i.e.
IntRing
Link copied to clipboard
common
object IntRing : Ring<Int> , Norm<Int, Int> , NumericAlgebra<Int>
A field for Int without boxing.
JBigDecimalField
Link copied to clipboard
class JBigDecimalField(mathContext: MathContext) : JBigDecimalFieldBase
A field over BigDecimal.
JBigDecimalFieldBase
Link copied to clipboard
An abstract field over BigDecimal.
JBigIntegerField
Link copied to clipboard
object JBigIntegerField : Ring<BigInteger> , NumericAlgebra<BigInteger>
A field over BigInteger.
KMathContext
Link copied to clipboard
common
annotation class KMathContext
Stub for DSL the Algebra is.
LogicAlgebra
Link copied to clipboard
common
interface LogicAlgebra<T : Any> : Algebra<T>
An algebra for generic boolean logic
LongRing
Link copied to clipboard
common
object LongRing : Ring<Long> , Norm<Long, Long> , NumericAlgebra<Long>
A field for Double without boxing.
Norm
Link copied to clipboard
common
interface Norm<in T : Any, out R>
A container for norm functional on element.
NumbersAddOps
Link copied to clipboard
common
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
NumericAlgebra
Link copied to clipboard
common
interface NumericAlgebra<T> : Algebra<T>
An algebraic structure where elements can have numeric representation.
PowerOperations
Link copied to clipboard
common
interface PowerOperations<T> : Algebra<T>
A context extension to include power operations based on exponentiation.
Ring
Link copied to clipboard
common
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.
RingOps
Link copied to clipboard
common
interface RingOps<T> : GroupOps<T>
Represents ring without multiplicative and additive identities i.e.
ScaleOperations
Link copied to clipboard
common
interface ScaleOperations<T> : Algebra<T>
Scale by scalar operations
ShortRing
Link copied to clipboard
common
object ShortRing : Ring<Short> , Norm<Short, Short> , NumericAlgebra<Short>
A field for Short without boxing.
SuspendBufferTransform
Link copied to clipboard
common
typealias SuspendBufferTransform<T, R> = suspend (Buffer<T>) -> Buffer<R>

Typealias for buffer transformations with suspend function.

TrigonometricOperations
Link copied to clipboard
common
interface TrigonometricOperations<T> : Algebra<T>
A container for trigonometric operations for specific type.
WithSize
Link copied to clipboard
common
interface WithSize

Functions

abs
Link copied to clipboard
common
fun abs(x: BigInt): BigInt
Returns the absolute value of the given value x.
fun <T : Comparable<T>> Ring<T>.abs(value: T): T
Absolute of the comparable value
acos
Link copied to clipboard
common
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.acos(arg: Buffer<T>): Buffer<T>
acosh
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.acosh(arg: Buffer<T>): Buffer<T>
asin
Link copied to clipboard
common
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.asin(arg: Buffer<T>): Buffer<T>
asinh
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.asinh(arg: Buffer<T>): Buffer<T>
asIterable
Link copied to clipboard
common
fun <T> Buffer<T>.asIterable(): Iterable<T>
Creates an iterable that returns all elements from this Buffer.
asSequence
Link copied to clipboard
common
fun <T> Buffer<T>.asSequence(): Sequence<T>
Creates a sequence that returns all elements from this Buffer.
atan
Link copied to clipboard
common
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.atan(arg: Buffer<T>): Buffer<T>
atanh
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.atanh(arg: Buffer<T>): Buffer<T>
average
Link copied to clipboard
common
fun <T, S : Ring<T>, ScaleOperations<T>> S.average(data: Iterable<T>): T
Returns an average value of elements in the iterable in this Ring.
fun <T, S : Ring<T>, ScaleOperations<T>> S.average(data: Sequence<T>): T
Returns an average value of elements in the sequence in this Ring.
averageWith
Link copied to clipboard
common
fun <T, S : Ring<T>, ScaleOperations<T>> Iterable<T>.averageWith(space: S): T
Returns an average value of elements in the iterable in this Ring.
fun <T, S : Ring<T>, ScaleOperations<T>> Sequence<T>.averageWith(space: S): T
Returns an average value of elements in the sequence in this Ring.
bigInt
Link copied to clipboard
common
inline fun Buffer.Companion.bigInt(size: Int, initializer: (Int) -> BigInt): Buffer<BigInt>
inline fun MutableBuffer.Companion.bigInt(size: Int, initializer: (Int) -> BigInt): MutableBuffer<BigInt>
bindSymbol
Link copied to clipboard
common
fun <T> Algebra<T>.bindSymbol(symbol: Symbol): T
bindSymbolOrNull
Link copied to clipboard
common
fun <T> Algebra<T>.bindSymbolOrNull(symbol: Symbol): T?
buffer
Link copied to clipboard
common
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>
bufferAlgebra
Link copied to clipboard
common
fun <T, A : Field<T>> A.bufferAlgebra(bufferFactory: BufferFactory<T>): BufferFieldOps<T, A>
cos
Link copied to clipboard
common
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.cos(arg: Buffer<T>): Buffer<T>
cosh
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.cosh(arg: Buffer<T>): Buffer<T>
exp
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.exp(arg: Buffer<T>): Buffer<T>
fold
Link copied to clipboard
common
inline fun <T : Any, R> Buffer<T>.fold(initial: R, operation: (R, T) -> R): R
Fold given buffer according to operation
invoke
Link copied to clipboard
common
inline operator fun <A : Algebra<*>, R> A.invoke(block: A.() -> R): R
Call a block with an Algebra as receiver.
ln
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.ln(arg: Buffer<T>): Buffer<T>
map
Link copied to clipboard
common
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.
mapIndexed
Link copied to clipboard
common
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.
mapIndexedInline
Link copied to clipboard
common
inline fun <T, A : Algebra<T>> BufferAlgebra<T, A>.mapIndexedInline(buffer: Buffer<T>, crossinline block: A.(index: Int, T) -> T): Buffer<T>
Inline map
mapInline
Link copied to clipboard
common
inline fun <T, A : Algebra<T>> BufferAlgebra<T, A>.mapInline(buffer: Buffer<T>, crossinline block: A.(T) -> T): Buffer<T>
Inline map
mutableBuffer
Link copied to clipboard
common
inline fun BigInt.mutableBuffer(size: Int, initializer: (Int) -> BigInt): Buffer<BigInt>
parseBigInteger
Link copied to clipboard
common
fun String.parseBigInteger(): BigInt?
Returns null if a valid number cannot be read from a string
pow
Link copied to clipboard
common
fun <T, A : PowerOperations<T>> BufferAlgebra<T, A>.pow(arg: Buffer<T>, pow: Number): Buffer<T>
power
Link copied to clipboard
common
fun <T> Field<T>.power(arg: T, exponent: Int): T
Raises arg to the integer power exponent.
fun <T> Ring<T>.power(arg: T, exponent: UInt): T
Raises arg to the non-negative integer power exponent.
sin
Link copied to clipboard
common
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.sin(arg: Buffer<T>): Buffer<T>
sinh
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.sinh(arg: Buffer<T>): Buffer<T>
sum
Link copied to clipboard
common
fun <T> Ring<T>.sum(data: Iterable<T>): T
Returns the sum of all elements in the iterable in this Ring.
fun <T> Ring<T>.sum(data: Sequence<T>): T
Returns the sum of all elements in the sequence in this Ring.
sumWith
Link copied to clipboard
common
fun <T> Iterable<T>.sumWith(group: Ring<T>): T
Returns the sum of all elements in the iterable in provided space.
fun <T> Sequence<T>.sumWith(group: Ring<T>): T
Returns the sum of all elements in the sequence in provided space.
tan
Link copied to clipboard
common
fun <T, A : TrigonometricOperations<T>> BufferAlgebra<T, A>.tan(arg: Buffer<T>): Buffer<T>
tanh
Link copied to clipboard
common
fun <T, A : ExponentialOperations<T>> BufferAlgebra<T, A>.tanh(arg: Buffer<T>): Buffer<T>
toBigInt
Link copied to clipboard
common
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
toList
Link copied to clipboard
common
fun <T> Buffer<T>.toList(): List<T>
Returns a new List containing all elements of this buffer.
toMutableList
Link copied to clipboard
common
fun <T> Buffer<T>.toMutableList(): MutableList<T>
Returns a new MutableList filled with all elements of this buffer.
toTypedArray
Link copied to clipboard
common
inline fun <T> Buffer<T>.toTypedArray(): Array<T>
Returns a new Array containing all elements of this buffer.
withSize
Link copied to clipboard
common
fun <T, A : Field<T>> BufferFieldOps<T, A>.withSize(size: Int): BufferField<T, A>
Generate full buffer field from given buffer operations
zip
Link copied to clipboard
common
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.
zipInline
Link copied to clipboard
common
inline fun <T, A : Algebra<T>> BufferAlgebra<T, A>.zipInline(l: Buffer<T>, r: Buffer<T>, crossinline block: A.(T, T) -> T): Buffer<T>
Inline zip

Properties

algebra
Link copied to clipboard
common
val BigInt.algebra: BigIntField
algebra
Link copied to clipboard
common
val Double.Companion.algebra: DoubleField
algebra
Link copied to clipboard
common
val Float.Companion.algebra: FloatField
algebra
Link copied to clipboard
common
val Int.Companion.algebra: IntRing
algebra
Link copied to clipboard
common
val Short.Companion.algebra: ShortRing
algebra
Link copied to clipboard
common
val Byte.Companion.algebra: ByteRing
algebra
Link copied to clipboard
common
val Long.Companion.algebra: LongRing
bufferAlgebra
Link copied to clipboard
common
val ShortRing.bufferAlgebra: BufferRingOps<Short, ShortRing>
bufferAlgebra
Link copied to clipboard
common
val DoubleField.bufferAlgebra: BufferFieldOps<Double, DoubleField>
e
Link copied to clipboard
common
val <T> NumericAlgebra<T>.e: T
The e mathematical constant.
nd
Link copied to clipboard
common
val BigIntField.nd: BufferedRingOpsND<BigInt, BigIntField>
pi
Link copied to clipboard
common
val <T> NumericAlgebra<T>.pi: T
The &pi; mathematical constant.