Golub-Kahan SVD algorithm for KMP tensors #499
@ -29,13 +29,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdPowerMethodSmall(blackhole: Blackhole) {
|
fun svdPowerMethodSmall(blackhole: Blackhole) {
|
||||||
val svd = tensorSmall.svdPowerMethod()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorSmall, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorSmall.svdPowerMethod()
|
tensorSmall.svdPowerMethod()
|
||||||
)
|
)
|
||||||
@ -43,13 +36,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdPowerMethodMedium(blackhole: Blackhole) {
|
fun svdPowerMethodMedium(blackhole: Blackhole) {
|
||||||
val svd = tensorMedium.svdPowerMethod()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorMedium, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorMedium.svdPowerMethod()
|
tensorMedium.svdPowerMethod()
|
||||||
)
|
)
|
||||||
@ -57,13 +43,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdPowerMethodLarge(blackhole: Blackhole) {
|
fun svdPowerMethodLarge(blackhole: Blackhole) {
|
||||||
val svd = tensorLarge.svdPowerMethod()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorLarge, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorLarge.svdPowerMethod()
|
tensorLarge.svdPowerMethod()
|
||||||
)
|
)
|
||||||
@ -71,13 +50,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdPowerMethodVeryLarge(blackhole: Blackhole) {
|
fun svdPowerMethodVeryLarge(blackhole: Blackhole) {
|
||||||
val svd = tensorVeryLarge.svdPowerMethod()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorVeryLarge, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorVeryLarge.svdPowerMethod()
|
tensorVeryLarge.svdPowerMethod()
|
||||||
)
|
)
|
||||||
@ -85,13 +57,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdGolubKahanSmall(blackhole: Blackhole) {
|
fun svdGolubKahanSmall(blackhole: Blackhole) {
|
||||||
val svd = tensorSmall.svdGolubKahan()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorSmall, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorSmall.svdGolubKahan()
|
tensorSmall.svdGolubKahan()
|
||||||
)
|
)
|
||||||
@ -99,13 +64,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdGolubKahanMedium(blackhole: Blackhole) {
|
fun svdGolubKahanMedium(blackhole: Blackhole) {
|
||||||
val svd = tensorMedium.svdGolubKahan()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorMedium, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorMedium.svdGolubKahan()
|
tensorMedium.svdGolubKahan()
|
||||||
)
|
)
|
||||||
@ -113,13 +71,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdGolubKahanLarge(blackhole: Blackhole) {
|
fun svdGolubKahanLarge(blackhole: Blackhole) {
|
||||||
val svd = tensorLarge.svdGolubKahan()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorLarge, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorLarge.svdGolubKahan()
|
tensorLarge.svdGolubKahan()
|
||||||
)
|
)
|
||||||
@ -127,13 +78,6 @@ class SVDBenchmark {
|
|||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
fun svdGolubKahanVeryLarge(blackhole: Blackhole) {
|
fun svdGolubKahanVeryLarge(blackhole: Blackhole) {
|
||||||
val svd = tensorVeryLarge.svdGolubKahan()
|
|
||||||
val tensorSVD = svd.first
|
|
||||||
.dot(
|
|
||||||
diagonalEmbedding(svd.second)
|
|
||||||
.dot(svd.third.transpose())
|
|
||||||
)
|
|
||||||
assertTrue(tensorSVD.eq(tensorVeryLarge, epsilon))
|
|
||||||
blackhole.consume(
|
blackhole.consume(
|
||||||
tensorVeryLarge.svdGolubKahan()
|
tensorVeryLarge.svdGolubKahan()
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user