Fixed some tests and docstrings. Removed zero and one overridings because overrided fields are already lazily initialized.

This commit is contained in:
Gleb Minaev 2022-06-12 23:49:44 +03:00
parent e710013800
commit 94fd24d852
3 changed files with 27 additions and 18 deletions

View File

@ -50,15 +50,6 @@ public class ListRationalFunctionSpace<C, A : Ring<C>> (
override fun constructRationalFunction(numerator: ListPolynomial<C>, denominator: ListPolynomial<C>): ListRationalFunction<C> =
ListRationalFunction(numerator, denominator)
/**
* Instance of zero rational function (zero of the rational functions ring).
*/
public override val zero: ListRationalFunction<C> = ListRationalFunction(polynomialZero, polynomialOne)
/**
* Instance of unit polynomial (unit of the rational functions ring).
*/
public override val one: ListRationalFunction<C> = ListRationalFunction(polynomialOne, polynomialOne)
// TODO: When context receivers will be ready move all of this substitutions and invocations to utilities with
// [ListPolynomialSpace] as a context receiver
/**

View File

@ -834,7 +834,12 @@ public abstract class PolynomialSpaceOfFractions<
numerator * other,
denominator
)
/**
* Returns quotient of the rational function and the integer represented as a rational function.
*
* The operation is equivalent to creating a new rational function by preserving numerator of [this] and
* multiplication denominator of [this] to [other].
*/
public override operator fun R.div(other: Int): R =
constructRationalFunction(
numerator,
@ -871,7 +876,12 @@ public abstract class PolynomialSpaceOfFractions<
this * other.numerator,
other.denominator
)
/**
* Returns quotient of the integer represented as a rational function and the rational function.
*
* The operation is equivalent to creating a new rational function which numerator is [this] times denominator of
* [other] and which denominator is [other]'s numerator.
*/
public override operator fun Int.div(other: R): R =
constructRationalFunction(
this * other.denominator,
@ -912,7 +922,9 @@ public abstract class PolynomialSpaceOfFractions<
this * other.numerator,
other.denominator
)
/**
* Returns quotient of the constant represented as a polynomial and the rational function.
*/
public override operator fun C.div(other: R): R =
constructRationalFunction(
this * other.denominator,
@ -943,7 +955,9 @@ public abstract class PolynomialSpaceOfFractions<
numerator * other,
denominator
)
/**
* Returns quotient of the rational function and the constant represented as a rational function.
*/
public override operator fun R.div(other: C): R =
constructRationalFunction(
numerator,
@ -979,7 +993,9 @@ public abstract class PolynomialSpaceOfFractions<
this * other.numerator,
other.denominator
)
/**
* Returns quotient of the polynomial represented as a polynomial and the rational function.
*/
public override operator fun P.div(other: R): R =
constructRationalFunction(
this * other.denominator,
@ -1010,7 +1026,9 @@ public abstract class PolynomialSpaceOfFractions<
numerator * other,
denominator
)
/**
* Returns quotient of the rational function and the polynomial represented as a rational function.
*/
public override operator fun R.div(other: P): R =
constructRationalFunction(
numerator,
@ -1050,7 +1068,9 @@ public abstract class PolynomialSpaceOfFractions<
numerator * other.numerator,
denominator * other.denominator
)
/**
* Returns quotient of the rational functions.
*/
public override operator fun R.div(other: R): R =
constructRationalFunction(
numerator * other.denominator,

View File

@ -7,7 +7,6 @@ package space.kscience.kmath.test.misc
import space.kscience.kmath.functions.ListPolynomial
import space.kscience.kmath.functions.ListPolynomialSpace
import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.operations.Ring
@ -109,7 +108,6 @@ class IntModulo {
}
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "OVERRIDE_BY_INLINE", "NOTHING_TO_INLINE")
@OptIn(UnstableKMathAPI::class)
class IntModuloRing : Ring<IntModulo> {
val modulus: Int