-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fixed AllInit dimension error and newline printing problem (JBLAS) - better buildscript
- Loading branch information
Showing
10 changed files
with
81 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.dedztbh.kuantum.common.matrix | ||
|
||
/** | ||
* Created by DEDZTBH on 2020/10/12. | ||
* Project KuantumCircuitSim | ||
*/ | ||
|
||
/** 2^(-1/2) */ | ||
const val HALF_AMPL = 0.70710678118654757273731092936941422522068023681640625 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.dedztbh.kuantum.ejml | ||
|
||
import com.dedztbh.kuantum.common.main | ||
import com.dedztbh.kuantum.common.commonMain | ||
|
||
/** | ||
* Created by DEDZTBH on 2020/10/11. | ||
* Project KuantumCircuitSim | ||
*/ | ||
|
||
fun main(args: Array<String>) = main(args, "ejml") | ||
fun main(args: Array<String>) = commonMain(args, "ejml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/test/kotlin/performance.kt → ...t/kotlin/com/dedztbh/kuantum/EJMLBench.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.dedztbh.kuantum | ||
|
||
import com.lukaskusik.coroutines.transformations.reduce.reduceParallel | ||
import kotlinx.coroutines.runBlocking | ||
import org.jblas.ComplexDoubleMatrix | ||
import org.jblas.DoubleMatrix | ||
import kotlin.system.measureTimeMillis | ||
|
||
/** | ||
* Created by DEDZTBH on 2020/10/08. | ||
* Project KuantumCircuitSim | ||
*/ | ||
|
||
fun main() { | ||
// Slower than numpy, I'm not happy :( | ||
val N = 1000 | ||
val mat = ComplexDoubleMatrix(DoubleMatrix.rand(N, N), DoubleMatrix.rand(N, N)) | ||
measureTimeMillis { | ||
// repeat(500) { | ||
// mat.mmul(mat) | ||
// } | ||
runBlocking { | ||
List(500) { mat }.reduceParallel { d1, d2 -> | ||
d1.mmul(d2) | ||
} | ||
} | ||
}.let { | ||
println(it.toDouble() / 1000.0) | ||
} | ||
} |