public void Test_LDA_Performance2000_var(int rep) { int errorCode = 0; try { LDA lda = new LDA(); ILArray <double> X = ILMath.horzcat(ILMath.randn(2, 2000) * 2.0, ILMath.randn(2, 2000) * -2.0); ILLogicalArray labels = ILMath.tological(ILMath.horzcat(ILMath.ones(1, 2000), ILMath.zeros(1, 2000))); labels = labels.Concat(ILMath.tological(ILMath.zeros(1, 2000).Concat(ILMath.ones(1, 2000), 1)), 0); ILPerformer timer = new ILPerformer(); LDA.Hyperplane C; int oldRefMin = ILNumerics.Settings.ILSettings.MinimumRefDimensions; ILNumerics.Settings.ILSettings.MinimumRefDimensions = 2; timer.Tic(); for (int i = 0; i < rep; i++) { C = lda.TrainLDA(X, labels, 0.4); } timer.Toc(); Info("Test_LDA_Performance: with reference - data: 2x2000 run " + rep.ToString() + " times in: " + timer.Duration + "ms"); ILNumerics.Settings.ILSettings.MinimumRefDimensions = 3; timer.Tic(); for (int i = 0; i < rep; i++) { C = lda.TrainLDA(X, labels, 0.4); } timer.Toc(); ILNumerics.Settings.ILSettings.MinimumRefDimensions = oldRefMin; Info("Test_LDA_Performance: without reference - data: 2x2000 run " + rep.ToString() + " times in: " + timer.Duration + "ms"); Success(); }catch (Exception e) { Error(errorCode, e.Message); } }
public void Test_LDA_Performance200k_10() { int errorCode = 0; try { LDA lda = new LDA(); ILArray <double> X = ILMath.horzcat(ILMath.randn(2, 200000) * 2.0, ILMath.randn(2, 200000) * -2.0); ILLogicalArray labels = ILMath.tological(ILMath.horzcat(ILMath.ones(1, 100000), ILMath.zeros(1, 100000))); labels = labels.Concat(ILMath.tological(ILMath.zeros(1, 100000).Concat(ILMath.ones(1, 100000), 1)), 0); ILPerformer timer = new ILPerformer(); timer.Tic(); LDA.Hyperplane C; for (int i = 0; i < 10; i++) { C = lda.TrainLDA(X, labels, 0.4); } timer.Toc(); Info("Test_LDA_Performance2: data: 2x200000 run 10 times in: " + timer.Duration + "ms"); Success(); }catch (Exception e) { Error(errorCode, e.Message); } }
/// <summary> /// run all tests for ILMatFile /// </summary> public override void Run() { // tests: creation // ================= Header(); Test_TestMatlab(); Test_StreamMatlab("testarray1.mat", ILMath.empty()); Test_StreamMatlab("testarray1.mat", ILMath.ones(1, 1)); Test_StreamMatlab("testarray1.mat", ILMath.rand(10, 1)); Test_StreamMatlab("testarray1.mat", ILMath.rand(1, 10)); Test_StreamMatlab("testarray1.mat", ILMath.rand(0, 1)); Test_StreamMatlab("testarray1.mat", ILMath.rand(10, 100, 4)); Test_StreamMatlab("testarray1.mat", ILMath.tosingle(ILMath.ones(1, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tosingle(ILMath.empty())); Test_StreamMatlab("testarray1.mat", ILMath.tosingle(ILMath.rand(10, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tosingle(ILMath.rand(1, 10))); Test_StreamMatlab("testarray1.mat", ILMath.tosingle(ILMath.rand(0, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tosingle(ILMath.rand(10, 100, 4))); Test_StreamMatlab("testarray1.mat", ILMath.tological(ILMath.ones(1, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tological(ILMath.empty())); Test_StreamMatlab("testarray1.mat", ILMath.tological(ILMath.rand(10, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tological(ILMath.rand(1, 10))); Test_StreamMatlab("testarray1.mat", ILMath.tological(ILMath.rand(0, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tological(ILMath.rand(10, 100, 4))); Test_StreamMatlab("testarray1.mat", new ILArray <complex>(new complex[] { new complex(1.0, 2.0) })); Test_StreamMatlab("testarray1.mat", ILMath.tocomplex(ILMath.empty())); Test_StreamMatlab("testarray1.mat", ILMath.tocomplex(ILMath.rand(10, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tocomplex(ILMath.rand(1, 10))); Test_StreamMatlab("testarray1.mat", ILMath.tocomplex(ILMath.rand(0, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tocomplex(ILMath.rand(10, 100, 4))); Test_StreamMatlab("testarray1.mat", new ILArray <fcomplex>(new fcomplex[] { new fcomplex(1.0f, 2.0f) })); Test_StreamMatlab("testarray1.mat", ILMath.tofcomplex(ILMath.empty())); Test_StreamMatlab("testarray1.mat", ILMath.tofcomplex(ILMath.rand(10, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tofcomplex(ILMath.rand(1, 10))); Test_StreamMatlab("testarray1.mat", ILMath.tofcomplex(ILMath.rand(0, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tofcomplex(ILMath.rand(10, 100, 4))); Test_StreamMatlab("testarray1.mat", new ILArray <char>(new char[] { 'A', 'B', 'F' })); Test_StreamMatlab("testarray1.mat", new ILArray <char>(new char[] { 'A', 'B', 'F' }).T); Test_StreamMatlab("testarray1.mat", ILMath.tochar(ILMath.empty())); Test_StreamMatlab("testarray1.mat", ILMath.tochar(ILMath.rand(10, 1) * 250)); Test_StreamMatlab("testarray1.mat", ILMath.tochar(ILMath.rand(1, 10) * 250)); Test_StreamMatlab("testarray1.mat", ILMath.tochar(ILMath.rand(0, 1) * 250)); Test_StreamMatlab("testarray1.mat", ILMath.tochar(ILMath.rand(10, 100, 4) * 250)); Test_StreamMatlab("testarray1.mat", ILMath.tobyte(ILMath.ones(1, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tobyte(ILMath.empty())); Test_StreamMatlab("testarray1.mat", ILMath.tobyte(ILMath.rand(10, 1))); Test_StreamMatlab("testarray1.mat", ILMath.tobyte(ILMath.rand(1, 10) * 255)); Test_StreamMatlab("testarray1.mat", ILMath.tobyte(ILMath.rand(0, 1) * 255)); Test_StreamMatlab("testarray1.mat", ILMath.tobyte(ILMath.rand(10, 100, 4) * 255)); Test_StreamMatlab("testarray1.mat", ILMath.toint16(ILMath.ones(1, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint16(ILMath.empty()) * 16000); Test_StreamMatlab("testarray1.mat", ILMath.toint16(ILMath.rand(10, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint16(ILMath.rand(1, 10) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint16(ILMath.rand(0, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint16(ILMath.rand(10, 100, 4) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint32(ILMath.ones(1, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint32(ILMath.empty() * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint32(ILMath.rand(10, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint32(ILMath.rand(1, 10) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint32(ILMath.rand(0, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.toint32(ILMath.rand(10, 100, 4) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.touint16(ILMath.ones(1, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.touint16(ILMath.empty() * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.touint16(ILMath.rand(10, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.touint16(ILMath.rand(1, 10) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.touint16(ILMath.rand(0, 1) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.touint16(ILMath.rand(10, 100, 4) * 16000)); Test_StreamMatlab("testarray1.mat", ILMath.touint32(ILMath.ones(1, 1))); Test_StreamMatlab("testarray1.mat", ILMath.touint32(ILMath.empty())); Test_StreamMatlab("testarray1.mat", ILMath.touint32(ILMath.rand(10, 1))); Test_StreamMatlab("testarray1.mat", ILMath.touint32(ILMath.rand(1, 10))); Test_StreamMatlab("testarray1.mat", ILMath.touint32(ILMath.rand(0, 1))); Test_StreamMatlab("testarray1.mat", ILMath.touint32(ILMath.rand(10, 100, 4))); Test_ImportMatlab2(); Test_ImportMatlab(); Test_NameRestrictions(); // summary Footer(); }