diff --git a/pom.xml b/pom.xml index efe9f61..b0d3747 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,11 @@ + + org.jblas + jblas + 1.2.4 + org.jetbrains.kotlin kotlin-stdlib diff --git a/src/main/kotlin/com/tecacet/komplex/matrix/ComplexMatrix.kt b/src/main/kotlin/com/tecacet/komplex/matrix/ComplexMatrix.kt new file mode 100644 index 0000000..ce60e37 --- /dev/null +++ b/src/main/kotlin/com/tecacet/komplex/matrix/ComplexMatrix.kt @@ -0,0 +1,28 @@ +package com.tecacet.komplex.matrix + +import com.tecacet.komplex.Complex +import org.jblas.ComplexDoubleMatrix +import org.jblas.DoubleMatrix + +class ComplexMatrix { + + private val blasComplex : ComplexDoubleMatrix; + + constructor(real : Array, imaginary : Array) { + this.blasComplex = ComplexDoubleMatrix(DoubleMatrix(real), DoubleMatrix(imaginary)) + } + + private constructor(fromBlas : ComplexDoubleMatrix) { + this.blasComplex = fromBlas + } + + //TODO: constructor(doubleArray : Array>) {} + + operator fun plus(other : ComplexMatrix) : ComplexMatrix { + return ComplexMatrix(blasComplex.add(other.blasComplex)) + } + + operator fun times(other: ComplexMatrix) : ComplexMatrix { + return ComplexMatrix(blasComplex.mul(other.blasComplex)) + } +}