Fix lynglib binding regressions and green test suite
This commit is contained in:
1 parent
bb2119b1d1
commit
8f66cd7680
9 files changed
+106
-59
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package lyng.complex
|
||||
|
||||
import lyng.decimal
|
||||
import lyng.operators
|
||||
|
||||
/*
|
||||
@@ -112,8 +113,10 @@ fun cis(angle: Real): Complex = Complex.fromPolar(1.0, angle)
|
||||
|
||||
val Int.re: Complex get() = Complex.fromInt(this)
|
||||
val Real.re: Complex get() = Complex.fromReal(this)
|
||||
val Decimal.re: Complex get() = Complex(this.toReal(), 0.0)
|
||||
val Int.i: Complex get() = Complex.imaginary(this + 0.0)
|
||||
val Real.i: Complex get() = Complex.imaginary(this)
|
||||
val Decimal.i: Complex get() = Complex(0.0, this.toReal())
|
||||
|
||||
OperatorInterop.register(
|
||||
Int,
|
||||
|
||||
@@ -6,9 +6,11 @@ type MatrixScalar = Real | Int
|
||||
extern class Vector() {
|
||||
/** Number of elements. */
|
||||
val size: Int
|
||||
get() = 0
|
||||
|
||||
/** Alias to `size`. */
|
||||
val length: Int
|
||||
get() = 0
|
||||
|
||||
/** Convert to a plain list. */
|
||||
extern fun toList(): List<Real>
|
||||
@@ -61,15 +63,19 @@ extern class Vector() {
|
||||
extern class Matrix() {
|
||||
/** Number of rows. */
|
||||
val rows: Int
|
||||
get() = 0
|
||||
|
||||
/** Number of columns. */
|
||||
val cols: Int
|
||||
get() = 0
|
||||
|
||||
/** Two-element shape `[rows, cols]`. */
|
||||
val shape: List<Int>
|
||||
get() = []
|
||||
|
||||
/** Whether `rows == cols`. */
|
||||
val isSquare: Bool
|
||||
get() = false
|
||||
|
||||
/** Element-wise addition. Shapes must match. */
|
||||
extern fun plus(other: Matrix): Matrix
|
||||
|
||||
Reference in new issue
Block a user