Return field get access in algebras

This commit is contained in:
Alexander Nozik 2021-03-11 10:18:59 +03:00
parent 522f39cef3
commit fd51564628
2 changed files with 5 additions and 7 deletions

View File

@ -50,7 +50,7 @@ public object MstGroup : Group<MST>, NumericAlgebra<MST>, ScaleOperations<MST> {
*/
@OptIn(UnstableKMathAPI::class)
public object MstRing : Ring<MST>, NumbersAddOperations<MST>, ScaleOperations<MST> {
public override val zero: MST.Numeric = MstGroup.zero
public override val zero: MST.Numeric get() = MstGroup.zero
public override val one: MST.Numeric = number(1.0)
public override fun number(value: Number): MST.Numeric = MstGroup.number(value)
@ -109,8 +109,8 @@ public object MstField : Field<MST>, NumbersAddOperations<MST>, ScaleOperations<
* [ExtendedField] over [MST] nodes.
*/
public object MstExtendedField : ExtendedField<MST>, NumericAlgebra<MST> {
public override val zero: MST.Numeric = MstField.zero
public override val one: MST.Numeric = MstField.one
public override val zero: MST.Numeric get() = MstField.zero
public override val one: MST.Numeric get() = MstField.one
public override fun bindSymbol(value: String): MST.Symbolic = MstField.bindSymbol(value)
public override fun number(value: Number): MST.Numeric = MstRing.number(value)

View File

@ -40,11 +40,9 @@ public class ViktorNDField(public override val shape: IntArray) : NDField<Double
else -> produce { this@f64Buffer[it] }.f64Buffer
}
public override val zero: ViktorNDStructure
get() = F64Array.full(init = 0.0, shape = shape).asStructure()
public override val zero: ViktorNDStructure by lazy { F64Array.full(init = 0.0, shape = shape).asStructure() }
public override val one: ViktorNDStructure
get() = F64Array.full(init = 1.0, shape = shape).asStructure()
public override val one: ViktorNDStructure by lazy { F64Array.full(init = 1.0, shape = shape).asStructure() }
private val strides: Strides = DefaultStrides(shape)