Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.ejml.data.DMatrixRBlock;
import org.ejml.dense.block.MatrixOps_DDRB;
import org.ejml.dense.block.decomposition.chol.CholeskyOuterForm_DDRB;
import org.ejml.dense.block.decomposition.chol.CholeskyOuterForm_MT_DDRB;
import org.ejml.dense.row.RandomMatrices_DDRM;
import org.ejml.interfaces.decomposition.CholeskyDecomposition_F64;
import org.openjdk.jmh.annotations.*;
Expand Down Expand Up @@ -48,12 +49,14 @@ public class BenchmarkDecompositionCholesky_DDRB {
public DMatrixRBlock A, A_template, L;

CholeskyDecomposition_F64<DMatrixRBlock> cholesky;
CholeskyDecomposition_F64<DMatrixRBlock> choleskyMT;

@Setup
public void setup() {
Random rand = new Random(234);

cholesky = new CholeskyOuterForm_DDRB(lower);
choleskyMT = new CholeskyOuterForm_MT_DDRB(lower);
A = MatrixOps_DDRB.convert(RandomMatrices_DDRM.symmetricPosDef(size, rand));
A_template = A.copy();
L = new DMatrixRBlock(1, 1);
Expand All @@ -64,13 +67,18 @@ public void reset() {
A.setTo(A_template);
}

@Benchmark
public void decompose() {
@Benchmark public void outer() {
if (!cholesky.decompose(A))
throw new RuntimeException("FAILED?!");
cholesky.getT(L);
}

@Benchmark public void outer_MT() {
if (!choleskyMT.decompose(A))
throw new RuntimeException("FAILED?!");
choleskyMT.getT(L);
}

public static void main( String[] args ) throws RunnerException {
Options opt = new OptionsBuilder()
.include(BenchmarkDecompositionCholesky_DDRB.class.getSimpleName())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.ejml.data.DMatrixRBlock;
import org.ejml.dense.block.MatrixOps_DDRB;
import org.ejml.dense.block.decomposition.hessenberg.TridiagonalDecompositionHouseholder_DDRB;
import org.ejml.dense.block.decomposition.hessenberg.TridiagonalDecompositionHouseholder_MT_DDRB;
import org.ejml.dense.row.RandomMatrices_DDRM;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
Expand All @@ -39,27 +40,42 @@
@Fork(value = 1)
public class BenchmarkDecompositionHessenberg_DDRB {
// @Param({"100", "500", "1000", "5000", "10000"})
@Param({"2000"})
@Param({"500", "2000"})
public int size;

public DMatrixRBlock S, S_template;
public DMatrixRBlock S, S_template,Q, R;

TridiagonalDecompositionHouseholder_DDRB tridiagonal = new TridiagonalDecompositionHouseholder_DDRB();
TridiagonalDecompositionHouseholder_DDRB house = new TridiagonalDecompositionHouseholder_DDRB();
TridiagonalDecompositionHouseholder_MT_DDRB houseMT = new TridiagonalDecompositionHouseholder_MT_DDRB();

@Setup public void setup() {
Random rand = new Random(234);

S = MatrixOps_DDRB.convert(RandomMatrices_DDRM.symmetric(size, -1, 1, rand));
S_template = S.copy();
Q = new DMatrixRBlock(1, 1);
R = new DMatrixRBlock(1, 1);
}

@Setup(Level.Invocation) public void reset() {
S.setTo(S_template);
}

@Benchmark public void tridiagonal() {
if (!tridiagonal.decompose(S))
if (!house.decompose(S))
throw new RuntimeException("Decomposition failed?");
// transposed and not exercise different paths
house.getQ(Q, false);
house.getQ(Q, true);
house.getT(R);
}

@Benchmark public void tridiagonal_MT() {
if (!houseMT.decompose(S))
throw new RuntimeException("Decomposition failed?");
houseMT.getQ(Q, false);
houseMT.getQ(Q, true);
houseMT.getT(R);
}

public static void main( String[] args ) throws RunnerException {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.ejml.data.DMatrixRBlock;
import org.ejml.dense.block.MatrixOps_DDRB;
import org.ejml.dense.block.decomposition.qr.QRDecompositionHouseholder_DDRB;
import org.ejml.dense.block.decomposition.qr.QRDecompositionHouseholder_MT_DDRB;
import org.ejml.interfaces.decomposition.QRDecomposition;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
Expand All @@ -42,25 +43,41 @@ public class BenchmarkDecompositionQR_DDRB {
@Param({"1000", "2000"})
public int size;

public DMatrixRBlock A, A_template;
public DMatrixRBlock A, A_template, Q, R;

QRDecomposition<DMatrixRBlock> qr = new QRDecompositionHouseholder_DDRB();
QRDecomposition<DMatrixRBlock> house = new QRDecompositionHouseholder_DDRB();
QRDecomposition<DMatrixRBlock> houseMT = new QRDecompositionHouseholder_MT_DDRB();

@Setup
public void setup() {
@Setup public void setup() {
Random rand = new Random(234);

A = MatrixOps_DDRB.createRandom(size*4, size/4, -1, 1, rand);
A_template = A.copy();

Q = new DMatrixRBlock(1, 1);
R = new DMatrixRBlock(1, 1);
}

@Setup(Level.Invocation) public void reset() {
A.setTo(A_template);
}

@Benchmark public void decompose() {
if (!qr.decompose(A))
@Benchmark public void householder() {
if (!house.decompose(A))
throw new RuntimeException("FAILED?!");

// get Q and R to fully exercise the code. Compact format to avoid having Q dominate
house.getQ(Q, true);
house.getR(R, true);
}

@Benchmark public void householder_MT() {
if (!houseMT.decompose(A))
throw new RuntimeException("FAILED?!");

// get Q and R to fully exercise the code. Compact format to avoid having Q dominate
houseMT.getQ(Q, true);
houseMT.getR(R, true);
}

public static void main( String[] args ) throws RunnerException {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public DMatrixRBlock getT( @Nullable DMatrixRBlock T ) {
if (T == null) {
T = new DMatrixRBlock(A.numRows, A.numCols, A.blockLength);
} else {
if (T.numRows != A.numRows || T.numCols != A.numCols)
throw new IllegalArgumentException("T must have the same dimensions as the input matrix");

if (T.blockLength != A.blockLength)
throw new RuntimeException("Block lengths don't match");
T.reshape(A.numRows, A.numCols);
CommonOps_DDRM.fill(T, 0);
}

Expand Down
Loading