├── AuxiliaryFunctions
├── .gitignore
├── Project.toml
└── TestCode.jl
├── ImageTracking
├── .gitignore
└── Project.toml
├── LinearSegmentation
├── .gitignore
└── Project.toml
├── .github
└── FUNDING.yml
├── EstimateFrequency
├── .gitignore
├── EECE 522 Notes 08 Chapter 3 CRLB Examples in Book.pdf
├── Steven Kay - A Fast and Accurate Single Frequency Estimator.pdf
├── Phase and Frequency Estimation - High Accuracy and Low Complexity Techniques.pdf
├── Project.toml
├── GolayFilter.m
├── EstSingleHramonicRef.bib
├── Derivatives001.m
└── Derivatives002.m
├── ImageBilateralFilter
├── 0001.png
├── ImageBilateralFilter
│ ├── ImageBilateralFilter.vcxproj.user
│ ├── ImageBilateralFilterDll.h
│ ├── ImageBilateralFilterMain.h
│ ├── ImageConvolutionGaussianKernel.c
│ ├── ImageBilateralFilterMain.c
│ └── ImageBilateralFilter.vcxproj.filters
├── ImageBilateralFilterDll
│ ├── ImageBilateralFilterDll.vcxproj.user
│ └── ImageBilateralFilterDll.vcxproj.filters
├── ImageBilateralFilterIntel
│ ├── ImageBilateralFilterIntel.vcxproj.user
│ └── ImageBilateralFilterIntel.vcxproj.filters
├── ImageBilateralFilterDllIntel
│ ├── ImageBilateralFilterDllIntel.vcxproj.user
│ └── ImageBilateralFilterDllIntel.vcxproj.filters
├── README.md
├── InitScript.m
├── CompileExeGcc.m
└── CompileDllGcc.m
├── SleefVsSvml
├── lib
│ └── sleef.lib
├── SleefVsSvml_2018_09_24_001.zip
├── SleefVsSvml
│ ├── SleefVsSvml.vcxproj.user
│ ├── SleefVsSvmlDll.h
│ ├── TrigFunctions.c
│ ├── PowExpLogFunctions.c
│ ├── SleefVsSvmlMain.h
│ ├── SleefVsSvmlMain.c
│ └── SleefVsSvml.vcxproj.filters
├── SleefVsSvmlDll
│ ├── SleefVsSvmlDll.vcxproj.user
│ └── SleefVsSvmlDll.vcxproj.filters
└── SleefVsSvml.sln
├── LevinsonRecursion
├── Figure0001.png
├── ClickableLegend.m
├── LevinsonRecursionToeplitzMatrix.h
├── InitScript.m
├── CompileDllGcc.m
├── README.md
├── LevinsonRecursionToeplitzMatrix Working.cpp
├── LevinsonRecursionToeplitzMatrix.cpp
└── LevinsonRecursion.m
├── SingularValueDecomposition
├── LS01.PNG
├── SVD.pdf
├── TLS01.PNG
├── Pullout.png
├── PulloutBW.png
├── ErrorVector.PNG
├── NoiselessMatrix.png
├── NoisyMatrixStd1.png
├── NoisyMatrixStd11.png
├── NoisyMatrixStd6.png
├── OperatorSpaces.PNG
├── PseudoInverse.PNG
├── NoisyPulloutStd6.png
├── OperatorOperation.PNG
├── NoiseReducedPulloutStd6.png
├── NoiseReduction001Std1.PNG
├── NoiseReduction002Std6.PNG
├── NoiseReduction003Std11.PNG
├── Pullout100SingularValues.png
├── Pullout10SingularValues.png
├── Pullout1SingularValues.png
├── Pullout200SingularValues.png
├── Pullout240SingularValues.png
├── Pullout100SingularValuesColor.png
└── README.md
├── DynamicTimeWarping
├── DTW - Presentation.pdf
├── Dynamic Time Warping Figure 0001.png
├── Everything You Know About Dynamic Time Warping is Wrong.pdf
├── FastDTW - Toward Accurate Dynamic Time Warping in Linear Time and Space.pdf
├── README.md
├── DrawLinesBetweenCurves.m
├── DisplayMatrixValues.m
├── CalcGaussianGradient.m
└── InitScript.m
├── ImageToColumns
├── x64
│ └── Release
│ │ └── ImageToColumnsDll.lib
├── ImageToColumns
│ ├── ImageToColumnsMain.h
│ ├── ImageToColumns.vcxproj.user
│ ├── ImageToColumns.vcxproj.filters
│ └── ImageToColumnsMain.c
├── ImageToColumnsDll
│ ├── ImageToColumnsDll.h
│ └── ImageToColumnsDll.vcxproj.filters
├── GCC
│ ├── CompileSoGcc.m
│ ├── CompileDllGcc.m
│ └── CompileExeGcc.m
├── ImageToColumns.sln
├── InitScript.m
└── ImageToColumnsSliding.m
├── Optimization
├── BallProjection
│ ├── BallProjection.pdf
│ ├── ClickableLegend.m
│ ├── InitScript.m
│ ├── TestProjectionL2Ball.m
│ ├── ProjectL2Ball.m
│ ├── ProjectLInfBall.m
│ ├── TestProjectionLInfBall.m
│ ├── TestProjectionL1Ball.m
│ └── TestProjectionSimplexBall.m
├── LsL1SolversAnalysis
│ ├── Figure0001.png
│ ├── Coordinate Descent.pdf
│ ├── A Primer on Coordinate Descent Algorithms.pdf
│ ├── Coordinate Descent for L1 Minimization.pdf
│ ├── Proximal Gradient Method and Its Acceleration.pdf
│ ├── A Tutorial on the LASSO and the Shooting Algorithm.pdf
│ ├── Least Squares Optimization with L1 Norm Regularization.pdf
│ ├── ClickableLegend.m
│ ├── UpdateAnalysisData.m
│ ├── README.md
│ └── InitScript.m
├── LsTvSolversAnalysis
│ ├── Figure0001.png
│ ├── ChambolleGradient.png
│ ├── Proximal Splitting Methods in Signal Processing.pdf
│ ├── Alternating Direction Optimization for Imaging Inverse Problems.pdf
│ ├── ClickableLegend.m
│ ├── UpdateAnalysisData.m
│ ├── InitScript.m
│ └── GradientAnalysis.m
├── SteepestDescent
│ └── SteepestDescentNorms.pdf
├── ProxFunctions
│ ├── Optimization II - Final Project.pdf
│ ├── README.md
│ ├── SolveProxL1.m
│ └── InitScript.m
├── ConditionalGradientMethod
│ ├── The Frank Wolfe Algorithm.pdf
│ ├── Martin Jaggi - Frank Wolfe - Optimization Algorithms.pdf
│ ├── Revisiting Frank Wolfe - Projection Free Sparse Convex Optimization.pdf
│ ├── Frank Wolfe and Greedy Optimization for Learning with Big Data - Part 001.pdf
│ ├── Frank Wolfe and Greedy Optimization for Learning with Big Data - Part 002.pdf
│ ├── Revisiting Frank Wolfe - Projection Free Sparse Convex Optimization - Paper.pdf
│ └── Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code
│ │ ├── matrix_completion_squared_error_gradient.m
│ │ ├── matrix_completion_squared_error.m
│ │ ├── demo
│ │ ├── show_progress.m
│ │ ├── FW_nuclear_norm_movielens.m
│ │ ├── FW_lasso_plot_big.m
│ │ ├── FW_lasso_plot_simple_step.m
│ │ └── FW_lasso_plot.m
│ │ ├── FW_lasso.m
│ │ └── FW_nuclear_norm.m
├── InterriorPoint
│ ├── LineSearchBackTracking.m
│ ├── ClickableLegend.m
│ ├── InitScript.m
│ ├── LeastSquaresInterriorPointExample.m
│ └── InterriorPointExample.m
├── ConvexSetProjection
│ ├── ClickableLegend.m
│ ├── ProjectCirculantMatrixSetAnalysis.m
│ ├── GenerateCirculantMatrix.m
│ ├── GenerateShiftMatrix.m
│ └── InitScript.m
├── LsL0SolversAnalysis
│ ├── ClickableLegend.m
│ ├── InitScript.m
│ └── README.md
└── README.md
├── TaskAssignmentProblem
├── ImageToHTML
│ ├── doc
│ │ ├── im2html-screenshot.png
│ │ ├── description.txt
│ │ └── im2html_examples.m
│ ├── +se
│ │ └── +utils
│ │ │ ├── spaces.m
│ │ │ ├── rgbToHtmlHex.m
│ │ │ └── HtmlText.m
│ ├── im2html_sample_stylesheet.css
│ ├── license.txt
│ └── showPixelValues.m
├── ClickableLegend.m
└── InitScript.m
├── Localization
├── README.md
├── ClickableLegend.m
└── InitScript.m
├── ImageConvolution
├── ImageConvolution
│ ├── ImageConvolution.vcxproj.user
│ ├── ImageConvolutionMain.h
│ ├── ImageConvolutionGaussianKernel.c
│ ├── ImageConvolution.vcxproj.filters
│ └── ImageConvolutionMain.c
├── ImageConvolutionDll
│ ├── ImageConvolutionDll.h
│ └── ImageConvolutionDll.vcxproj.filters
├── GCC
│ ├── CompileSoGcc.m
│ ├── CompileDllGcc.m
│ └── CompileExeGcc.m
├── ImageConvolution.sln
└── InitScript.m
├── CalcDistanceMatrix
├── CalcDistanceMatrix
│ ├── CalcDistanceMatrix.vcxproj.user
│ ├── CalcDistanceMatrixDll.h
│ ├── CalcDistanceMatrixMain.cpp
│ ├── CalcDistanceMatrix.vcxproj.filters
│ └── CalcDistanceMatrixMain.h
├── CalcDistanceMatrixDll
│ ├── CalcDistanceMatrixDll.vcxproj.user
│ └── CalcDistanceMatrixDll.vcxproj.filters
├── CalcDistanceMatrix002.m
├── CalcDistanceMatrix001.m
├── InitScript.m
├── HandleDynamicLibrary.m
├── CalcDistanceMatrix.sln
└── CMakeLists.txt
├── Resources.md
├── Clustering
├── DebugErrors.m
├── GenerateDistanceMatrix.m
└── README.md
├── DeepLearningMatchedFilter
├── ClickableLegend.m
├── InitScript.m
└── README.md
├── .gitignore
└── .gitattributes
/AuxiliaryFunctions/.gitignore:
--------------------------------------------------------------------------------
1 | Manifest.toml
--------------------------------------------------------------------------------
/ImageTracking/.gitignore:
--------------------------------------------------------------------------------
1 | # Folders
2 | Data/
--------------------------------------------------------------------------------
/LinearSegmentation/.gitignore:
--------------------------------------------------------------------------------
1 | *.png
2 | *.csv
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | ko_fi: royia
4 | liberapay: Royi
--------------------------------------------------------------------------------
/EstimateFrequency/.gitignore:
--------------------------------------------------------------------------------
1 | *.aux
2 | *.bbl
3 | *.blg
4 | *.log
5 | *.pdf
6 | *.out
7 | *.sce
8 | *.synctex
9 | *.png
10 |
11 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/0001.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:bed90d17ea2371d084e6d1b0e3cf045ea79a5a5aef4011ac57ee35f825759848
3 | size 797387
4 |
--------------------------------------------------------------------------------
/SleefVsSvml/lib/sleef.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:033c3b6f4531f7a3005b2f95b1d0932b8529d676dc6ba3801698996916396f47
3 | size 3915796
4 |
--------------------------------------------------------------------------------
/LevinsonRecursion/Figure0001.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:d5387fd0fcf25bee91fe9aa4bddc9353abde089b4135a2ea21eaf5fd7515b3f3
3 | size 55888
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/LS01.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:8ba32c95e8c98a35c76e2d9e6f41a9413ce8e246a869bd59feb02ba696741a5e
3 | size 21349
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/SVD.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:1e2ad62609db6ea9df3447a8cb70ebf7b9f8e002e01f969e3c33f4f361bb30de
3 | size 3350355
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/TLS01.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:b4a420e76d88fe4e796ff08b320387d336b181c8b0d15cfd3b94d977f09bdfac
3 | size 21079
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/Pullout.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:de536eba98e4443e8e84438ce7f9c524c3bcda1a644ac055ffabb60aa637a6f4
3 | size 198738
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/PulloutBW.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:6572e1b7cc5e2ba2bdec2d14896348cc5fd7a122cca4b29818a3cf31097b6a05
3 | size 81379
4 |
--------------------------------------------------------------------------------
/DynamicTimeWarping/DTW - Presentation.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:c3b2c5500fdced872479ace1032e8a1db8c8520d5bd16766159af5789e0d7d07
3 | size 446990
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/ErrorVector.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:92e35db9491efe6b68ec83cf59e02dd41f9d5af67db4d3592001886aec68af45
3 | size 39521
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoiselessMatrix.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:31b097bab146a3a9ac42d0042b13fa096178b9fba915b1612ea5886ffa326378
3 | size 3174
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoisyMatrixStd1.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:83b5b51d65dfe74b543acd68621dc0d6fc699852bdd859f6e2a47fd902632915
3 | size 3175
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoisyMatrixStd11.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:9014aa8c530566a8b1c46ba01110303e073b5b315930edd318596ee9063ac0b3
3 | size 3288
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoisyMatrixStd6.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:bd0f2a9e1a2fb8f79419c5bc538e1ca82df974bd76895e27f9c2964b6be83db0
3 | size 3226
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/OperatorSpaces.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:f670ce1cc0b0445704281ac76bd2da023e61e399ce8340790a3878165f582e0e
3 | size 75027
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/PseudoInverse.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:9b3a83ccabaa4f4814122976b33fb86e6f3f66ea962b7766984ed5cd0e019235
3 | size 78770
4 |
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvml_2018_09_24_001.zip:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:99875c5a048bf7a91902b11a0d4003d66442d082a98916a07e322d8b6701c79a
3 | size 199711
4 |
--------------------------------------------------------------------------------
/ImageToColumns/x64/Release/ImageToColumnsDll.lib:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:eb7049fba3bfcc5a0a716db03e2450810cf35bc84593f2b33c89001a00371a42
3 | size 1934
4 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/BallProjection.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:e54cd39bbcb2de87bba252e3a5e24413f1be3e6a2df4eef974242417850a6356
3 | size 265748
4 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/Figure0001.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:e019ad7cf07cab48eee6710b93e6ed334b310ff90cb447279c5c9194b0feb1ac
3 | size 126658
4 |
--------------------------------------------------------------------------------
/Optimization/LsTvSolversAnalysis/Figure0001.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:24afaabfdd4c61554ede088fca8c18b09448399d5dd027307b2bb0ca866cf720
3 | size 50128
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoisyPulloutStd6.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:66f7cd2d3af38cfc48b97d2ba2508b58aad120a25f0c844fcbdd08d4c0128f45
3 | size 89869
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/OperatorOperation.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:5e2c2aef7e89c3e1739d01bde4e07921241b634fb84e1585b2254b83e69b6b8e
3 | size 79507
4 |
--------------------------------------------------------------------------------
/DynamicTimeWarping/Dynamic Time Warping Figure 0001.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:d5cd638280805d9fb9db12ee79c5acdbf20d5d708c80401307b99b9f366b5639
3 | size 173622
4 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/Coordinate Descent.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:cf42339cbccf5710d5fb61d790a5a9e6c9fc610d0a9acfa468cb1023f80e5a6b
3 | size 676381
4 |
--------------------------------------------------------------------------------
/Optimization/LsTvSolversAnalysis/ChambolleGradient.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:13f1aa46298d3dbb6e1ddba7b84cf768cdacb61f28391bc4ed6799f37ce8b5c6
3 | size 34031
4 |
--------------------------------------------------------------------------------
/Optimization/SteepestDescent/SteepestDescentNorms.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:b3ac1b32272af9856649aaebddbe3a1815c4942ebde60f252e89eef483663973
3 | size 170999
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoiseReducedPulloutStd6.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:fd7d551de32bc18a6c4785490a6e7b3b3dc26e3fcef1455cf2a96da2256e34e0
3 | size 89718
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoiseReduction001Std1.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:bd144a76b6851bc61c2cfc64e0a7f4a207e0486d7ac1b72f48f3a199d1cc87a8
3 | size 11023
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoiseReduction002Std6.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:8fa2af968f1c6696b8467dd876ae92cc7f8fe708c5b219ab11985712b31ebebb
3 | size 11282
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/NoiseReduction003Std11.PNG:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:c41bfa4dfb0f556aca02b417f6f41f4d282f64fab213d3ed01f9a7bb36ccef61
3 | size 11167
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/Pullout100SingularValues.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:4dbd6c0b41b8b99969365a28cc8b4466020aa0242d6128c95fd9ea3ffd276f1b
3 | size 120308
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/Pullout10SingularValues.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:2101f04d17426e8ff02c76746a54f507b4888f35c857167630a176fd51a47d8a
3 | size 71581
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/Pullout1SingularValues.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:3c4301f42682cd195670ac9bc39178519e2b85d3e5e2364fbc5eaa52c2a94a73
3 | size 37987
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/Pullout200SingularValues.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:25ffed9a7ff1ad4a25d1f5ed5113b8454b01ca5a46e348dea798e38dc339cc77
3 | size 119984
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/Pullout240SingularValues.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:31bf58658695a5a2135f89c5d29fd15ac33a697e3f7a2af6660ac287604849d6
3 | size 119056
4 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/Pullout100SingularValuesColor.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:156099ab76df12a2263d965e086d985a6be537b1d68aca288e1b18a8d72c3a5e
3 | size 211275
4 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ImageToHTML/doc/im2html-screenshot.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:e6f80776f5fe146b670b8cad618db861f9edb930cb66c038ee0762078e677720
3 | size 30924
4 |
--------------------------------------------------------------------------------
/Optimization/ProxFunctions/Optimization II - Final Project.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:ca83624abcf06807e7a85b898b8aeb817a76aa8432dc6f0e7823fc01c406bf18
3 | size 1369672
4 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/The Frank Wolfe Algorithm.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:cc2a0cec27f818d1a1977267dfe6a24bc2f1436a534d2d58a88701d24344c67c
3 | size 35696
4 |
--------------------------------------------------------------------------------
/EstimateFrequency/EECE 522 Notes 08 Chapter 3 CRLB Examples in Book.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:183dad33c0886185f749b72b4af81c95f40c79ab1ef7a84474e6637e1a6ec228
3 | size 160120
4 |
--------------------------------------------------------------------------------
/DynamicTimeWarping/Everything You Know About Dynamic Time Warping is Wrong.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:a00ce1b38962ffdf4a0719c6c253ccab432a723c9ed735a3c4b2fefe41a53bbb
3 | size 1519345
4 |
--------------------------------------------------------------------------------
/ImageToColumns/ImageToColumns/ImageToColumnsMain.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | #define DATA_TYPE float
4 | // #define DATA_TYPE double
5 |
6 | void ImageToColumns(DATA_TYPE* mO, DATA_TYPE* mI, int numRows, int numCols, int blockRadius);
7 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/A Primer on Coordinate Descent Algorithms.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:a7188cb53d70b36091b3421438a2f00ef40d9740eab33026f5ba519160777066
3 | size 1308859
4 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/Coordinate Descent for L1 Minimization.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:05fe5c4b6214b2148b5a1aa70536bb1b21c108d388e702c763ccbefe6ee30ea6
3 | size 2123932
4 |
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvml/SleefVsSvml.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/EstimateFrequency/Steven Kay - A Fast and Accurate Single Frequency Estimator.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:36f66287299717d3272f4818ed8f02f94ffbc6b836546c687c306b6459cdaa14
3 | size 380700
4 |
--------------------------------------------------------------------------------
/ImageToColumns/ImageToColumns/ImageToColumns.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/Proximal Gradient Method and Its Acceleration.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:9e1e978a3f3f6a90cfd0d207181e206fdc1ac0db04cc658bcaeb23f9c0456503
3 | size 445689
4 |
--------------------------------------------------------------------------------
/Optimization/LsTvSolversAnalysis/Proximal Splitting Methods in Signal Processing.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:489b8619f29dab653a9fb9ceaf89717717cc719842c7ffe318c1a8ff04a97873
3 | size 370512
4 |
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvmlDll/SleefVsSvmlDll.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Localization/README.md:
--------------------------------------------------------------------------------
1 | # Localization
2 | Simulation of Localization Methods
3 |
4 | ## TDOA
5 |
6 | Methods based on the Time Difference of Arrival:
7 |
8 | * Derivation of the TDOA.
9 | * Concept of Sync Free.
10 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/A Tutorial on the LASSO and the Shooting Algorithm.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:02ce7b448a03d49c0cfb0f5567514a1f09a685fbc8e54c0603fec73dacae54b3
3 | size 252199
4 |
--------------------------------------------------------------------------------
/DynamicTimeWarping/FastDTW - Toward Accurate Dynamic Time Warping in Linear Time and Space.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:ed7bb36a4f9d2ebbfdb267427dc3d947e90ec523905103a9d01f9f6ef9d1df01
3 | size 167218
4 |
--------------------------------------------------------------------------------
/ImageConvolution/ImageConvolution/ImageConvolution.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/Least Squares Optimization with L1 Norm Regularization.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:130650df79caf41ea55c0d0135ac32a863fd5b000cfe2e196005de16761e9c5d
3 | size 106996
4 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrix/CalcDistanceMatrix.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/EstimateFrequency/Phase and Frequency Estimation - High Accuracy and Low Complexity Techniques.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:bd38a9af24c34534427137e4d743edc4aa568acc206c007227388ee68791059e
3 | size 822687
4 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Martin Jaggi - Frank Wolfe - Optimization Algorithms.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:20af6724c40f7c69986c9472d3d9c0ca2e029298871ea82f712c8e3e83ad5716
3 | size 15746551
4 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ImageToHTML/+se/+utils/spaces.m:
--------------------------------------------------------------------------------
1 | function s = spaces(n)
2 | %spaces Vector of space characters
3 |
4 | % Steve Eddins
5 | % Copyright 2011 The MathWorks, Inc.
6 |
7 | s = char(zeros(1,n));
8 | s(:) = ' ';
9 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrixDll/CalcDistanceMatrixDll.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilter/ImageBilateralFilter.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Optimization/LsTvSolversAnalysis/Alternating Direction Optimization for Imaging Inverse Problems.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:1d5a791a1f46407502d554a3829779a0c48ee9ff8a64d3832cae3d0450901ac6
3 | size 2340293
4 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilterDll/ImageBilateralFilterDll.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Resources.md:
--------------------------------------------------------------------------------
1 | # Resources
2 | Various resourceful resources.
3 |
4 | ## LaTeX
5 | * Block Matrices in LaTeX: [Part I][1], [Part II][2].
6 |
7 |
8 | [1]: http://www.alecjacobson.com/weblog/?p=1281
9 | [2]: http://www.alecjacobson.com/weblog/?p=1289
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilterIntel/ImageBilateralFilterIntel.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Revisiting Frank Wolfe - Projection Free Sparse Convex Optimization.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:a3fff8e62d4cb96a95247951ea3101af99226aed5d16dedb3b7cbdc994d82cd7
3 | size 2587860
4 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilterDllIntel/ImageBilateralFilterDllIntel.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - Part 001.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:bd76359a2ebcbda929058bd0b5cd0948b7f82120355f7a4480fd83a87efe22a8
3 | size 24866249
4 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - Part 002.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:f906403ba4f9a6082933a1256bda1471b989af00491c73754f82bfd2bd086d74
3 | size 27781791
4 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Revisiting Frank Wolfe - Projection Free Sparse Convex Optimization - Paper.pdf:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:26446809e3770656d1fea7a2105f203d058b299033043e30f31ba524d8875600
3 | size 941918
4 |
--------------------------------------------------------------------------------
/LinearSegmentation/Project.toml:
--------------------------------------------------------------------------------
1 | [deps]
2 | CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
3 | Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
4 | StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
5 | UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
6 |
--------------------------------------------------------------------------------
/DynamicTimeWarping/README.md:
--------------------------------------------------------------------------------
1 | # Dynamic Time Warping
2 |
3 | ## General
4 | This project introduce the [Dynamic Time Wraping](https://en.wikipedia.org/wiki/Dynamic_time_warping) concept.
5 |
6 | ## How to Run
7 | Run the `DynamicTimeWarpingAnalysis.m` file using MATLAB.
8 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrix002.m:
--------------------------------------------------------------------------------
1 | function [ mDistMat ] = CalcDistanceMatrix002( mA, mB )
2 | %UNTITLED Summary of this function goes here
3 | % Detailed explanation goes here
4 |
5 | mDistMat = sum(mA .^ 2).' - (2 * mA.' * mB) + sum(mB .^ 2);
6 |
7 |
8 | end
9 |
10 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ImageToHTML/+se/+utils/rgbToHtmlHex.m:
--------------------------------------------------------------------------------
1 | function s = rgbToHtmlHex(rgb)
2 | %rgbToHtmlHex Convert RGB triple to HTML hex string
3 |
4 | % Steve Eddins
5 | % Copyright 2011 The MathWorks, Inc.
6 |
7 | rgb = rgb(:)';
8 | rgb = im2uint8(rgb);
9 | s = dec2hex(rgb, 2)';
10 | s = ['#' s(:)'];
11 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrix001.m:
--------------------------------------------------------------------------------
1 | function [ mDistMat ] = CalcDistanceMatrix001( mA, mB )
2 | %UNTITLED Summary of this function goes here
3 | % Detailed explanation goes here
4 |
5 | numSamples001 = size(mA, 2);
6 | numSamples002 = size(mB, 2);
7 |
8 | mDistMat = zeros([numSamples001, numSamples002], 'single');
9 |
10 | for ii = 1:numSamples001
11 | mDistMat(ii, :) = sum((mA(:, ii) - mB) .^ 2);
12 | end
13 |
14 |
15 | end
16 |
17 |
--------------------------------------------------------------------------------
/EstimateFrequency/Project.toml:
--------------------------------------------------------------------------------
1 | [deps]
2 | BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3 | FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
4 | MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
5 | MKL = "33e6dc65-8f57-5167-99aa-e5a354878fb2"
6 | Optim = "429524aa-4258-5aef-a3af-852621145aeb"
7 | PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
8 | StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
9 | UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
10 |
--------------------------------------------------------------------------------
/Clustering/DebugErrors.m:
--------------------------------------------------------------------------------
1 |
2 | clear('all'); clc();
3 | load('Error005.mat');
4 | % load('Error004.mat'); % Different first item
5 |
6 | [vClusterIdx, vMedoidIdx] = ClusterLpStability(mD, paramMu, maxNumMedoids);
7 | vMedoidIdxM = ClusterLpStabilityMex(mD, paramMu, maxNumMedoids);
8 |
9 | assert(isequal(sort(vMedoidIdxM(1)), sort(vMedoidIdx(1))));
10 | assert(isequal(sort(vMedoidIdxM(:)), sort(vMedoidIdx(:))));
11 | assert(isequal((vMedoidIdxM(:)), (vMedoidIdx(:))));
12 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/matrix_completion_squared_error_gradient.m:
--------------------------------------------------------------------------------
1 | function g = matrix_completion_squared_error_nabla(X,Y)
2 | % Matrix completion squared error objective:
3 | % min_X (1/2)(X(Y~=0) - Y(Y~=0))^2
4 |
5 | [rows,cols,vals] = find(Y);
6 |
7 | % Compute objective
8 | preds = X(Y~=0);
9 | M = preds - vals;
10 | %f = sum(M(:).^2)/2;
11 |
12 | % Compute gradient
13 | g = sparse(rows,cols,M);
--------------------------------------------------------------------------------
/Optimization/InterriorPoint/LineSearchBackTracking.m:
--------------------------------------------------------------------------------
1 | function [ stepSize ] = LineSearchBackTracking( hObjFun, vX, vD, paramAlpha )
2 | %UNTITLED6 Summary of this function goes here
3 | % Detailed explanation goes here
4 |
5 | stepSize = 1;
6 |
7 | vY = vX + (stepSize * vD);
8 | objVal = hObjFun(vX);
9 |
10 | while(hObjFun(vY) > objVal)
11 |
12 | stepSize = paramAlpha * stepSize;
13 | vY = vX + (stepSize * vD);
14 |
15 | end
16 |
17 |
18 | end
19 |
20 |
--------------------------------------------------------------------------------
/AuxiliaryFunctions/Project.toml:
--------------------------------------------------------------------------------
1 | [deps]
2 | BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3 | ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
4 | FastLapackInterface = "29a986be-02c6-4525-aec4-84b980013641"
5 | LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
6 | Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
7 | Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
8 | StaticKernels = "4c63dfa8-a427-4548-bd2f-4c19e87a7dc7"
9 | UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
10 |
--------------------------------------------------------------------------------
/ImageConvolution/ImageConvolution/ImageConvolutionMain.h:
--------------------------------------------------------------------------------
1 |
2 | void ImageConvolution(float* mO, float* mI, int numRows, int numCols, float* mConvKernel, int kernelNumRows, int kernelNumCols);
3 | void ImageConvolutionSeparableKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float* vRowKernel, int rowKernelLength, float* vColKernel, int colKernelLength);
4 | void ImageConvolutionGaussianKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float gaussianStd, int stdToRadiusFactor);
5 |
--------------------------------------------------------------------------------
/Localization/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/LevinsonRecursion/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/DeepLearningMatchedFilter/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/matrix_completion_squared_error.m:
--------------------------------------------------------------------------------
1 | function [f,g] = matrix_completion_squared_error(X,Y)
2 | % Matrix completion squared error objective:
3 | % min_X (1/2)(X(Y~=0) - Y(Y~=0))^2
4 |
5 | [rows,cols,vals] = find(Y);
6 |
7 | % Compute objective
8 | preds = X(Y~=0);
9 | M = preds - vals;
10 | f = sum(M(:).^2)/2;
11 |
12 | if nargout > 1
13 | % Compute gradient
14 | g = sparse(rows,cols,M);
15 | end
16 |
--------------------------------------------------------------------------------
/Optimization/InterriorPoint/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/Optimization/ConvexSetProjection/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/Optimization/LsTvSolversAnalysis/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/README.md:
--------------------------------------------------------------------------------
1 | # Image Bilateral Filter
2 |
3 | Projects for implementing Bilateral Filter.
4 |
5 | ## Fast Compressive Bilateral Filter
6 |
7 |
8 | ## Implementation Details
9 |
10 | ### Remarks
11 | * A
12 |
13 | ## How To Build
14 | Use *CMake* (`cmake`) to build.
15 | Supports MSVC / GCC / ICC and CLang on Windows, macOS and Linux.
16 |
17 | ### Release Notes
18 | * A
19 |
20 | ## Known Issues
21 | * B
22 |
23 | ## To Do List
24 | * C
25 |
26 | ## License
27 | Free for non commercial use.
28 |
29 |
--------------------------------------------------------------------------------
/Optimization/LsL0SolversAnalysis/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/ClickableLegend.m:
--------------------------------------------------------------------------------
1 | function [ hLegendObject ] = ClickableLegend( varargin )
2 |
3 |
4 | hLegendObject = legend(varargin{:});
5 |
6 | set(hLegendObject, 'ItemHitFcn', @ToggleVisibility)
7 |
8 |
9 | end
10 |
11 |
12 | function [ ] = ToggleVisibility ( hLegendObj, sEventData )
13 |
14 | switch(sEventData.Peer.Visible)
15 | case('on')
16 | sEventData.Peer.Visible = 'off';
17 | case('off')
18 | sEventData.Peer.Visible = 'on';
19 | end
20 |
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ImageToHTML/doc/description.txt:
--------------------------------------------------------------------------------
1 | File Exchange description
2 |
3 | SUMMARY
4 |
5 | Convert image pixels to HTML table showing pixel colors and values
6 |
7 | DESCRIPTION
8 |
9 | im2html produces HTML text containing a table that displays the image
10 | pixel colors and values. When called with no output argument, im2html
11 | displays the HTML in the MATLAB Web Browser. When called with an output
12 | argument, im2html returns the HTML text as a string. This form can be
13 | useful when publishing a MATLAB file.
--------------------------------------------------------------------------------
/ImageTracking/Project.toml:
--------------------------------------------------------------------------------
1 | [deps]
2 | ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
3 | FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
4 | ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
5 | Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
6 | LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
7 | MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
8 | PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
9 | Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
10 | StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
11 | StaticKernels = "4c63dfa8-a427-4548-bd2f-4c19e87a7dc7"
12 |
--------------------------------------------------------------------------------
/DynamicTimeWarping/DrawLinesBetweenCurves.m:
--------------------------------------------------------------------------------
1 | function [ ] = DrawLinesBetweenCurves( vY1Idx, vY1, vY2Idx, vY2, hAxes )
2 | %UNTITLED2 Summary of this function goes here
3 | % Detailed explanation goes here
4 |
5 | FALSE = 0;
6 | TRUE = 1;
7 | OFF = 0;
8 | ON = 1;
9 |
10 | lineWidth = 1;
11 | vLineColor = 0.35 * ones([1, 3]);
12 |
13 | numLines = size(vY1Idx, 1);
14 |
15 | for ii = 1:numLines
16 | vX = [vY1Idx(ii), vY2Idx(ii)];
17 | vY = [vY1(vY1Idx(ii)), vY2(vY2Idx(ii))];
18 | hLineSeries = line(hAxes, vX, vY);
19 | set(hLineSeries, 'LineWidth', lineWidth, 'Color', vLineColor);
20 | end
21 |
22 |
23 | end
24 |
25 |
--------------------------------------------------------------------------------
/LevinsonRecursion/LevinsonRecursionToeplitzMatrix.h:
--------------------------------------------------------------------------------
1 | #define SSE_ALIGNMENT 16
2 |
3 | #include
4 | #include
5 |
6 |
7 | #ifndef DLL_TEMPLATE
8 | #define DLL_TEMPLATE
9 |
10 | #ifdef _WIN32
11 | #ifdef EXPORT_FCNS
12 | #define EXPORTED_FUNCTION __declspec(dllexport)
13 | #else
14 | #define EXPORTED_FUNCTION __declspec(dllimport)
15 | #endif
16 | #else
17 | #define EXPORTED_FUNCTION
18 | #endif
19 |
20 | #ifdef __cplusplus
21 | extern "C" {
22 | #endif
23 |
24 | EXPORTED_FUNCTION void LevinsonRecursionToeplitzMatrix(float *mT, float *vY, float *vX, int numRows);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
30 | #endif
31 |
32 |
--------------------------------------------------------------------------------
/ImageToColumns/ImageToColumnsDll/ImageToColumnsDll.h:
--------------------------------------------------------------------------------
1 | #ifndef DLL_TEMPLATE
2 | #define DLL_TEMPLATE
3 |
4 | #define DATA_TYPE float
5 | // #define DATA_TYPE double
6 |
7 | #ifdef _WIN32
8 | #ifdef EXPORT_FCNS
9 | #define EXPORTED_FUNCTION __declspec(dllexport)
10 | #else
11 | #define EXPORTED_FUNCTION __declspec(dllimport)
12 | #endif
13 | #else
14 | #define EXPORTED_FUNCTION
15 | #endif
16 |
17 | #ifdef __cplusplus
18 | extern "C" {
19 | #endif
20 |
21 | EXPORTED_FUNCTION void ImageToColumns(DATA_TYPE* mO, DATA_TYPE* mI, int numRows, int numCols, int blockRadius);
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
27 | #endif
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/SingularValueDecomposition/README.md:
--------------------------------------------------------------------------------
1 | # Singular Value Decomposition
2 | A Presentation about [Singular Value Decomposition](https://en.wikipedia.org/wiki/Singular_value_decomposition) (SVD).
3 | It covers the following:
4 |
5 | * Singular Value Theorem.
6 | * Applications
7 | * Order Reduction.
8 | * Solving Linear Equation System (Least Squares).
9 | * Total Least Squares.
10 | * [Principal Component Analysis](https://en.wikipedia.org/wiki/Principal_component_analysis) (PCA).
11 |
12 | The PDF can be viewed directly - [SVD Presentation PDF](https://docs.google.com/viewer?url=https://github.com/RoyiAvital/Projects/raw/master/SingularValueDecomposition/SVD.pdf).
13 |
--------------------------------------------------------------------------------
/DynamicTimeWarping/DisplayMatrixValues.m:
--------------------------------------------------------------------------------
1 | function [ hImageObj ] = DisplayMatrixValues( mInputData, hAxes )
2 | %UNTITLED2 Summary of this function goes here
3 | % Detailed explanation goes here
4 |
5 | FALSE = 0;
6 | TRUE = 1;
7 | OFF = 0;
8 | ON = 1;
9 |
10 | formatSpec = '%1.2f';
11 |
12 | numRows = size(mInputData, 1);
13 | numCols = size(mInputData, 2);
14 |
15 | hImageObj = imagesc(hAxes, mInputData);
16 |
17 | for ii = 1:numRows
18 | for jj = 1:numCols
19 | hTextObj = text(hAxes, jj, ii, num2str(mInputData(ii, jj), formatSpec), ...
20 | 'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle');
21 | end
22 | end
23 |
24 |
25 | end
26 |
27 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/demo/show_progress.m:
--------------------------------------------------------------------------------
1 | function show_progress(progress,x,s,p,T,r)
2 | % visualize progress, x and the current s
3 | subplot(2,1,1);
4 | plot(progress,'LineWidth',2,'Color',[1,0,0]);
5 | xlim([0 T]);
6 | legend('objective value')
7 | xlabel('iteration t')
8 |
9 | subplot(2,1,2);
10 | bar(1:p,s,1,'FaceColor',[0,0.7,0.7],'EdgeColor',[0,0.7,0.7]);
11 | ylim([-r r]);
12 | hold on
13 |
14 | bar(1:p,x,0.7,'FaceColor',[0.2,0.2,0.5],'EdgeColor','none');
15 | hold off
16 | xlabel('coordinate')
17 | legend('s','x') % add legend
18 | drawnow
19 | end
--------------------------------------------------------------------------------
/EstimateFrequency/GolayFilter.m:
--------------------------------------------------------------------------------
1 |
2 | clear();
3 | close('all');
4 | load('DataSmoothing.mat');
5 |
6 | % Parameters
7 | polyDeg = 3;
8 | kernelRadius = 2;
9 |
10 | % Solution
11 |
12 | mJ = (-kernelRadius:kernelRadius).' .^ (0:polyDeg);
13 | mC = (mJ.' * mJ) \ mJ.'; % 0);
13 | vGaussianGradXKernel(vPosValsIdx) = vGaussianGradXKernel(vPosValsIdx)/sum(vGaussianGradXKernel(vPosValsIdx));
14 | vGaussianGradXKernel(vNegValsIdx) = vGaussianGradXKernel(vNegValsIdx)/abs(sum(vGaussianGradXKernel(vNegValsIdx)));
15 |
16 |
17 | end
18 |
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Folders
2 | SingularValueDecomposition/Code/*
3 | SingularValueDecomposition/KnowledgeBase/*
4 |
5 | **Build/
6 | **x64/
7 |
8 | # Media Files
9 | # *.png
10 | *.jpg
11 | *.bmp
12 | *.tif
13 | *.avi
14 | *.mp4
15 |
16 | # Documnets
17 | *.docx
18 | *.doc
19 | *.xlsx
20 | *.xls
21 | *.pptx
22 | *.ppt
23 | #*.pdf
24 | *.md~
25 |
26 | # Julia
27 | **Manifest.toml
28 |
29 | # MS Office Temp Files
30 | *.docx
31 | *.pptx
32 | *.xlsx
33 |
34 | ## TeX / LaTeX Files
35 | *.aux
36 | *.log
37 | *.synctex*
38 | *.toc
39 | *.out
40 | *.bbl
41 | *.blg
42 | *.nav
43 | *.snm
44 | *.vrb
45 | *eps-converted-to.pdf
46 |
47 | # MATLAB Files
48 | *.asv
49 | *.m~
50 | *.mex*
51 | *.mat
52 |
53 | ## Compilation Files:
54 | **/.vs/*
55 | *.obj
56 | *.pdb
57 | *.ilk
58 | *.tlog
59 | *.idb
60 | *.suo
61 | *.manifest
62 | *.iobj
63 | *.ipdb
64 | *.log
65 | *.VC.db
66 | *.db3
67 | *.exp
68 | *.o
69 | **/x64/*
70 | **/My A*/*
71 |
72 | # Binary Files
73 | *.dll
74 | *.dylib
75 | *.so
76 | *.exe
77 |
78 | # Misc
79 | /Optimization/ConvexSetProjection/*.pdf
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrix/CalcDistanceMatrixDll.h:
--------------------------------------------------------------------------------
1 | #ifndef DLL_TEMPLATE
2 | #define DLL_TEMPLATE
3 |
4 | #ifdef _WIN32
5 | #ifdef EXPORT_FCNS
6 | #define EXPORTED_FUNCTION __declspec(dllexport)
7 | #else
8 | #define EXPORTED_FUNCTION __declspec(dllimport)
9 | #endif
10 | #else
11 | #define EXPORTED_FUNCTION
12 | #endif
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | EXPORTED_FUNCTION void CalcDistanceMatrixVanilla(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
19 | EXPORTED_FUNCTION void CalcDistanceMatrixSse(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
20 | EXPORTED_FUNCTION void CalcDistanceMatrixAvx(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
21 | EXPORTED_FUNCTION void CalcDistanceMatrixEigen(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
22 | EXPORTED_FUNCTION void CalcDistanceMatrixRefTime(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
23 |
24 |
25 | #ifdef __cplusplus
26 | }
27 | #endif
28 |
29 | #endif
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilter/ImageBilateralFilterDll.h:
--------------------------------------------------------------------------------
1 | #ifndef DLL_TEMPLATE
2 | #define DLL_TEMPLATE
3 |
4 | #ifdef _WIN32
5 | #ifdef EXPORT_FCNS
6 | #define EXPORTED_FUNCTION __declspec(dllexport)
7 | #else
8 | #define EXPORTED_FUNCTION __declspec(dllimport)
9 | #endif
10 | #else
11 | #define EXPORTED_FUNCTION
12 | #endif
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | EXPORTED_FUNCTION void ImageConvolution(float* mO, float* mI, int numRows, int numCols, float* mConvKernel, int kernelNumRows, int kernelNumCols);
19 | EXPORTED_FUNCTION void ImageConvolutionSeparableKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float* vRowKernel, int rowKernelLength, float* vColKernel, int colKernelLength);
20 | EXPORTED_FUNCTION void ImageConvolutionGaussianKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float gaussianStd, int stdToRadiusFactor);
21 | EXPORTED_FUNCTION void BilateralFilterFastCompressive(float* mO, float* mI, int numRows, int numCols, float spatialStd, float rangeStd, int paramK);
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
27 | #endif
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/EstimateFrequency/EstSingleHramonicRef.bib:
--------------------------------------------------------------------------------
1 | @inproceedings{kour2014real,
2 | title={Real-time segmentation of on-line handwritten arabic script},
3 | author={Kour, George and Saabne, Raid},
4 | booktitle={Frontiers in Handwriting Recognition (ICFHR), 2014 14th International Conference on},
5 | pages={417--422},
6 | year={2014},
7 | organization={IEEE}
8 | }
9 |
10 | @inproceedings{kour2014fast,
11 | title={Fast classification of handwritten on-line Arabic characters},
12 | author={Kour, George and Saabne, Raid},
13 | booktitle={Soft Computing and Pattern Recognition (SoCPaR), 2014 6th International Conference of},
14 | pages={312--318},
15 | year={2014},
16 | organization={IEEE},
17 | doi={10.1109/SOCPAR.2014.7008025}
18 | }
19 |
20 | @inproceedings{keshet2016prediction,
21 | title={Prediction-Based, Prioritized Market-Share Insight Extraction},
22 | author={Keshet, Renato and Maor, Alina and Kour, George},
23 | booktitle={Advanced Data Mining and Applications: 12th International Conference, ADMA 2016, Gold Coast, QLD, Australia, December 12-15, 2016, Proceedings 12},
24 | pages={81--94},
25 | year={2016},
26 | organization={Springer}
27 | }
28 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ImageToHTML/im2html_sample_stylesheet.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Sample stylesheet for use with im2html.m
3 | *
4 | * This sample stylesheet is provided to illustrate how to customize display
5 | * styles. It displays image pixels with thick red borders and pixel values
6 | * with either yellow text (on dark pixels) or blue text (on light pixels).
7 | *
8 | * Steve Eddins
9 | * Copyright 2011 The MathWorks, Inc.
10 | */
11 |
12 | .image-table {
13 | border: thick solid red;
14 | border-collapse: collapse;
15 | table-layout: fixed;
16 | }
17 |
18 | .light-pixel-cell {
19 | font-size: small;
20 | font-family: Consolas, ''Courier New'', monospace;
21 | border-style: solid;
22 | border-width: thick;
23 | border-color: red;
24 | padding: 0;
25 | height: 4.5em;
26 | width: 4.5em;
27 | text-align: center;
28 | color: blue;
29 | }
30 |
31 | .dark-pixel-cell {
32 | font-size: small;
33 | font-family: Consolas, ''Courier New'', monospace;
34 | border-style: solid;
35 | border-width: thick;
36 | border-color: red;
37 | padding: 0;
38 | height: 4.5em;
39 | width: 4.5em;
40 | text-align: center;
41 | color: yellow;
42 | }
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilter/ImageBilateralFilterMain.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ImageBilateralFilter.h"
3 |
4 | #define UNIT_TEST_IMAGE_GAUSSIAN_BLUR 1
5 | #define UNIT_TEST_IMAGE_BILATERAL_FILTER 2
6 |
7 | // Main Functions
8 | void ImageConvolution(float* mO, float* mI, int numRows, int numCols, float* mConvKernel, int kernelNumRows, int kernelNumCols);
9 | void ImageConvolutionSeparableKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float* vRowKernel, int rowKernelLength, float* vColKernel, int colKernelLength);
10 | void ImageConvolutionGaussianKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float gaussianStd, int stdToRadiusFactor);
11 | void BilateralFilterFastCompressive(float* mO, float* mI, int numRows, int numCols, float spatialStd, float rangeStd, int paramK);
12 |
13 | // Unit Test Functions
14 | void ImageConvolutionGaussianKernelUnitTest(int numRows, int numCols, int numIter, float gaussianStd, int stdToRadiusFactor);
15 | void BilateralFilterFastCompressiveUnitTest(int numRows, int numCols, int numIter, float spatialStd, float rangeStd, int paramK);
16 |
17 |
18 | // Auxiliary Functions
19 | void PrintRunTimeData(double *vRunTime, int numIter);
20 | int QSortCompFunDouble(const void * a, const void * b);
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/FW_lasso.m:
--------------------------------------------------------------------------------
1 | n=150; % # rows in A
2 | p=20; % dimension of w, # columns of A, variables in x
3 | t=p/4; % number of non-zeros in the true solution xstar
4 | A=randn(n,p);
5 | xstar=[ones(t,1); -ones(t,1); -zeros(p-2*t,1)];
6 | noise=0.1*randn(n,1);
7 | b=A*xstar+noise;
8 | [n,p] = size(A);
9 |
10 | T = 50; % number of iterations
11 |
12 | r = 1; % the regularization constraint imposed on the l_1-norm
13 |
14 |
15 | x = zeros(p,1);
16 | Ax = A*x;
17 |
18 | t=0; i=0;
19 | for t = 0:T
20 | % call the LMO
21 | [ res i ] = max( abs(A' *(Ax-b)), [], 1 );
22 |
23 | stepSign = sign( A(:,i)' *(b-Ax) ); % = sign of -gradF[i]
24 | s = zeros(p,1); s(i) = stepSign*r;
25 | As = stepSign*r*A(:,i); % = the i-th column of the dictionary matrix A
26 |
27 | As_minus_Ax = As - Ax;
28 | stepSize = max(0, min(1, As_minus_Ax' * (b-Ax) / (As_minus_Ax' * As_minus_Ax)));
29 | %stepSize = 2 / (t+2);
30 |
31 | x = (1-stepSize)*x + stepSize*s; % do the FW step
32 | Ax = (1-stepSize)*Ax + stepSize*As; % update Ax
33 |
34 | f_at_x = sum((Ax-b).^2)/2;
35 | fprintf('t=%d - f=%f - i=%d - stepsize=%d \n',t,f_at_x,i,stepSize);
36 | end
37 |
38 |
--------------------------------------------------------------------------------
/ImageToColumns/GCC/CompileSoGcc.m:
--------------------------------------------------------------------------------
1 | % Compile DLL Using GCC
2 | %
3 | % References:
4 | % 1. https://linux.die.net/man/1/gcc.
5 | % 2. http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/.
6 | % Remarks:
7 | % 1. Matrix is assumed to be n x n in size.
8 | % TODO:
9 | % 1. Add Eigen based implementation.
10 | % Release Notes
11 | % - 1.0.000 04/08/2017
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | run('../InitScript.m');
18 |
19 | figureIdx = 0;
20 | figureCounterSpec = '%04d';
21 |
22 | generateFigures = OFF;
23 |
24 |
25 | %% Set System Enviorment (PATH Variable)
26 |
27 |
28 |
29 |
30 | %% Set Compiling Flags
31 |
32 |
33 | %% Compile
34 |
35 | gccCommand01 = 'gcc -O3 -fopenmp -fpic ../ImageConvolution/ImageConvolution.c ../ImageConvolution/ImageConvolutionGaussianKernel.c ../ImageConvolution/ImageConvolutionSeparableKernel.c -c -D _USRDLL';
36 | gccCommand02 = 'gcc -O3 -fopenmp -o ImageConvolutionDll.so -shared -s ImageConvolution.o ImageConvolutionSeparableKernel.o ImageConvolutionGaussianKernel.o';
37 |
38 | system(gccCommand01);
39 | system(gccCommand02);
40 |
41 |
42 | %% Restore Defaults
43 |
44 | % set(0, 'DefaultFigureWindowStyle', 'normal');
45 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
46 |
47 |
--------------------------------------------------------------------------------
/LevinsonRecursion/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 | %% General Parameters
12 | close('all');
13 | clear();
14 | clc();
15 |
16 | % set(0, 'DefaultFigureWindowStyle', 'docked');
17 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
18 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
19 |
20 | figPosSmall = [100, 100, 400, 300];
21 | figPosMedium = [100, 100, 800, 600];
22 | figPosLarge = [100, 100, 960, 720];
23 | figPosDefault = [100, 100, 560, 420];
24 |
25 | fontSizeTitle = 14;
26 | fontSizeAxis = 12;
27 | fontSizeString = 12;
28 |
29 | lineWidthThin = 1;
30 | lineWidthNormal = 3;
31 | lineWidthThick = 4;
32 |
33 | markerSizeSmall = 4;
34 | markerSizeNormal = 8;
35 | markerSizeLarge = 10;
36 |
37 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
38 | subStreamNumber = round(sum(clock()));
39 | % subStreamNumber = 162;
40 | % subStreamNumber = 2122;
41 | set(randomNumberStream, 'Substream', subStreamNumber);
42 | RandStream.setGlobalStream(randomNumberStream);
43 |
44 | FALSE = 0;
45 | TRUE = 1;
46 |
47 | OFF = 0;
48 | ON = 1;
49 |
50 |
--------------------------------------------------------------------------------
/ImageConvolution/GCC/CompileSoGcc.m:
--------------------------------------------------------------------------------
1 | % Compile DLL Using GCC
2 | %
3 | % References:
4 | % 1. https://linux.die.net/man/1/gcc.
5 | % 2. http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/.
6 | % Remarks:
7 | % 1. Matrix is assumed to be n x n in size.
8 | % TODO:
9 | % 1. Add Eigen based implementation.
10 | % Release Notes
11 | % - 1.0.000 04/08/2017
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | run('../InitScript.m');
18 |
19 | figureIdx = 0;
20 | figureCounterSpec = '%04d';
21 |
22 | generateFigures = OFF;
23 |
24 |
25 | %% Set System Enviorment (PATH Variable)
26 |
27 |
28 |
29 |
30 | %% Set Compiling Flags
31 |
32 |
33 | %% Compile
34 |
35 | gccCommand01 = 'gcc -O3 -fopenmp -fpic ../ImageConvolution/ImageConvolution.c ../ImageConvolution/ImageConvolutionGaussianKernel.c ../ImageConvolution/ImageConvolutionSeparableKernel.c -c -D _USRDLL';
36 | gccCommand02 = 'gcc -O3 -fopenmp -o ImageConvolutionDll.so -shared -s ImageConvolution.o ImageConvolutionSeparableKernel.o ImageConvolutionGaussianKernel.o';
37 |
38 | system(gccCommand01);
39 | system(gccCommand02);
40 |
41 |
42 | %% Restore Defaults
43 |
44 | % set(0, 'DefaultFigureWindowStyle', 'normal');
45 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
46 |
47 |
--------------------------------------------------------------------------------
/EstimateFrequency/Derivatives001.m:
--------------------------------------------------------------------------------
1 |
2 | clear();
3 | close('all');
4 |
5 | numSamples = 1000;
6 | valF = 0.5 * rand();
7 |
8 | vN = 0:(numSamples - 1);
9 | vN = vN(:);
10 |
11 | vY = rand(numSamples, 1);
12 | hG = @(valF) G(valF, vN, vY);
13 | hDerG = @(valF) DerG(valF, vN, vY);
14 |
15 | numericGrad = CalcFunGrad(valF, hG);
16 | analyticGrad = hDerG(valF);
17 |
18 | disp(['Numeric 1st Derivative: ', num2str(numericGrad), ', Analytic 1st Derivative: ', num2str(analyticGrad)]);
19 |
20 | disp(['Numeric 2nd Derivative: ', num2str(CalcFunGrad(valF, hDerG)), ', Analytic 2nd Derivative: ', num2str(analyticGrad)]);
21 |
22 |
23 | function [ outVal ] = G( valF, vN, vY )
24 |
25 | mX = [sin(2 * pi * valF * vN), cos(2 * pi * valF * vN)];
26 |
27 | vT = ((mX * ((mX.' * mX) \ (mX.' * vY))) - vY);
28 | outVal = 0.5 * sum(vT .^ 2);
29 |
30 | end
31 |
32 | function [ derVal ] = DerG( valF, vN, vY )
33 |
34 | mX = [sin(2 * pi * valF * vN), cos(2 * pi * valF * vN)];
35 |
36 | mT0 = inv(mX.' * mX);
37 | mT1 = mX * mT0 * mX.' * vY;
38 | mT2 = vY.' * mX * mT0;
39 | mT3 = mT1 - vY;
40 | mT4 = ((mT2 * mX') - vY.') * mX * mT0;
41 | mG = (mT3 * mT2) - ((mT1 * mT4) + (mX * mT0 * mX.' * mT3 * mT2)) + (vY * mT4);
42 |
43 | mT5 = [2 * pi * (vN .* mX(:, 2)), -2 * pi * (vN .* mX(:, 1))];
44 |
45 | derVal = trace(mG.' * mT5);
46 |
47 |
48 | end
--------------------------------------------------------------------------------
/ImageToColumns/ImageToColumnsDll/ImageToColumnsDll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrix/CalcDistanceMatrixMain.cpp:
--------------------------------------------------------------------------------
1 | #include "CalcDistanceMatrixMain.h"
2 |
3 | int main(int argc, char *argv[]) {
4 | int vecDim = 80;
5 | int numRowsA = 6000;
6 | int numRowsB = 4000;
7 | int numInIter = 100;
8 | int unitTestFlag;
9 |
10 | if (argc == 1) {
11 | unitTestFlag = UNIT_TEST_CALC_DISTANCE_MATRIX_VANILLA;
12 | }
13 | else if (argc > 2) {
14 | printf("Error: Number of Argument Is Larger Than 1");
15 | return 0;
16 | }
17 | else { // argc ==2 -> Single Input
18 | unitTestFlag = atoi(argv[1]);
19 | }
20 |
21 | switch (unitTestFlag)
22 | {
23 | case UNIT_TEST_CALC_DISTANCE_MATRIX_VANILLA:
24 | CalcDistanceMatrixVanillaUnitTest(vecDim, numRowsA, numRowsB, numInIter);
25 | break;
26 | case UNIT_TEST_CALC_DISTANCE_MATRIX_SSE:
27 | CalcDistanceMatrixSseUnitTest(vecDim, numRowsA, numRowsB, numInIter);
28 | break;
29 | case UNIT_TEST_CALC_DISTANCE_MATRIX_AVX:
30 | CalcDistanceMatrixAvxUnitTest(vecDim, numRowsA, numRowsB, numInIter);
31 | break;
32 | case UNIT_TEST_CALC_DISTANCE_MATRIX_EIGEN:
33 | CalcDistanceMatrixEigenUnitTest(vecDim, numRowsA, numRowsB, numInIter);
34 | break;
35 | case UNIT_TEST_CALC_DISTANCE_MATRIX_EIGEN_M:
36 | CalcDistanceMatrixEigenMUnitTest(vecDim, numRowsA, numRowsB, numInIter);
37 | break;
38 | default:
39 | printf("Error: Invalid Test Number");
40 | break;
41 | }
42 |
43 |
44 | return 0;
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvml/SleefVsSvmlDll.h:
--------------------------------------------------------------------------------
1 | #ifndef DLL_TEMPLATE
2 | #define DLL_TEMPLATE
3 |
4 | #ifdef _WIN32
5 | #ifdef EXPORT_FCNS
6 | #define EXPORTED_FUNCTION __declspec(dllexport)
7 | #else
8 | #define EXPORTED_FUNCTION __declspec(dllimport)
9 | #endif
10 | #else
11 | #define EXPORTED_FUNCTION
12 | #endif
13 |
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | EXPORTED_FUNCTION void SineSleefSse(float* vO, float* vI, int numElements);
19 | EXPORTED_FUNCTION void SineSleefAvx(float* vO, float* vI, int numElements);
20 | EXPORTED_FUNCTION void SineSvmlSse(float* vO, float* vI, int numElements);
21 | EXPORTED_FUNCTION void SineSvmlAvx(float* vO, float* vI, int numElements);
22 | //EXPORTED_FUNCTION void CosineSleefSse(float* vO, float* vI, int numElements);
23 | //EXPORTED_FUNCTION void CosineSleefAvx(float* vO, float* vI, int numElements);
24 | //EXPORTED_FUNCTION void CosineSvmlSse(float* vO, float* vI, int numElements);
25 | //EXPORTED_FUNCTION void CosineSvmlAvx(float* vO, float* vI, int numElements);
26 | EXPORTED_FUNCTION void ExpSleefSse(float* vO, float* vI, int numElements);
27 | EXPORTED_FUNCTION void ExpSleefAvx(float* vO, float* vI, int numElements);
28 | EXPORTED_FUNCTION void ExpSvmlSse(float* vO, float* vI, int numElements);
29 | EXPORTED_FUNCTION void ExpSvmlAvx(float* vO, float* vI, int numElements);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/demo/FW_nuclear_norm_movielens.m:
--------------------------------------------------------------------------------
1 | %
2 | % Demo code running the Frank-Wolfe algorithm with line-search
3 | % for a nuclear norm constrained problem
4 | % (squared loss matrix completion)
5 | % min ||X-Y||_Obs^2 s.t. ||X||_* <= r
6 | %
7 | % MovieLens100k rating prediction experiment
8 | load('data/movielens100k/randsplit1','data');
9 | % not provided in this code due to license. download directly from
10 | % http://grouplens.org/datasets/movielens/
11 | Y = data; clear data;
12 |
13 | % prepare objective function and gradient
14 | objectiveF = @(X) matrix_completion_squared_error(X,Y);
15 | gradientF = @(X) matrix_completion_squared_error_gradient(X,Y);
16 | [m,n] = size(Y);
17 |
18 | r = 1000; % nuclear norm constraint on X
19 | T = 200;
20 |
21 | %% FW algorithm
22 | X = zeros(m,n); % starting point
23 |
24 | for t = 0:T
25 | [u,s,v] = svds(-gradientF(X),1); % LMO is solved by top singular vector pair
26 | stepSize = 2/(t+2); % or perform line-search
27 | X = (1-stepSize)*X + stepSize* r * u*v';
28 | end
29 |
30 | % NOTE: for larger matrices, don't store the dense iterate X, but just its
31 | % restriction to the train and test entries, or its factorized (rank t)
32 | % representation
33 | fprintf('X after %g iter of FW has error %g and nuclear norm %g \n',T,objectiveF(X),sum(svd(X)));
--------------------------------------------------------------------------------
/Optimization/ProxFunctions/README.md:
--------------------------------------------------------------------------------
1 | # Prox Functions
2 |
3 | This repository is dedicated to have functions which apply the $ \operatorname{Prox}_{\lambda g \left( \cdot \right)} \left( \cdot \right) $ operator.
4 |
5 | The $ \operatorname{Prox}_{\lambda g \left( \cdot \right)} \left( \cdot \right) $ is given by:
6 |
7 | $$ \operatorname{Prox}_{\lambda g \left( \cdot \right)} \left( y \right) = \arg \min_{x} \frac{1}{2} {\left\| x - y \right\|}_{2}^{2} + \lambda g \left( x \right) $$
8 |
9 | The functions in this project solve the problem for various functions $ g \left( \cdot \right) $.
10 |
11 | In this project it is assumed $ x \in \mathbb{R}^{n} $,
12 |
13 | ## Total Variation
14 |
15 | [Total Variation](https://en.wikipedia.org/wiki/Total_variation) (TV) norm is given by:
16 |
17 | $$ {\left\| x \right\|}_{TV} = \sum_{i = 2}^{n} \left| {x}_{i} - {x}_{i - 1} \right| $$
18 |
19 | This yields a formulation as given by:
20 |
21 | $$ \arg \min_{ x \in \mathbb{R}^{n} } \frac{1}{2} {\left\| A x - b \right\|}_{2}^{2} + \lambda {\left\| D x \right\|}_{1} $$
22 |
23 | Where $ D \in \mathbb{R}^{ \left( n - 1 \right) \times n } $ is the Finite Differences operator given by:
24 |
25 | $$ \begin{bmatrix}
26 | -1 & 1 & 0 & \ldots & 0 & 0 \\
27 | 0 & -1 & 1 & 0 & \ldots & 0 \\
28 | \vdots & \vdots & \ddots & & \vdots & \vdots \\
29 | 0 & \ldots & & 0 & -1 & 1
30 | \end{bmatrix} $$
31 |
32 | ## TO DO List
33 | * Look for other methods.
34 |
--------------------------------------------------------------------------------
/ImageToColumns/ImageToColumns/ImageToColumns.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ImageToColumns/ImageToColumns/ImageToColumnsMain.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "ImageToColumnsMain.h"
4 | #include "ImageToColumns.h"
5 |
6 | int main() {
7 | int ii, jj, numRows, numCols, numElements, numIter, blockRadius, blockSize, numPixelsToProcess;
8 | DATA_TYPE *mO, *mI;
9 | clock_t clockStart, clockEnd;
10 | double runTime;
11 |
12 | blockRadius = 5;
13 |
14 | numRows = 2000;
15 | numCols = 2000;
16 |
17 | numIter = 10;
18 |
19 | numElements = numRows * numCols;
20 | blockSize = (2 * blockRadius) + 1;
21 | numPixelsToProcess = (numRows - blockSize + 1) * (numCols - blockSize + 1);
22 |
23 | mO = (DATA_TYPE*)_mm_malloc(numPixelsToProcess * blockSize * blockSize * sizeof(DATA_TYPE), SSE_ALIGNMENT);
24 | mI = (DATA_TYPE*)_mm_malloc(numElements * sizeof(DATA_TYPE), SSE_ALIGNMENT);
25 |
26 | if (mO == NULL) {
27 | return 10;
28 | }
29 | if (mI == NULL) {
30 | return 10;
31 | }
32 |
33 | for (ii = 0; ii < numElements; ii++) {
34 | mI[ii] = (DATA_TYPE)rand();
35 | }
36 |
37 | clockStart = clock();
38 |
39 | clockStart = clock();
40 | for (jj = 0; jj < numIter; jj++) {
41 | ImageToColumns(mO, mI, numRows, numCols, blockRadius);
42 | }
43 | clockEnd = clock();
44 |
45 | runTime = (double)(clockEnd - clockStart) / CLOCKS_PER_SEC;
46 |
47 | printf("Run Time %2.10f\n", runTime);
48 |
49 | _mm_free(mO);
50 | _mm_free(mI);
51 |
52 | getchar();
53 |
54 | return 0;
55 | }
56 |
57 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilter/ImageConvolutionGaussianKernel.c:
--------------------------------------------------------------------------------
1 | #ifdef _USRDLL
2 | #define EXPORT_FCNS
3 | #include "ImageBilateralFilterDll.h"
4 | #endif // _USRDLL
5 |
6 | #ifndef _USRDLL
7 | #include "ImageBilateralFilterMain.h"
8 | #endif // !_USRDLL
9 |
10 | #include "ImageBilateralFilter.h"
11 |
12 | // ------------------------------- ImageConvolutionGaussianKernel ------------------------------- //
13 | void ImageConvolutionGaussianKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float gaussianStd, int stdToRadiusFactor)
14 | {
15 | int ii;
16 | float* vKernelArray;
17 | int kernelRadius, kernelLength;
18 | float gaussianVar, kernelSum;
19 |
20 | // Init Parameters
21 | kernelRadius = (unsigned int)ceilf(stdToRadiusFactor * gaussianStd);
22 | kernelLength = (2 * kernelRadius) + 1;
23 | gaussianVar = gaussianStd * gaussianStd;
24 |
25 | // Init Kernel Array
26 | vKernelArray = (float*)_mm_malloc(kernelLength * sizeof(float), SSE_ALIGNMENT);
27 |
28 | kernelSum = 0;
29 |
30 | for (ii = -kernelRadius; ii <= kernelRadius; ii++) {
31 | vKernelArray[ii + kernelRadius] = expf(-(ii * ii) / (2 * gaussianVar));
32 | kernelSum += vKernelArray[ii + kernelRadius];
33 | }
34 |
35 | for (ii = 0; ii < kernelLength; ii++) {
36 | vKernelArray[ii] /= kernelSum;
37 | }
38 |
39 | ImageConvolutionSeparableKernel(mO, mI, mTmp, numRows, numCols, vKernelArray, kernelLength, vKernelArray, kernelLength);
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/ImageConvolution/ImageConvolution/ImageConvolutionGaussianKernel.c:
--------------------------------------------------------------------------------
1 | #ifdef _USRDLL
2 | #define EXPORT_FCNS
3 | #include "../ImageConvolutionDll/ImageConvolutionDll.h"
4 | #endif // _USRDLL
5 |
6 | #ifndef _USRDLL
7 | #include "ImageConvolutionMain.h"
8 | #endif // !_USRDLL
9 |
10 | #include "ImageConvolution.h"
11 |
12 | // ------------------------------- ImageConvolutionGaussianKernel ------------------------------- //
13 | void ImageConvolutionGaussianKernel(float* mO, float* mI, float* mTmp, int numRows, int numCols, float gaussianStd, int stdToRadiusFactor)
14 | {
15 | int ii;
16 | float* vKernelArray;
17 | int kernelRadius, kernelLength;
18 | float gaussianVar, kernelSum;
19 |
20 | // Init Parameters
21 | kernelRadius = (unsigned int)ceilf(stdToRadiusFactor * gaussianStd);
22 | kernelLength = (2 * kernelRadius) + 1;
23 | gaussianVar = gaussianStd * gaussianStd;
24 |
25 | // Init Kernel Array
26 | vKernelArray = (float*)_mm_malloc(kernelLength * sizeof(float), SSE_ALIGNMENT);
27 |
28 | kernelSum = 0;
29 |
30 | for (ii = -kernelRadius; ii <= kernelRadius; ii++) {
31 | vKernelArray[ii + kernelRadius] = expf(-(ii * ii) / (2 * gaussianVar));
32 | kernelSum += vKernelArray[ii + kernelRadius];
33 | }
34 |
35 | for (ii = 0; ii < kernelLength; ii++) {
36 | vKernelArray[ii] /= kernelSum;
37 | }
38 |
39 | ImageConvolutionSeparableKernel(mO, mI, mTmp, numRows, numCols, vKernelArray, kernelLength, vKernelArray, kernelLength);
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/EstimateFrequency/Derivatives002.m:
--------------------------------------------------------------------------------
1 |
2 | clear();
3 | close('all');
4 |
5 | numSamples = 1000;
6 | valF = 0.5 * rand();
7 |
8 | vN = 0:(numSamples - 1);
9 | vN = vN(:);
10 |
11 | vY = rand(numSamples, 1);
12 | hG = @(valF) G(valF, vN, vY);
13 | hDerG = @(valF) DerG(valF, vN, vY);
14 |
15 | numericGrad = CalcFunGrad(valF, hG);
16 | analyticGrad = hDerG(valF);
17 |
18 | disp(['Numeric 1st Derivative: ', num2str(numericGrad), ', Analytic 1st Derivative: ', num2str(analyticGrad)]);
19 |
20 | % disp(['Numeric 2nd Derivative: ', num2str(CalcFunGrad(valF, hDerG)), ', Analytic 2nd Derivative: ', num2str(analyticGrad)]);
21 |
22 |
23 | function [ outVal ] = G( valF, vN, vY )
24 |
25 | mX = [sin(2 * pi * valF * vN), cos(2 * pi * valF * vN)];
26 |
27 | mZ = mX.' * mX; %
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/FW_nuclear_norm.m:
--------------------------------------------------------------------------------
1 | %
2 | % Demo code running the Frank-Wolfe algorithm with line-search
3 | % for a nuclear norm constrained problem
4 | % (squared loss matrix completion)
5 | % min ||X-Y||_Obs^2 s.t. ||X||_* <= r
6 | %
7 | % MovieLens100k rating prediction experiment
8 | %load('data/movielens100k/randsplit1','data');
9 | % not provided in this code due to license. download directly from
10 | % http://grouplens.org/datasets/movielens/
11 | %Y = data; clear data;
12 | % or try the smaller example:
13 | Y = sparse([1,2,3,4],[1,1,2,1],[1,3,4,5]);
14 |
15 | % prepare objective function and gradient
16 | objectiveF = @(X) matrix_completion_squared_error(X,Y);
17 | gradientF = @(X) matrix_completion_squared_error_gradient(X,Y);
18 | [m,n] = size(Y);
19 |
20 | r = 5; % nuclear norm constraint on X
21 | T = 100;
22 |
23 | %% FW algorithm
24 | X = zeros(m,n); % starting point
25 |
26 | for t = 0:T
27 | [u,s,v] = svds(-gradientF(X),1); % LMO is solved by top singular vector pair
28 | stepSize = 2/(t+2); % or perform line-search
29 | X = (1-stepSize)*X + stepSize* r * u*v';
30 | end
31 |
32 | % NOTE: for larger matrices, don't store the dense iterate X, but just its
33 | % restriction to the train and test entries, or its factorized (rank t)
34 | % representation
35 | fprintf('X after %g iter of FW has error %g and nuclear norm %g \n',T,objectiveF(X),sum(svd(X)));
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvml/PowExpLogFunctions.c:
--------------------------------------------------------------------------------
1 | #define SLEEF_LIB
2 | #include "SleefVsSvml.h"
3 |
4 | #ifdef _USRDLL
5 | #define EXPORT_FCNS
6 | #include "SleefVsSvmlDll.h"
7 | #endif // _USRDLL
8 | #ifndef _USRDLL
9 |
10 | #endif // !_USRDLL
11 |
12 | void ExpSleefSse(float* vO, float* vI, int numElements)
13 | {
14 |
15 | int ii;
16 | __m128 elmI;
17 |
18 | for (ii = 0; ii < numElements; ii += SSE_STRIDE_32B) {
19 | elmI = _mm_loadu_ps(&vI[ii]);
20 | elmI = Sleef_expf4_u10sse4(elmI);
21 | _mm_store_ps(&vO[ii], elmI);
22 | }
23 |
24 |
25 | }
26 |
27 |
28 | void ExpSleefAvx(float* vO, float* vI, int numElements)
29 | {
30 |
31 | int ii;
32 | __m256 elmI;
33 |
34 | for (ii = 0; ii < numElements; ii += AVX_STRIDE_32B) {
35 | elmI = _mm256_loadu_ps(&vI[ii]);
36 | elmI = Sleef_expf8_u10avx2(elmI);
37 | _mm256_store_ps(&vO[ii], elmI);
38 | }
39 |
40 |
41 | }
42 |
43 |
44 | void ExpSvmlSse(float* vO, float* vI, int numElements)
45 | {
46 |
47 | int ii;
48 | __m128 elmI;
49 |
50 | for (ii = 0; ii < numElements; ii += SSE_STRIDE_32B) {
51 | elmI = _mm_loadu_ps(&vI[ii]);
52 | elmI = _mm_exp_ps(elmI);
53 | _mm_store_ps(&vO[ii], elmI);
54 | }
55 |
56 |
57 | }
58 |
59 |
60 | void ExpSvmlAvx(float* vO, float* vI, int numElements)
61 | {
62 |
63 | int ii;
64 | __m256 elmI;
65 |
66 | for (ii = 0; ii < numElements; ii += AVX_STRIDE_32B) {
67 | elmI = _mm256_loadu_ps(&vI[ii]);
68 | elmI = _mm256_exp_ps(elmI);
69 | _mm256_store_ps(&vO[ii], elmI);
70 | }
71 |
72 |
73 | }
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvml.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SleefVsSvml", "SleefVsSvml\SleefVsSvml.vcxproj", "{B7567430-2865-4FA2-8FD8-F8F8D27D178E}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SleefVsSvmlDll", "SleefVsSvmlDll\SleefVsSvmlDll.vcxproj", "{351B6D2C-A13F-4211-A353-1BAF575F270D}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.ActiveCfg = Debug|x64
17 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.Build.0 = Debug|x64
18 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.ActiveCfg = Release|x64
19 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.Build.0 = Release|x64
20 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.ActiveCfg = Debug|x64
21 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.Build.0 = Debug|x64
22 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.ActiveCfg = Release|x64
23 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 | %% General Parameters
12 | close('all');
13 | clear();
14 | clc();
15 |
16 | % set(0, 'DefaultFigureWindowStyle', 'docked');
17 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
18 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
19 |
20 | figPosSmall = [100, 100, 400, 300];
21 | figPosMedium = [100, 100, 800, 600];
22 | figPosLarge = [100, 100, 960, 720];
23 | figPosDefault = [100, 100, 560, 420];
24 |
25 | fontSizeTitle = 14;
26 | fontSizeAxis = 12;
27 | fontSizeString = 12;
28 |
29 | lineWidthThin = 1;
30 | lineWidthNormal = 3;
31 | lineWidthThick = 4;
32 |
33 | markerSizeSmall = 4;
34 | markerSizeNormal = 8;
35 | markerSizeLarge = 10;
36 |
37 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
38 | % https://www.mathworks.com/matlabcentral/answers/160332
39 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
40 |
41 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
42 | subStreamNumber = round(sum(clock()));
43 | % subStreamNumber = 162;
44 | % subStreamNumber = 2145;
45 | set(randomNumberStream, 'Substream', subStreamNumber);
46 | RandStream.setGlobalStream(randomNumberStream);
47 |
48 | FALSE = 0;
49 | TRUE = 1;
50 |
51 | OFF = 0;
52 | ON = 1;
53 |
54 |
--------------------------------------------------------------------------------
/Optimization/InterriorPoint/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 | %% General Parameters
12 | close('all');
13 | clear();
14 | clc();
15 |
16 | % set(0, 'DefaultFigureWindowStyle', 'docked');
17 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
18 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
19 |
20 | figPosSmall = [100, 100, 400, 300];
21 | figPosMedium = [100, 100, 800, 600];
22 | figPosLarge = [100, 100, 960, 720];
23 | figPosDefault = [100, 100, 560, 420];
24 |
25 | fontSizeTitle = 14;
26 | fontSizeAxis = 12;
27 | fontSizeString = 12;
28 |
29 | lineWidthThin = 1;
30 | lineWidthNormal = 3;
31 | lineWidthThick = 4;
32 |
33 | markerSizeSmall = 4;
34 | markerSizeNormal = 8;
35 | markerSizeLarge = 10;
36 |
37 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
38 | % https://www.mathworks.com/matlabcentral/answers/160332
39 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
40 |
41 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
42 | subStreamNumber = round(sum(clock()));
43 | % subStreamNumber = 162;
44 | subStreamNumber = 2145;
45 | set(randomNumberStream, 'Substream', subStreamNumber);
46 | RandStream.setGlobalStream(randomNumberStream);
47 |
48 | FALSE = 0;
49 | TRUE = 1;
50 |
51 | OFF = 0;
52 | ON = 1;
53 |
54 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 |
12 | %% General Parameters
13 | close('all');
14 | clear();
15 | clc();
16 |
17 | % set(0, 'DefaultFigureWindowStyle', 'docked');
18 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
19 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
20 |
21 | figPosSmall = [100, 100, 400, 300];
22 | figPosMedium = [100, 100, 800, 600];
23 | figPosLarge = [100, 100, 960, 720];
24 | figPosDefault = [100, 100, 560, 420];
25 |
26 | fontSizeTitle = 14;
27 | fontSizeAxis = 12;
28 | fontSizeString = 12;
29 |
30 | lineWidthThin = 1;
31 | lineWidthNormal = 3;
32 | lineWidthThick = 4;
33 |
34 | markerSizeSmall = 4;
35 | markerSizeNormal = 8;
36 | markerSizeLarge = 10;
37 |
38 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
39 | % https://www.mathworks.com/matlabcentral/answers/160332
40 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
41 |
42 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
43 | subStreamNumber = round(sum(clock()));
44 | % subStreamNumber = 162;
45 | % subStreamNumber = 20;
46 | set(randomNumberStream, 'Substream', subStreamNumber);
47 | RandStream.setGlobalStream(randomNumberStream);
48 |
49 | FALSE = 0;
50 | TRUE = 1;
51 |
52 | OFF = 0;
53 | ON = 1;
54 |
55 |
--------------------------------------------------------------------------------
/ImageToColumns/ImageToColumns.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageToColumns", "ImageToColumns\ImageToColumns.vcxproj", "{B7567430-2865-4FA2-8FD8-F8F8D27D178E}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageToColumnsDll", "ImageToColumnsDll\ImageToColumnsDll.vcxproj", "{351B6D2C-A13F-4211-A353-1BAF575F270D}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.ActiveCfg = Debug|x64
17 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.Build.0 = Debug|x64
18 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.ActiveCfg = Release|x64
19 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.Build.0 = Release|x64
20 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.ActiveCfg = Debug|x64
21 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.Build.0 = Debug|x64
22 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.ActiveCfg = Release|x64
23 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Optimization/LsL1SolversAnalysis/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 |
12 | %% General Parameters
13 | close('all');
14 | clear();
15 | clc();
16 |
17 | % set(0, 'DefaultFigureWindowStyle', 'docked');
18 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
19 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
20 |
21 | figPosSmall = [100, 100, 400, 300];
22 | figPosMedium = [100, 100, 800, 600];
23 | figPosLarge = [100, 100, 960, 720];
24 | figPosDefault = [100, 100, 560, 420];
25 |
26 | fontSizeTitle = 14;
27 | fontSizeAxis = 12;
28 | fontSizeString = 12;
29 |
30 | lineWidthThin = 1;
31 | lineWidthNormal = 3;
32 | lineWidthThick = 4;
33 |
34 | markerSizeSmall = 4;
35 | markerSizeNormal = 8;
36 | markerSizeLarge = 10;
37 |
38 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
39 | % https://www.mathworks.com/matlabcentral/answers/160332
40 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
41 |
42 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
43 | subStreamNumber = round(sum(clock()));
44 | % subStreamNumber = 162;
45 | subStreamNumber = 2101;
46 | set(randomNumberStream, 'Substream', subStreamNumber);
47 | RandStream.setGlobalStream(randomNumberStream);
48 |
49 | FALSE = 0;
50 | TRUE = 1;
51 |
52 | OFF = 0;
53 | ON = 1;
54 |
55 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Folders
2 | # FolderName/* filter=lfs diff=lfs merge=lfs -text
3 |
4 | # Compressed Files
5 | *.zip filter=lfs diff=lfs merge=lfs -text
6 | *.rar filter=lfs diff=lfs merge=lfs -text
7 | *.7z filter=lfs diff=lfs merge=lfs -text
8 |
9 | # Binary Files
10 | *.exe filter=lfs diff=lfs merge=lfs -text
11 | *.pkg filter=lfs diff=lfs merge=lfs -text
12 | *.dmg filter=lfs diff=lfs merge=lfs -text
13 |
14 | # Binary Libraries
15 | *.dll filter=lfs diff=lfs merge=lfs -text
16 | *.dylib filter=lfs diff=lfs merge=lfs -text
17 | *.lib filter=lfs diff=lfs merge=lfs -text
18 | *.so filter=lfs diff=lfs merge=lfs -text
19 |
20 | # MATLAB / Python
21 | *.mex* filter=lfs diff=lfs merge=lfs -text
22 |
23 | # Documents
24 | *.pdf filter=lfs diff=lfs merge=lfs -text
25 | *.doc filter=lfs diff=lfs merge=lfs -text
26 | *.docx filter=lfs diff=lfs merge=lfs -text
27 | *.xls filter=lfs diff=lfs merge=lfs -text
28 | *.xlsx filter=lfs diff=lfs merge=lfs -text
29 | *.ppt filter=lfs diff=lfs merge=lfs -text
30 | *.pptx filter=lfs diff=lfs merge=lfs -text
31 |
32 | # Media Files
33 | *.psd filter=lfs diff=lfs merge=lfs -text
34 | *.png filter=lfs diff=lfs merge=lfs -text
35 | *.tiff filter=lfs diff=lfs merge=lfs -text
36 | *.tif filter=lfs diff=lfs merge=lfs -text
37 | *.jpg filter=lfs diff=lfs merge=lfs -text
38 | *.jpeg filter=lfs diff=lfs merge=lfs -text
39 | *.svg filter=lfs diff=lfs merge=lfs -text
40 |
41 | # Fonts
42 | *.ttf filter=lfs diff=lfs merge=lfs -text
43 | *.woff filter=lfs diff=lfs merge=lfs -text
44 | *.otf filter=lfs diff=lfs merge=lfs -text
45 |
--------------------------------------------------------------------------------
/Optimization/LsL0SolversAnalysis/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 |
12 | %% General Parameters
13 | close('all');
14 | clear();
15 | clc();
16 |
17 | % set(0, 'DefaultFigureWindowStyle', 'docked');
18 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
19 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
20 |
21 | figPosSmall = [100, 100, 400, 300];
22 | figPosMedium = [100, 100, 800, 600];
23 | figPosLarge = [100, 100, 960, 720];
24 | figPosDefault = [100, 100, 560, 420];
25 |
26 | fontSizeTitle = 14;
27 | fontSizeAxis = 12;
28 | fontSizeString = 12;
29 |
30 | lineWidthThin = 1;
31 | lineWidthNormal = 3;
32 | lineWidthThick = 4;
33 |
34 | markerSizeSmall = 4;
35 | markerSizeNormal = 8;
36 | markerSizeLarge = 10;
37 |
38 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
39 | % https://www.mathworks.com/matlabcentral/answers/160332
40 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
41 |
42 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
43 | subStreamNumber = round(sum(clock()));
44 | % subStreamNumber = 162;
45 | % subStreamNumber = 2126;
46 | set(randomNumberStream, 'Substream', subStreamNumber);
47 | RandStream.setGlobalStream(randomNumberStream);
48 |
49 | FALSE = 0;
50 | TRUE = 1;
51 |
52 | OFF = 0;
53 | ON = 1;
54 |
55 |
--------------------------------------------------------------------------------
/ImageConvolution/ImageConvolution.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageConvolution", "ImageConvolution\ImageConvolution.vcxproj", "{B7567430-2865-4FA2-8FD8-F8F8D27D178E}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageConvolutionDll", "ImageConvolutionDll\ImageConvolutionDll.vcxproj", "{351B6D2C-A13F-4211-A353-1BAF575F270D}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.ActiveCfg = Debug|x64
17 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.Build.0 = Debug|x64
18 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.ActiveCfg = Release|x64
19 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.Build.0 = Release|x64
20 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.ActiveCfg = Debug|x64
21 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.Build.0 = Debug|x64
22 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.ActiveCfg = Release|x64
23 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvml/SleefVsSvmlMain.h:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include "SleefVsSvml.h"
8 |
9 | #define UNIT_TEST_SINE 1
10 | #define UNIT_TEST_COSINE 2
11 | #define UNIT_TEST_EXP 3
12 |
13 | #define NUM_FUN_FLAVOR 4
14 |
15 | // Main Function
16 | void SineSleefSse(float* vO, float* vI, int numElements);
17 | void SineSleefAvx(float* vO, float* vI, int numElements);
18 | void SineSvmlSse(float* vO, float* vI, int numElements);
19 | void SineSvmlAvx(float* vO, float* vI, int numElements);
20 | //void CosineSleefSse(float* vO, float* vI, int numElements);
21 | //void CosineSleefAvx(float* vO, float* vI, int numElements);
22 | //void CosineSvmlSse(float* vO, float* vI, int numElements);
23 | //void CosineSvmlAvx(float* vO, float* vI, int numElements);
24 | void ExpSleefSse(float* vO, float* vI, int numElements);
25 | void ExpSleefAvx(float* vO, float* vI, int numElements);
26 | void ExpSvmlSse(float* vO, float* vI, int numElements);
27 | void ExpSvmlAvx(float* vO, float* vI, int numElements);
28 |
29 | // Unit Test Functions
30 | void UnitTestSine(int numElements, int numIter, float maxVal, int negValFlag);
31 | //void UnitTestCosine(int numElements, int numIter, float maxVal, int negativeValSupport);
32 | //void UnitTestExp(int numElements, int numIter, float maxVal, int negativeValSupport);
33 |
34 |
35 | // Auxiliary Functions
36 | void PrintRunTimeData(double *vRunTime, int numIter);
37 | int QSortCompFunDouble(const void * a, const void * b);
38 |
39 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrixDll/CalcDistanceMatrixDll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 |
29 |
30 | Header Files
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Optimization/InterriorPoint/LeastSquaresInterriorPointExample.m:
--------------------------------------------------------------------------------
1 | % Least Squares Interrior Point Example
2 | % Remarks:
3 | % 1. Using Log Barrier Method for Interrior Point Solver
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 31/07/2017 Royi Avital
8 | % * First release.
9 |
10 |
11 | %% General Parameters
12 |
13 | run('InitScript.m');
14 |
15 |
16 | %% Question 003
17 |
18 | numRows = 4;
19 | numCols = 2;
20 |
21 | numConstraints = 4;
22 |
23 | mA = randn([numRows, numCols]);
24 | vB = randn([numRows, 1]);
25 |
26 | mC = abs(randn([numConstraints, numCols])); % 6) {
22 | printf("\nError: Number of Argument Is Larger Than 5\n");
23 | return 0;
24 | }
25 | else { // argc ==2 -> Single Input
26 | unitTestFlag = atoi(argv[1]);
27 | numElements = atoi(argv[2]);
28 | numIter = atoi(argv[3]);
29 | negValFlag = atoi(argv[4]);
30 | maxVal = (float)(atof(argv[5]));
31 | printf("\nUsing Users Settings\n");
32 | }
33 |
34 | printf("Number of Elements - %d\n", numElements);
35 | printf("Number of Iterations - %d\n", numIter);
36 | printf("Negative Values Flag - %d\n", negValFlag);
37 | printf("Maximum Value - %f\n", maxVal);
38 |
39 | switch (unitTestFlag)
40 | {
41 | case UNIT_TEST_SINE:
42 | UnitTestSine(numElements, numIter, maxVal, negValFlag);
43 | break;
44 | case UNIT_TEST_EXP:
45 | UnitTestExp(numElements, numIter, maxVal, negValFlag);
46 | break;
47 | default:
48 | printf("\n");
49 | printf("Error: Invalid Test Number");
50 | printf("\n");
51 | break;
52 | }
53 |
54 |
55 | return 0;
56 | }
57 |
58 |
--------------------------------------------------------------------------------
/Optimization/README.md:
--------------------------------------------------------------------------------
1 | # Optimization
2 | Various projects in Optimization.
3 |
4 | ## Ball Projection
5 | The orthogonal projection onto balls (L1, L2, Simplex, etc...).
6 | Includes both derivations and code for implementation.
7 |
8 | ## Convex Set Projection
9 | The orthogonal projection onto various convex sets.
10 |
11 | ## Interrior Point Solver
12 | Demo of Interrior Point Solver concept.
13 |
14 | ## LsL0SolversAnalysis
15 | Analysis of perfromance of various solvers for the Linear Lease Squares Problem regularized by ${L}_{0}$ Norm.
16 | The prolens is given by:
17 |
18 | $$ \arg \min_{x} \frac{1}{2} {\left\| A x - b \right\|}_{2}^{2} + \lambda {\left\| x \right\|}_{0} $$
19 |
20 | ## LsL1SolversAnalysis
21 | Analysis of perfromance of various solvers for the Linear Lease Squares Problem regularized by ${L}_{1}$ Norm.
22 | The prolens is given by:
23 |
24 | $$ \arg \min_{x} \frac{1}{2} {\left\| A x - b \right\|}_{2}^{2} + \lambda {\left\| x \right\|}_{1} $$
25 |
26 | ## Steepest Descent
27 | The steepest descent direction under various norms.
28 | Includes both derivations and code for implementation.
29 |
30 | ## TO DO List
31 | * [SparseStep: Approximating the Counting Norm for Sparse Regularization](https://arxiv.org/abs/1701.06967).
32 | [GitHub Code Repository](https://github.com/GjjvdBurg/SparseStep).
33 | * [Utilizing Second Order Information in Minibatch Stochastic Variance Reduced Proximal Iterations](http://jmlr.org/papers/v20/17-594.html).
34 | * [`MLJLinearModels.jl`](https://github.com/alan-turing-institute/MLJLinearModels.jl).
35 | Resources for algorithms.
36 | *
37 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 | %% General Parameters
12 | close('all');
13 | clear();
14 | clc();
15 |
16 | % set(0, 'DefaultFigureWindowStyle', 'docked');
17 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
18 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
19 |
20 | figPosSmall = [100, 100, 0400, 0300];
21 | figPosMedium = [100, 100, 0800, 0600];
22 | figPosLarge = [100, 100, 0960, 0720];
23 | figPosXLarge = [100, 100, 1100, 0825];
24 | figPosX2Large = [100, 100, 1200, 0900];
25 | figPosX3Large = [100, 100, 1400, 1050];
26 | figPosDefault = [100, 100, 0560, 0420];
27 |
28 | fontSizeTitle = 14;
29 | fontSizeAxis = 12;
30 | fontSizeString = 12;
31 |
32 | lineWidthThin = 1;
33 | lineWidthNormal = 3;
34 | lineWidthThick = 4;
35 |
36 | markerSizeSmall = 4;
37 | markerSizeNormal = 8;
38 | markerSizeLarge = 10;
39 |
40 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
41 | % https://www.mathworks.com/matlabcentral/answers/160332
42 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
43 |
44 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
45 | subStreamNumber = round(sum(clock()));
46 | subStreamNumber = 162;
47 | set(randomNumberStream, 'Substream', subStreamNumber);
48 | RandStream.setGlobalStream(randomNumberStream);
49 |
50 | FALSE = 0;
51 | TRUE = 1;
52 |
53 | OFF = 0;
54 | ON = 1;
55 |
56 |
--------------------------------------------------------------------------------
/ImageConvolution/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 | %% General Parameters
12 | close('all');
13 | clear();
14 | clc();
15 |
16 | % set(0, 'DefaultFigureWindowStyle', 'docked');
17 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
18 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
19 |
20 | figPosSmall = [100, 100, 0400, 0300];
21 | figPosMedium = [100, 100, 0800, 0600];
22 | figPosLarge = [100, 100, 0960, 0720];
23 | figPosXLarge = [100, 100, 1100, 0825];
24 | figPosX2Large = [100, 100, 1200, 0900];
25 | figPosX3Large = [100, 100, 1400, 1050];
26 | figPosDefault = [100, 100, 0560, 0420];
27 |
28 | fontSizeTitle = 14;
29 | fontSizeAxis = 12;
30 | fontSizeString = 12;
31 |
32 | lineWidthThin = 1;
33 | lineWidthNormal = 3;
34 | lineWidthThick = 4;
35 |
36 | markerSizeSmall = 4;
37 | markerSizeNormal = 8;
38 | markerSizeLarge = 10;
39 |
40 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
41 | % https://www.mathworks.com/matlabcentral/answers/160332
42 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
43 |
44 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
45 | subStreamNumber = round(sum(clock()));
46 | % subStreamNumber = 162;
47 | set(randomNumberStream, 'Substream', subStreamNumber);
48 | RandStream.setGlobalStream(randomNumberStream);
49 |
50 | FALSE = 0;
51 | TRUE = 1;
52 |
53 | OFF = 0;
54 | ON = 1;
55 |
56 |
--------------------------------------------------------------------------------
/ImageToColumns/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 | %% General Parameters
12 | close('all');
13 | clear();
14 | clc();
15 |
16 | % set(0, 'DefaultFigureWindowStyle', 'docked');
17 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
18 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
19 |
20 | figPosSmall = [100, 100, 0400, 0300];
21 | figPosMedium = [100, 100, 0800, 0600];
22 | figPosLarge = [100, 100, 0960, 0720];
23 | figPosXLarge = [100, 100, 1100, 0825];
24 | figPosX2Large = [100, 100, 1200, 0900];
25 | figPosX3Large = [100, 100, 1400, 1050];
26 | figPosDefault = [100, 100, 0560, 0420];
27 |
28 | fontSizeTitle = 14;
29 | fontSizeAxis = 12;
30 | fontSizeString = 12;
31 |
32 | lineWidthThin = 1;
33 | lineWidthNormal = 3;
34 | lineWidthThick = 4;
35 |
36 | markerSizeSmall = 4;
37 | markerSizeNormal = 8;
38 | markerSizeLarge = 10;
39 |
40 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
41 | % https://www.mathworks.com/matlabcentral/answers/160332
42 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
43 |
44 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
45 | subStreamNumber = round(sum(clock()));
46 | % subStreamNumber = 162;
47 | set(randomNumberStream, 'Substream', subStreamNumber);
48 | RandStream.setGlobalStream(randomNumberStream);
49 |
50 | FALSE = 0;
51 | TRUE = 1;
52 |
53 | OFF = 0;
54 | ON = 1;
55 |
56 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 08/11/2016 Royi Avital
8 | % * First release.
9 | %
10 |
11 | %% General Parameters
12 | close('all');
13 | clear();
14 | clc();
15 |
16 | % set(0, 'DefaultFigureWindowStyle', 'docked');
17 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
18 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
19 |
20 | figPosSmall = [100, 100, 0400, 0300];
21 | figPosMedium = [100, 100, 0800, 0600];
22 | figPosLarge = [100, 100, 0960, 0720];
23 | figPosXLarge = [100, 100, 1100, 0825];
24 | figPosX2Large = [100, 100, 1200, 0900];
25 | figPosX3Large = [100, 100, 1400, 1050];
26 | figPosDefault = [100, 100, 0560, 0420];
27 |
28 | fontSizeTitle = 14;
29 | fontSizeAxis = 12;
30 | fontSizeString = 12;
31 |
32 | lineWidthThin = 1;
33 | lineWidthNormal = 3;
34 | lineWidthThick = 4;
35 |
36 | markerSizeSmall = 4;
37 | markerSizeNormal = 8;
38 | markerSizeLarge = 10;
39 |
40 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
41 | % https://www.mathworks.com/matlabcentral/answers/160332
42 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
43 |
44 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
45 | subStreamNumber = round(sum(clock()));
46 | % subStreamNumber = 162;
47 | set(randomNumberStream, 'Substream', subStreamNumber);
48 | RandStream.setGlobalStream(randomNumberStream);
49 |
50 | FALSE = 0;
51 | TRUE = 1;
52 |
53 | OFF = 0;
54 | ON = 1;
55 |
56 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/TestProjectionL2Ball.m:
--------------------------------------------------------------------------------
1 | % Test Projection onto L2 Ball
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 27/06/2017 Royi Avital
8 | % * First release.
9 |
10 |
11 | %% General Parameters
12 |
13 | run('InitScript.m');
14 |
15 | numRows = 5;
16 | ballRadius = 3;
17 |
18 |
19 | %% Generating Data
20 |
21 | vY = 10 * rand([numRows, 1]) - 5;
22 |
23 | %% Solution by CVX
24 |
25 | cvx_begin('quiet')
26 | cvx_precision('best');
27 | variable vXCvx(numRows)
28 | minimize( norm(vXCvx - vY) )
29 | subject to
30 | norm(vXCvx ,2) <= ballRadius;
31 | cvx_end
32 |
33 | disp([' ']);
34 | disp(['CVX Solution Summary']);
35 | disp(['The CVX Solver Status - ', cvx_status]);
36 | disp(['The Optimal Value Is Given By - ', num2str(cvx_optval)]);
37 | disp(['The Optimal Argument Is Given By - [ ', num2str(vXCvx.'), ' ]']);
38 | disp([' ']);
39 |
40 |
41 | %% Solution by Dual Function and Newton Iteration
42 |
43 | vX = ProjectL2Ball(vY, ballRadius);
44 |
45 | disp([' ']);
46 | disp(['Closed Form Solution Summary']);
47 | disp(['The Optimal Argument Is Given By - [ ', num2str(vX.'), ' ]']);
48 | disp([' ']);
49 |
50 |
51 | %% Display Results
52 |
53 | disp([' ']);
54 | disp(['CVX Solution L2 Norm - ', num2str(norm(vXCvx, 2))]);
55 | disp(['Dual Function Solution L2 Norm - ', num2str(norm(vX, 2))]);
56 | disp(['Solutions Difference L2 Norm - ', num2str(norm(vXCvx - vX, 2))]);
57 | disp([' ']);
58 |
59 |
60 | %% Restore Defaults
61 |
62 | % set(0, 'DefaultFigureWindowStyle', 'normal');
63 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
64 |
65 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/ProjectL2Ball.m:
--------------------------------------------------------------------------------
1 | function [ vX ] = ProjectL2Ball( vY, ballRadius )
2 | % ----------------------------------------------------------------------------------------------- %
3 | % [ vX ] = ProjectL2Ball( vY, ballRadius, stopThr )
4 | % Solving the Orthoginal Porjection Problem of the input vector onto the
5 | % L2 Ball.
6 | % Input:
7 | % - vY - Input Vector.
8 | % Structure: Vector (Column).
9 | % Type: 'Single' / 'Double'.
10 | % Range: (-inf, inf).
11 | % - ballRadius - Ball Radius.
12 | % Sets the Radius of the L2 Ball. For Unit L2 Ball
13 | % set to 1.
14 | % Structure: Scalar.
15 | % Type: 'Single' / 'Double'.
16 | % Range: (0, inf).
17 | % Output:
18 | % - vX - Output Vector.
19 | % The projection of the Input Vector onto the L2
20 | % Ball.
21 | % Structure: Vector (Column).
22 | % Type: 'Single' / 'Double'.
23 | % Range: (-inf, inf).
24 | % References
25 | % 1. h
26 | % Remarks:
27 | % 1. a
28 | % TODO:
29 | % 1. U.
30 | % Release Notes:
31 | % - 1.0.000 29/06/2017 Royi Avital
32 | % * First release version.
33 | % ----------------------------------------------------------------------------------------------- %
34 |
35 | FALSE = 0;
36 | TRUE = 1;
37 |
38 | OFF = 0;
39 | ON = 1;
40 |
41 | vX = min((ballRadius / norm(vY, 2)), 1) * vY;
42 |
43 |
44 | end
45 |
46 |
--------------------------------------------------------------------------------
/SleefVsSvml/SleefVsSvml/SleefVsSvml.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 | Source Files
29 |
30 |
31 |
32 |
33 | Header Files
34 |
35 |
36 | Header Files
37 |
38 |
39 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ImageToHTML/license.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016, The MathWorks, Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in
12 | the documentation and/or other materials provided with the distribution.
13 | * In all cases, the software is, and all modifications and derivatives
14 | of the software shall be, licensed to you solely for use in conjunction
15 | with MathWorks products and service offerings.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 | POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/ProjectLInfBall.m:
--------------------------------------------------------------------------------
1 | function [ vX ] = ProjectLInfBall( vY, ballRadius )
2 | % ----------------------------------------------------------------------------------------------- %
3 | % [ vX ] = ProjectL2Ball( vY, ballRadius, stopThr )
4 | % Solving the Orthoginal Porjection Problem of the input vector onto the
5 | % L Inf Ball.
6 | % Input:
7 | % - vY - Input Vector.
8 | % Structure: Vector (Column).
9 | % Type: 'Single' / 'Double'.
10 | % Range: (-inf, inf).
11 | % - ballRadius - Ball Radius.
12 | % Sets the Radius of the L Inf Ball. For Unit L Inf
13 | % Ball set to 1.
14 | % Structure: Scalar.
15 | % Type: 'Single' / 'Double'.
16 | % Range: (0, inf).
17 | % Output:
18 | % - vX - Output Vector.
19 | % The projection of the Input Vector onto the L Inf
20 | % Ball.
21 | % Structure: Vector (Column).
22 | % Type: 'Single' / 'Double'.
23 | % Range: (-inf, inf).
24 | % References
25 | % 1. h
26 | % Remarks:
27 | % 1. a
28 | % TODO:
29 | % 1. U.
30 | % Release Notes:
31 | % - 1.0.000 29/06/2017 Royi Avital
32 | % * First release version.
33 | % ----------------------------------------------------------------------------------------------- %
34 |
35 | FALSE = 0;
36 | TRUE = 1;
37 |
38 | OFF = 0;
39 | ON = 1;
40 |
41 | vX = sign(vY) .* min(abs(vY), ballRadius);
42 |
43 |
44 | end
45 |
46 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/TestProjectionLInfBall.m:
--------------------------------------------------------------------------------
1 | % Test Projection onto L Inf Ball
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 27/06/2017 Royi Avital
8 | % * First release.
9 |
10 |
11 | %% General Parameters
12 |
13 | run('InitScript.m');
14 |
15 | numRows = 5;
16 | ballRadius = 3;
17 |
18 |
19 | %% Generating Data
20 |
21 | vY = 10 * rand([numRows, 1]) - 5;
22 |
23 | %% Solution by CVX
24 |
25 | cvx_begin('quiet')
26 | cvx_precision('best');
27 | variable vXCvx(numRows)
28 | minimize( norm(vXCvx - vY) )
29 | subject to
30 | norm(vXCvx ,inf) <= ballRadius;
31 | cvx_end
32 |
33 | disp([' ']);
34 | disp(['CVX Solution Summary']);
35 | disp(['The CVX Solver Status - ', cvx_status]);
36 | disp(['The Optimal Value Is Given By - ', num2str(cvx_optval)]);
37 | disp(['The Optimal Argument Is Given By - [ ', num2str(vXCvx.'), ' ]']);
38 | disp([' ']);
39 |
40 |
41 | %% Solution by Dual Function and Newton Iteration
42 |
43 | vX = ProjectLInfBall(vY, ballRadius);
44 |
45 | disp([' ']);
46 | disp(['Closed Form Solution Summary']);
47 | disp(['The Optimal Argument Is Given By - [ ', num2str(vX.'), ' ]']);
48 | disp([' ']);
49 |
50 |
51 | %% Display Results
52 |
53 | disp([' ']);
54 | disp(['CVX Solution L Inf Norm - ', num2str(norm(vXCvx, 'inf'))]);
55 | disp(['Closed Form Solution L Inf Norm - ', num2str(norm(vX, 'inf'))]);
56 | disp(['Solutions Difference L2 Norm - ', num2str(norm(vXCvx - vX, 2))]);
57 | disp([' ']);
58 |
59 |
60 | %% Restore Defaults
61 |
62 | % set(0, 'DefaultFigureWindowStyle', 'normal');
63 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
64 |
65 |
--------------------------------------------------------------------------------
/ImageConvolution/ImageConvolutionDll/ImageConvolutionDll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/TestProjectionL1Ball.m:
--------------------------------------------------------------------------------
1 | % Test Projection onto L1 Ball
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 27/06/2017 Royi Avital
8 | % * First release.
9 |
10 |
11 | %% General Parameters
12 |
13 | run('InitScript.m');
14 |
15 | numRows = 5;
16 | ballRadius = 3;
17 | stopThr = 1e-6;
18 |
19 |
20 | %% Generating Data
21 |
22 | vY = 10 * rand([numRows, 1]) - 5;
23 |
24 | %% Solution by CVX
25 |
26 | cvx_begin('quiet')
27 | cvx_precision('best');
28 | variable vXCvx(numRows)
29 | minimize( norm(vXCvx - vY) )
30 | subject to
31 | norm(vXCvx ,1) <= ballRadius;
32 | cvx_end
33 |
34 | disp([' ']);
35 | disp(['CVX Solution Summary']);
36 | disp(['The CVX Solver Status - ', cvx_status]);
37 | disp(['The Optimal Value Is Given By - ', num2str(cvx_optval)]);
38 | disp(['The Optimal Argument Is Given By - [ ', num2str(vXCvx.'), ' ]']);
39 | disp([' ']);
40 |
41 |
42 | %% Solution by Dual Function and Newton Iteration
43 |
44 | vX = ProjectL1Ball(vY, ballRadius, stopThr);
45 |
46 | disp([' ']);
47 | disp(['Dual Function Solution Summary']);
48 | disp(['The Optimal Argument Is Given By - [ ', num2str(vX.'), ' ]']);
49 | disp([' ']);
50 |
51 |
52 | %% Display Results
53 |
54 | disp([' ']);
55 | disp(['CVX Solution L1 Norm - ', num2str(norm(vXCvx, 1))]);
56 | disp(['Dual Function Solution L1 Norm - ', num2str(norm(vX, 1))]);
57 | disp(['Solutions Difference L1 Norm - ', num2str(norm(vXCvx - vX, 1))]);
58 | disp([' ']);
59 |
60 |
61 | %% Restore Defaults
62 |
63 | % set(0, 'DefaultFigureWindowStyle', 'normal');
64 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
65 |
66 |
--------------------------------------------------------------------------------
/AuxiliaryFunctions/TestCode.jl:
--------------------------------------------------------------------------------
1 | # Test Code
2 | # Several test for the Julia Code.
3 | # References:
4 | # 1.
5 | # Remarks:
6 | # 1. Use in Julia as following:
7 | # - Move to folder using `cd(raw"");`.
8 | # - Activate the environment using `] activate .`.
9 | # - Instantiate the environment using `] instantiate`.
10 | # 2. fd
11 | # TODO:
12 | # 1. C
13 | # Release Notes Royi Avital RoyiAvital@yahoo.com
14 | # - 1.0.000 23/11/2023 Royi Avital
15 | # * First release.
16 |
17 | ## Packages
18 |
19 | # Internal
20 | using Printf;
21 | # External
22 | using BenchmarkTools;
23 | using UnicodePlots;
24 |
25 | ## Constants & Configuration
26 |
27 | ## External
28 | include("JuliaInit.jl");
29 | include("JuliaImageProcessing.jl");
30 | include("JuliaOptimization.jl");
31 | include("JuliaSignalProcessing.jl");
32 |
33 | ## General Parameters
34 |
35 | figureIdx = 0;
36 |
37 | exportFigures = false;
38 |
39 | ## Functions
40 |
41 |
42 | ## Parameters
43 |
44 | # Data
45 |
46 | numRowsA = 1000;
47 | numColsA = 975;
48 |
49 | numRowsK = 5;
50 | numColsK = 4;
51 |
52 | convMode = CONV_MODE_VALID;
53 |
54 |
55 |
56 |
57 | ## Load / Generate Data
58 |
59 | mA = rand(numRowsA, numColsA);
60 | mK = rand(numRowsK, numColsK);
61 |
62 | if (convMode == CONV_MODE_FULL)
63 | mO = zeros((numRowsA, numColsA) .+ (numRowsK, numColsK) .- 1);
64 | hConv2D! = _Conv2D!;
65 | elseif (convMode == CONV_MODE_VALID)
66 | mO = zeros((numRowsA, numColsA) .- (numRowsK, numColsK) .+ 1);
67 | hConv2D! = _Conv2DValid!;
68 | end
69 |
70 |
71 | ## Analysis
72 |
73 | @benchmark hConv2D!(mO, mA, mK)
74 |
75 |
76 | ## Display Results
77 |
78 |
--------------------------------------------------------------------------------
/Optimization/BallProjection/TestProjectionSimplexBall.m:
--------------------------------------------------------------------------------
1 | % Test Projection onto Simplex Ball
2 | % Remarks:
3 | % 1. sa
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 27/06/2017 Royi Avital
8 | % * First release.
9 |
10 |
11 | %% General Parameters
12 |
13 | run('InitScript.m');
14 |
15 | numRows = 5;
16 | ballRadius = 3;
17 | stopThr = 1e-6;
18 |
19 |
20 | %% Generating Data
21 |
22 | vY = 10 * rand([numRows, 1]) - 5;
23 |
24 | %% Solution by CVX
25 |
26 | cvx_begin('quiet')
27 | cvx_precision('best');
28 | variable vXCvx(numRows)
29 | minimize( norm(vXCvx - vY) )
30 | subject to
31 | sum(vXCvx) == ballRadius;
32 | vXCvx >= 0;
33 | cvx_end
34 |
35 | disp([' ']);
36 | disp(['CVX Solution Summary']);
37 | disp(['The CVX Solver Status - ', cvx_status]);
38 | disp(['The Optimal Value Is Given By - ', num2str(cvx_optval)]);
39 | disp(['The Optimal Argument Is Given By - [ ', num2str(vXCvx.'), ' ]']);
40 | disp([' ']);
41 |
42 |
43 | %% Solution by Dual Function and Newton Iteration
44 |
45 | vX = ProjectSimplex(vY, ballRadius, stopThr);
46 |
47 | disp([' ']);
48 | disp(['Dual Function Solution Summary']);
49 | disp(['The Optimal Argument Is Given By - [ ', num2str(vX.'), ' ]']);
50 | disp([' ']);
51 |
52 |
53 | %% Display Results
54 |
55 | disp([' ']);
56 | disp(['CVX Solution Sum - ', num2str(sum(vXCvx))]);
57 | disp(['Dual Function Solution Sum - ', num2str(sum(vX))]);
58 | disp(['Solutions Difference L1 Norm - ', num2str(norm(vXCvx - vX, 1))]);
59 | disp([' ']);
60 |
61 |
62 | %% Restore Defaults
63 |
64 | % set(0, 'DefaultFigureWindowStyle', 'normal');
65 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
66 |
67 |
--------------------------------------------------------------------------------
/ImageConvolution/ImageConvolution/ImageConvolution.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ImageToColumns/GCC/CompileDllGcc.m:
--------------------------------------------------------------------------------
1 | % Compile DLL Using GCC
2 | %
3 | % References:
4 | % 1. https://linux.die.net/man/1/gcc.
5 | % 2. http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/.
6 | % Remarks:
7 | % 1. Matrix is assumed to be n x n in size.
8 | % TODO:
9 | % 1. Add Eigen based implementation.
10 | % Release Notes
11 | % - 1.0.000 04/08/2017
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | run('InitScript.m');
18 |
19 | figureIdx = 0;
20 | figureCounterSpec = '%04d';
21 |
22 | generateFigures = OFF;
23 |
24 | GCC_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\';
25 | GCC_BIN_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\bin\';
26 |
27 |
28 | %% Set System Enviorment (PATH Variable)
29 |
30 | orgSystemPath = getenv('PATH');
31 |
32 | setenv('PATH', [orgSystemPath, GCC_BIN_FOLDER_PATH, ';']);
33 | setenv('C_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
34 | setenv('CPLUS_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
35 |
36 |
37 | %% Set Compiling Flags
38 |
39 |
40 | %% Compile
41 |
42 | gccCommand01 = 'gcc -Ofast -fopenmp ../ImageToColumns/ImageToColumns.c -c -D _USRDLL';
43 | gccCommand02 = 'gcc -Ofast -fopenmp -o ImageToColumnsDll.dll -shared -s ImageToColumns.o';
44 |
45 | gccCommand01 = 'gcc -Ofast ../ImageToColumns/ImageToColumns.c -c -D _USRDLL';
46 | gccCommand02 = 'gcc -Ofast -o ImageToColumnsDll.dll -shared -s ImageToColumns.o';
47 |
48 | system('gcc --version');
49 | system(gccCommand01);
50 | system(gccCommand02);
51 |
52 |
53 | %% Restore Defaults
54 |
55 | % set(0, 'DefaultFigureWindowStyle', 'normal');
56 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
57 |
58 |
--------------------------------------------------------------------------------
/ImageConvolution/GCC/CompileDllGcc.m:
--------------------------------------------------------------------------------
1 | % Compile DLL Using GCC
2 | %
3 | % References:
4 | % 1. https://linux.die.net/man/1/gcc.
5 | % 2. http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/.
6 | % Remarks:
7 | % 1. Matrix is assumed to be n x n in size.
8 | % TODO:
9 | % 1. Add Eigen based implementation.
10 | % Release Notes
11 | % - 1.0.000 04/08/2017
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | run('InitScript.m');
18 |
19 | figureIdx = 0;
20 | figureCounterSpec = '%04d';
21 |
22 | generateFigures = OFF;
23 |
24 | GCC_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\';
25 | GCC_BIN_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\bin\';
26 |
27 |
28 | %% Set System Enviorment (PATH Variable)
29 |
30 | orgSystemPath = getenv('PATH');
31 |
32 | setenv('PATH', [orgSystemPath, GCC_BIN_FOLDER_PATH, ';']);
33 | setenv('C_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
34 | setenv('CPLUS_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
35 |
36 |
37 | %% Set Compiling Flags
38 |
39 |
40 | %% Compile
41 |
42 | gccCommand01 = 'gcc -O3 -fopenmp ../ImageConvolution/ImageConvolution.c ../ImageConvolution/ImageConvolutionGaussianKernel.c ../ImageConvolution/ImageConvolutionSeparableKernel.c -c -D _USRDLL';
43 | gccCommand02 = 'gcc -O3 -fopenmp -o ImageConvolutionDll.dll -shared -s ImageConvolution.o ImageConvolutionSeparableKernel.o ImageConvolutionGaussianKernel.o';
44 |
45 | system('gcc --version');
46 | system(gccCommand01);
47 | system(gccCommand02);
48 |
49 |
50 | %% Restore Defaults
51 |
52 | % set(0, 'DefaultFigureWindowStyle', 'normal');
53 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
54 |
55 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/demo/FW_lasso_plot_big.m:
--------------------------------------------------------------------------------
1 | %
2 | % Demo code running the Frank-Wolfe algorithm with line-search
3 | % for a Lasso problem min ||Ax-b||^2 s.t. ||x||_1 <= r
4 | %
5 | n=500; % # rows in A
6 | p=100; % dimension of w, # columns of A, variables in x
7 | t=p/4; % number of non-zeros in the true solution xstar
8 |
9 | rng('default');
10 | A=randn(n,p);
11 | xstar=[ones(t,1); -ones(t,1); -zeros(p-2*t,1)];
12 | noise=0.1*randn(n,1);
13 | b=A*xstar+noise;
14 | [n,p] = size(A);
15 |
16 | T = 50; % number of iterations
17 |
18 | r = 10; % the regularization constraint imposed on the l_1-norm
19 |
20 |
21 | x = zeros(p,1);
22 | Ax = A*x;
23 | progress = [];
24 | figure('Units','normalized','position',[.1 .1 .9 .9])
25 |
26 | t=0; i=0;
27 | for t = 0:T
28 | % call the LMO
29 | [ res i ] = max( abs(A' *(Ax-b)), [], 1 );
30 |
31 | stepSign = sign( A(:,i)' *(b-Ax) ); % = sign of -gradF[i]
32 | s = zeros(p,1); s(i) = stepSign*r;
33 | As = stepSign*r*A(:,i); % = the i-th column of the dictionary matrix A
34 |
35 | % line-search on the univariate quadratic problem in gamma
36 | As_minus_Ax = As - Ax;
37 | stepSize = max(0, min(1, As_minus_Ax' * (b-Ax) / (As_minus_Ax' * As_minus_Ax)));
38 | %stepSize = 2 / (t+2);
39 |
40 | x = (1-stepSize)*x + stepSize*s; % do the FW step
41 | Ax = (1-stepSize)*Ax + stepSize*As; % update Ax
42 |
43 | f_at_x = sum((Ax-b).^2)/2;
44 | fprintf('t=%d - f=%f - i=%d - stepsize=%d \n',t,f_at_x,i,stepSize);
45 |
46 | progress = [ progress; f_at_x ];
47 | show_progress(progress,x,s,p,T,r);
48 |
49 | end
50 |
51 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrix/CalcDistanceMatrix.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 | Source Files
29 |
30 |
31 | Source Files
32 |
33 |
34 |
35 |
36 | Header Files
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/demo/FW_lasso_plot_simple_step.m:
--------------------------------------------------------------------------------
1 | %
2 | % Demo code running the Frank-Wolfe algorithm with line-search
3 | % for a Lasso problem min ||Ax-b||^2 s.t. ||x||_1 <= r
4 | %
5 | n=150; % # rows in A
6 | p=20; % dimension of w, # columns of A, variables in x
7 | t=p/4; % number of non-zeros in the true solution xstar
8 | rng('default');
9 | A=randn(n,p);
10 | xstar=[ones(t,1); -ones(t,1); -zeros(p-2*t,1)];
11 | noise=0.1*randn(n,1);
12 | b=A*xstar+noise;
13 | [n,p] = size(A);
14 |
15 | T = 15; % number of iterations
16 |
17 | r = 1; % the regularization constraint imposed on the l_1-norm
18 |
19 |
20 | x = zeros(p,1);
21 | Ax = A*x;
22 | progress = [];
23 | figure('Units','normalized','position',[.1 .1 .9 .9])
24 |
25 | t=0; i=0;
26 | for t = 0:T
27 | % call the LMO
28 | [ res i ] = max( abs(A' *(Ax-b)), [], 1 );
29 |
30 | stepSign = sign( A(:,i)' *(b-Ax) ); % = sign of -gradF[i]
31 | s = zeros(p,1); s(i) = stepSign*r;
32 | As = stepSign*r*A(:,i); % = the i-th column of the dictionary matrix A
33 |
34 | % line-search on the univariate quadratic problem in gamma
35 | As_minus_Ax = As - Ax;
36 | stepSize = max(0, min(1, As_minus_Ax' * (b-Ax) / (As_minus_Ax' * As_minus_Ax)));
37 | %stepSize = 2 / (t+2);
38 |
39 | x = (1-stepSize)*x + stepSize*s; % do the FW step
40 | Ax = (1-stepSize)*Ax + stepSize*As; % update Ax
41 |
42 | f_at_x = sum((Ax-b).^2)/2;
43 | fprintf('t=%d - f=%f - i=%d - stepsize=%d \n',t,f_at_x,i,stepSize);
44 |
45 | progress = [ progress; f_at_x ];
46 | show_progress(progress,x,s,p,T,r);
47 | pause(0.2);
48 |
49 | end
50 |
51 |
--------------------------------------------------------------------------------
/Optimization/ConditionalGradientMethod/Frank Wolfe and Greedy Optimization for Learning with Big Data - MATLAB Code/demo/FW_lasso_plot.m:
--------------------------------------------------------------------------------
1 | %
2 | % Demo code running the Frank-Wolfe algorithm with line-search
3 | % for a Lasso problem min ||Ax-b||^2 s.t. ||x||_1 <= r
4 | %
5 | n=150; % # rows in A
6 | p=20; % dimension of w, # columns of A, variables in x
7 | t=p/4; % number of non-zeros in the true solution xstar
8 | rng('default');
9 | A=randn(n,p);
10 | xstar=[ones(t,1); -ones(t,1); -zeros(p-2*t,1)];
11 | noise=0.1*randn(n,1);
12 | b=A*xstar+noise;
13 | [n,p] = size(A);
14 |
15 | T = 15; % number of iterations
16 |
17 | r = 1; % the regularization constraint imposed on the l_1-norm
18 |
19 |
20 | x = zeros(p,1);
21 | Ax = A*x;
22 | progress = [];
23 | figure('Units','normalized','position',[.1 .1 .9 .9])
24 |
25 | t=0; i=0;
26 | for t = 0:T
27 | % call the LMO
28 | [ res i ] = max( abs(A' *(Ax-b)), [], 1 );
29 |
30 | stepSign = sign( A(:,i)' *(b-Ax) ); % = sign of -gradF[i]
31 | s = zeros(p,1); s(i) = stepSign*r;
32 | As = stepSign*r*A(:,i); % = the i-th column of the dictionary matrix A
33 |
34 | % line-search on the univariate quadratic problem in gamma
35 | As_minus_Ax = As - Ax;
36 | stepSize = max(0, min(1, As_minus_Ax' * (b-Ax) / (As_minus_Ax' * As_minus_Ax)));
37 | %stepSize = 2 / (t+2);
38 |
39 | x = (1-stepSize)*x + stepSize*s; % do the FW step
40 | Ax = (1-stepSize)*Ax + stepSize*As; % update Ax
41 |
42 | f_at_x = sum((Ax-b).^2)/2;
43 | fprintf('t=%d - f=%f - i=%d - stepsize=%d \n',t,f_at_x,i,stepSize);
44 |
45 | progress = [ progress; f_at_x ];
46 | show_progress(progress,x,s,p,T,r);
47 | pause(1.5);
48 |
49 | end
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Optimization/ConvexSetProjection/ProjectCirculantMatrixSetAnalysis.m:
--------------------------------------------------------------------------------
1 | % Project onto the Circulant Matrix Set (Real) Analysis
2 | %
3 | % References:
4 | % 1. Projection onto the Set of Circulant Matrices - https://math.stackexchange.com/questions/2778195.
5 | % Remarks:
6 | % 1. sa
7 | % TODO:
8 | % 1. ds
9 | % Release Notes
10 | % - 1.0.000 12/05/2018
11 | % * First release.
12 |
13 |
14 | %% General Parameters
15 |
16 | run('InitScript.m');
17 |
18 | figureIdx = 0;
19 | figureCounterSpec = '%04d';
20 |
21 | generateFigures = ON;
22 |
23 |
24 | %% Parameters
25 |
26 | matDim = 5;
27 |
28 |
29 | %% Generate Data
30 |
31 | mY = randn([matDim, matDim]);
32 | mPi = eye(matDim);
33 | mPi = [mPi(2:end, :); mPi(1, :)]; %
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include "CalcDistanceMatrix.h"
7 |
8 | #define UNIT_TEST_CALC_DISTANCE_MATRIX_VANILLA 1
9 | #define UNIT_TEST_CALC_DISTANCE_MATRIX_SSE 2
10 | #define UNIT_TEST_CALC_DISTANCE_MATRIX_AVX 3
11 | #define UNIT_TEST_CALC_DISTANCE_MATRIX_EIGEN 4
12 | #define UNIT_TEST_CALC_DISTANCE_MATRIX_EIGEN_M 5
13 |
14 |
15 | // FA Library Functions
16 | void CalcDistanceMatrixVanilla(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
17 | void CalcDistanceMatrixSse(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
18 | void CalcDistanceMatrixAvx(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
19 | void CalcDistanceMatrixEigen(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
20 | void CalcDistanceMatrixEigenM(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
21 | void CalcDistanceMatrixRefTime(float* mD, float* mA, float* mB, int vecDim, int numRowsA, int numRowsB);
22 |
23 | // Unit Test Functions
24 | void CalcDistanceMatrixVanillaUnitTest(int vecDim, int numRowsA, int numRowsB, int numIter);
25 | void CalcDistanceMatrixSseUnitTest(int vecDim, int numRowsA, int numRowsB, int numIter);
26 | void CalcDistanceMatrixAvxUnitTest(int vecDim, int numRowsA, int numRowsB, int numIter);
27 | void CalcDistanceMatrixEigenUnitTest(int vecDim, int numRowsA, int numRowsB, int numIter);
28 | void CalcDistanceMatrixEigenMUnitTest(int vecDim, int numRowsA, int numRowsB, int numIter);
29 |
30 | // Auxiliary Functions
31 | void PrintRunTimeData(double *vRunTime, int numIter);
32 | int QSortCompFunDouble(const void * a, const void * b);
33 |
34 |
--------------------------------------------------------------------------------
/Optimization/InterriorPoint/InterriorPointExample.m:
--------------------------------------------------------------------------------
1 | % Interrior Point Example
2 | % Remarks:
3 | % 1. Using Log Barrier Method for Interrior Point Solver
4 | % TODO:
5 | % 1. ds
6 | % Release Notes
7 | % - 1.0.000 31/07/2017 Royi Avital
8 | % * First release.
9 |
10 |
11 | %% General Parameters
12 |
13 | run('InitScript.m');
14 |
15 |
16 | %% Question 003
17 |
18 | hObjFun = @(vX) (2 * (vX .^ 2)) + (3 * vX);
19 | hObjGrad = @(vX) (4 * vX) + 3;
20 | hObjHessian = @(vX) 4;
21 |
22 | hCondFun = @(vX) -sqrt(abs(vX)) + ((vX < 0) * 1e20);
23 | hCondGrad = @(vX) -0.5 * (vX .^ -0.5);
24 | hCondHessian = @(vX) 0.25 * (vX .^ -1.5);
25 |
26 | % hCondFun = @(vX) ((vX <= 0) * vX) + ((vX > 0) * 1e20);
27 | % hCondGrad = @(vX) 1;
28 | % hCondHessian = @(vX) 0;
29 |
30 |
31 | %% Solution by CVX - Exact
32 |
33 | cvx_begin('quiet')
34 | cvx_precision('best');
35 | variable vX(1)
36 | minimize( (2 * sum_square_abs(vX)) + (3 * vX) )
37 | subject to
38 | -sqrt(vX) <= 0;
39 | % vX <= 0;
40 | cvx_end
41 |
42 | disp([' ']);
43 | disp(['CVX Solution Summary']);
44 | disp(['The CVX Solver Status - ', cvx_status]);
45 | disp(['The Optimal Value Is Given By - ', num2str(cvx_optval)]);
46 | disp(['The Optimal Argument Is Given By - [ ', num2str(vX.'), ' ]']);
47 | disp([' ']);
48 |
49 |
50 | %% Solution by CVX - Approximate
51 |
52 | vXInit = 5;
53 | tFctr = 80000000;
54 | muFctr = 5;
55 | numIterations = 55;
56 |
57 | vX = InterriorPointSolver(vXInit, hObjFun, hObjGrad, hObjHessian, hCondFun, hCondGrad, hCondHessian, tFctr, muFctr, numIterations);
58 |
59 | vX
60 |
61 |
62 | %% Restore Defaults
63 |
64 | % set(0, 'DefaultFigureWindowStyle', 'normal');
65 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
66 |
67 |
--------------------------------------------------------------------------------
/Optimization/ProxFunctions/SolveProxL1.m:
--------------------------------------------------------------------------------
1 | function [ vX ] = SolveProxL1( vY, paramLambda )
2 | % ----------------------------------------------------------------------------------------------- %
3 | %[ vX ] = SolveProxL1( vY, paramLambda )
4 | % Solves the Prox of the L1 Norm using Alternating direct method, the Soft
5 | % Threshold operator. Basically solves the problem given by:
6 | % $$ \arg \min_{ x \in \mathbb{R}^{n} } \frac{1}{2} {\left\| x - y \right|}_{2}^{2} + \lambda {\left\| x \right\|}_{1} $$
7 | % Input:
8 | % - vY - Input Vector.
9 | % The vector to apply the Prox operator upon.
10 | % Structure: Vector (n X 1).
11 | % Type: 'Single' / 'Double'.
12 | % Range: (-inf, inf).
13 | % - paramLambda - Parameter Lambda.
14 | % The L1 Regularization parameter.
15 | % Structure: Scalar.
16 | % Type: 'Single' / 'Double'.
17 | % Range: (0, inf).
18 | % Output:
19 | % - vX - Output Vector.
20 | % Structure: Vector (n X 1).
21 | % Type: 'Single' / 'Double'.
22 | % Range: (-inf, inf).
23 | % References
24 | % 1. A
25 | % Remarks:
26 | % 1. B
27 | % Known Issues:
28 | % 1. C
29 | % TODO:
30 | % 1. Pre calculate decomposition of the Linear System.
31 | % Release Notes:
32 | % - 1.0.000 27/11/2019 Royi Avital
33 | % * First release version.
34 | % ----------------------------------------------------------------------------------------------- %
35 |
36 |
37 |
38 | % Soft Thresholding
39 | vX = max(vY - paramLambda, 0) + min(vY + paramLambda, 0);
40 |
41 |
42 | end
43 |
44 |
--------------------------------------------------------------------------------
/LevinsonRecursion/README.md:
--------------------------------------------------------------------------------
1 | # Levinson Recursion
2 |
3 |
4 | ## Introduction
5 | The [Levinson Recursion](https://en.wikipedia.org/wiki/Levinson_recursion) can be used for solving Linear System of Equations `A x = y` in O(N^2) assuming `A` is [Toeplitz Matrix](https://en.wikipedia.org/wiki/Toeplitz_matrix).
6 | Classic solvers, which doesnt take advatnage of the structure of `A` have O(N^3) complexity.
7 |
8 | The method is basically the [Levinson Durbin Recursion](https://www.mathworks.com/help/signal/ref/levinson.html) for estimating [Auto Regressive Model](https://en.wikipedia.org/wiki/Autoregressive_model) Parameters.
9 | Yet in MATLAB it is limited to the case matrix `A` is composed from `y`.
10 |
11 | ## Results
12 |
13 | 
14 |
15 |
16 | ### System Configuration
17 | * CPU - Intel Core I7 6800K @ 3.4 [GHz].
18 | * Memory - 4 * 8 [GB] @ 2166 [MHz] - G.Skill F4 2800C-16-8GRK.
19 | * Mother Board - ASRock X99 Killer (BIOS Version P3.20).
20 | * MATLAB R2017a.
21 | * BLAS Version (`version -blas`) - `Intel(R) Math Kernel Library Version 11.3.1 Product Build 20151021 for Intel(R) 64 architecture applications, CNR branch AVX2`.
22 | * LAPACK Version (`version -lapack`) - `Intel(R) Math Kernel Library Version 11.3.1 Product Build 20151021 for Intel(R) 64 architecture applications, CNR branch AVX2; Linear Algebra PACKage Version 3.5.0`.
23 | * Windows 10 Professional 64 Bit.
24 |
25 | ## How to Run
26 | Compile the `LevinsonRecursionToeplitzMatrix.cpp` file into a DLL using MSVC / GCC (See `CompileDllGcc.m` for reference).
27 | Run `LevinsonRecursionRunTime.m`.
28 |
29 |
30 | ## ToDo
31 | * Update the README file about the method.
32 | * Improve the C code (Better `h` file and more established code).
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilterDll/ImageBilateralFilterDll.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/HandleDynamicLibrary.m:
--------------------------------------------------------------------------------
1 | function [ ] = HandleDynamicLibrary( compilingMode, libHandleMode )
2 | %LOADDYNAMICLIBRARY Summary of this function goes here
3 | % Detailed explanation goes here
4 |
5 | FALSE = 0;
6 | TRUE = 1;
7 |
8 | OFF = 0;
9 | ON = 1;
10 |
11 | COMPILING_MODE_DEBUG = 1;
12 | COMPILING_MODE_RELEASE = 2;
13 | COMPILING_MODE_MSVC = COMPILING_MODE_RELEASE;
14 | COMPILING_MODE_GCC = 3;
15 | COMPILING_MODE_ICC = 4;
16 |
17 | LIB_HANDLE_MODE_LOAD = 1;
18 | LIB_HANDLE_MODE_UNLOAD = 2;
19 |
20 | LIB_NAME = 'CalcDistanceMatrixDll';
21 | H_FILE_NAME = 'CalcDistanceMatrixDll';
22 | LIB_PATH_DEBUG = 'x64\Debug\';
23 | LIB_PATH_RELEASE = 'x64\Release\';
24 | LIB_PATH_GCC = 'x64\GCC\';
25 | LIB_PATH_ICC = 'x64\ICC\'; %
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Optimization/ConvexSetProjection/GenerateCirculantMatrix.m:
--------------------------------------------------------------------------------
1 | function [ mX ] = GenerateCirculantMatrix( vX )
2 | % ----------------------------------------------------------------------------------------------- %
3 | % [ mX ] = GenerateCirculantMatrix( vX )
4 | % Generates Circulant Matrix from its generating first row.
5 | % Input:
6 | % - vX - Input Vector.
7 | % Structure: Vector.
8 | % Type: 'Single' / 'Double'.
9 | % Range: (-inf, inf).
10 | % Output:
11 | % - mX - Circulant Matrix.
12 | % Circulant Matrix where its first row is vX and
13 | % rest of the rows are shifted versions of vX.
14 | % Structure: Matrix.
15 | % Type: 'Single' / 'Double'.
16 | % Range: (-inf, inf).
17 | % References:
18 | % 1. StackOverflow (Q23174345) - https://stackoverflow.com/questions/23174345.
19 | % Remarks:
20 | % 1. Prefixes:
21 | % - 'm' - Matrix.
22 | % - 'v' - Vector.
23 | % 2. T
24 | % TODO:
25 | % 1. Support Complex Matrices (Remove the 'symmetric' property).
26 | % Release Notes:
27 | % - 1.0.000 12/05/2018 Royi Avital
28 | % * First release version.
29 | % ----------------------------------------------------------------------------------------------- %
30 |
31 | FALSE = 0;
32 | TRUE = 1;
33 |
34 | OFF = 0;
35 | ON = 1;
36 |
37 | mX = ifft( fft( diag( fft(vX) ), [], 1 ), [], 2 ); % 8) {
22 | printf("Error: Number of Argument Is Larger Than 7");
23 | return 0;
24 | }
25 | else { // argc == 2 -> Single Input
26 | unitTestFlag = atoi(argv[1]);
27 |
28 | switch (unitTestFlag)
29 | {
30 | case UNIT_TEST_IMAGE_GAUSSIAN_BLUR:
31 | if (argc < 7) {
32 | printf("Error: Number of Argument Is Smaller Than 6");
33 | return 0;
34 | }
35 |
36 | numRows = atoi(argv[2]);
37 | numCols = atoi(argv[3]);
38 | numIter = atoi(argv[4]);
39 | spatialStd = atof(argv[5]);
40 | paramK = atoi(argv[6]);
41 | break;
42 | case UNIT_TEST_IMAGE_BILATERAL_FILTER:
43 | if (argc < 8) {
44 | printf("Error: Number of Argument Is Smaller Than 7");
45 | return 0;
46 | }
47 |
48 | numRows = atoi(argv[2]);
49 | numCols = atoi(argv[3]);
50 | numIter = atoi(argv[4]);
51 | spatialStd = atof(argv[5]);
52 | rangeStd = atof(argv[6]);
53 | paramK = atoi(argv[7]);
54 | break;
55 | default:
56 | break;
57 | }
58 | }
59 |
60 | switch (unitTestFlag)
61 | {
62 | case UNIT_TEST_IMAGE_GAUSSIAN_BLUR:
63 | ImageConvolutionGaussianKernelUnitTest(numRows, numCols, numIter, spatialStd, paramK);
64 | break;
65 | case UNIT_TEST_IMAGE_BILATERAL_FILTER:
66 | BilateralFilterFastCompressiveUnitTest(numRows, numCols, numIter, spatialStd, rangeStd, paramK);
67 | break;
68 | default:
69 | break;
70 | }
71 |
72 |
73 | return 0;
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilter/ImageBilateralFilter.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 | Source Files
40 |
41 |
42 | Source Files
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/CompileExeGcc.m:
--------------------------------------------------------------------------------
1 | % Compile DLL Using GCC
2 | %
3 | % References:
4 | % 1. https://linux.die.net/man/1/gcc.
5 | % 2. http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/.
6 | % Remarks:
7 | % 1. Matrix is assumed to be n x n in size.
8 | % TODO:
9 | % 1. Add Eigen based implementation.
10 | % Release Notes
11 | % - 1.0.000 18/07/2017
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | run('InitScript.m');
18 |
19 | figureIdx = 0;
20 | figureCounterSpec = '%04d';
21 |
22 | generateFigures = OFF;
23 |
24 | GCC_FOLDER_PATH = 'D:\Applications\Programming\MinGW\';
25 | GCC_BIN_FOLDER_PATH = 'D:\Applications\Programming\MinGW\bin\';
26 |
27 |
28 | %% Set System Enviorment (PATH Variable)
29 |
30 | orgSystemPath = getenv('PATH');
31 |
32 | if(contains(orgSystemPath, GCC_BIN_FOLDER_PATH) == FALSE)
33 | setenv('PATH', [orgSystemPath, GCC_BIN_FOLDER_PATH, ';']);
34 | end
35 | setenv('C_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
36 | setenv('CPLUS_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
37 |
38 |
39 | %% Set Files Names
40 |
41 |
42 | %% Set Compiling Flags
43 |
44 |
45 | %% Compile
46 |
47 | % gccCommand01 = ['g++ -Ofast -fopenmp IpaLib/IpaLibMain.cpp IpaLib/IpaLibUnitTest.cpp IpaLib/BilateralFilterFa.cpp -o IpaLibExeGcc.exe'];
48 | gccCommand01 = ['gcc -Ofast -fopenmp -mavx2 ImageBilateralFilter/ImageBilateralFilterMain.c ImageBilateralFilter/ImageBilateralFilterUnitTest.c ImageBilateralFilter/ImageBilateralFilter.c ImageBilateralFilter/ImageConvolution.c ImageBilateralFilter/ImageConvolutionGaussianKernel.c ImageBilateralFilter/ImageConvolutionSeparableKernel.c -o ImageBilateralFilter.exe'];
49 |
50 | system(gccCommand01);
51 |
52 | movefile('ImageBilateralFilter.exe', 'x64/GCC/');
53 |
54 |
55 | %% Restore Defaults
56 |
57 | % set(0, 'DefaultFigureWindowStyle', 'normal');
58 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
59 |
60 |
--------------------------------------------------------------------------------
/ImageConvolution/ImageConvolution/ImageConvolutionMain.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "ImageConvolutionMain.h"
4 | #include "ImageConvolution.h"
5 |
6 | int main() {
7 | int ii, jj, numRows, numCols, numIter, numElements, stdToRadiusFactor, kernelNumRows, kernelNumCols, kernelNumElements;
8 | float *mO, *mI, *mTmp;
9 | float* mConvKernel;
10 | float gaussianStd;
11 | clock_t clockStart, clockEnd;
12 | double runTime;
13 |
14 | numRows = 8000;
15 | numCols = 8000;
16 |
17 | kernelNumRows = 31;
18 | kernelNumCols = 31;
19 |
20 | numIter = 10;
21 |
22 | gaussianStd = 5;
23 | stdToRadiusFactor = 5;
24 |
25 | numElements = numRows * numCols;
26 | kernelNumElements = kernelNumRows * kernelNumCols;
27 |
28 | mO = (float*)_mm_malloc(numElements * sizeof(float), SSE_ALIGNMENT);
29 | mI = (float*)_mm_malloc(numElements * sizeof(float), SSE_ALIGNMENT);
30 | mTmp = (float*)_mm_malloc(numElements * sizeof(float), SSE_ALIGNMENT);
31 |
32 | mConvKernel = (float*)_mm_malloc(kernelNumElements * sizeof(float), SSE_ALIGNMENT);
33 |
34 | for (ii = 0; ii < numElements; ii++) {
35 | mI[ii] = (float)rand();
36 | }
37 |
38 | for (ii = 0; ii < kernelNumElements; ii++)
39 | {
40 | mConvKernel[ii] = (float)rand();
41 | }
42 |
43 | clockStart = clock();
44 |
45 | clockStart = clock();
46 | for (jj = 0; jj < numIter; jj++) {
47 | // ImageConvolutionGaussianKernel(mO, mI, mTmp, numRows, numCols, gaussianStd, stdToRadiusFactor);
48 | ImageConvolution(mO, mI, numRows, numCols, mConvKernel, kernelNumRows, kernelNumCols);
49 | // ImageConvolutionGaussianKernelOpt(mO, mI, mTmp, numRows, numCols, gaussianStd, stdToRadiusFactor); // In practice it is slower!
50 | }
51 | clockEnd = clock();
52 |
53 | runTime = (double)(clockEnd - clockStart) / CLOCKS_PER_SEC;
54 |
55 | printf("Run Time %2.10f\n", runTime);
56 |
57 | _mm_free(mO);
58 | _mm_free(mI);
59 | _mm_free(mTmp);
60 | _mm_free(mConvKernel);
61 |
62 | getchar();
63 |
64 | return 0;
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/Optimization/ConvexSetProjection/GenerateShiftMatrix.m:
--------------------------------------------------------------------------------
1 | function [ mPi ] = GenerateShiftMatrix( matDim, shiftDeg )
2 | % ----------------------------------------------------------------------------------------------- %
3 | % [ mPi ] = GenerateShiftMatrix( matDim, shiftDeg )
4 | % Generates Shifting Matrices which shifts a vector by shiftDeg.
5 | % Input:
6 | % - matDim - Matrix Dimension.
7 | % Structure: Scalar.
8 | % Type: 'Single' / 'Double'.
9 | % Range: {1, 2, ...}.
10 | % - shiftDeg - Shifting Degree.
11 | % Number of shits of the matrix where shiftDeg =
12 | % 0 means the idnentity matrix.
13 | % Structure: Scalar.
14 | % Type: 'Single' / 'Double'.
15 | % Range: {0, 1, 2, ..., matDim - 1}.
16 | % Output:
17 | % - mX - Circulant Matrix.
18 | % Structure: Matrix.
19 | % Type: 'Single' / 'Double'.
20 | % Range: (-inf, inf).
21 | % References:
22 | % 1. StackOverflow (Q2778195) - https://math.stackexchange.com/a/2778260/33.
23 | % Remarks:
24 | % 1. Prefixes:
25 | % - 'm' - Matrix.
26 | % - 'v' - Vector.
27 | % 2. Pay attention that GenerateShiftMatrix( matDim, 5 ) =
28 | % GenerateShiftMatrix( matDim, 1 ) ^ 5. Namely shifting mPi can be
29 | % done by multiplication of it by itself.
30 | % TODO:
31 | % 1. S
32 | % Release Notes:
33 | % - 1.0.000 12/05/2018 Royi Avital
34 | % * First release version.
35 | % ----------------------------------------------------------------------------------------------- %
36 |
37 | FALSE = 0;
38 | TRUE = 1;
39 |
40 | OFF = 0;
41 | ON = 1;
42 |
43 | % The shifting matrix is permutation of the rows of I.
44 | mPi = eye(matDim);
45 | mPi = [mPi(shiftDeg + 1:end, :); mPi(1:shiftDeg, :)];
46 |
47 |
48 | end
49 |
50 |
--------------------------------------------------------------------------------
/LevinsonRecursion/LevinsonRecursionToeplitzMatrix Working.cpp:
--------------------------------------------------------------------------------
1 | #include "LevinsonRecursionToeplitzMatrix.h"
2 |
3 | // --------------------------------------- CalcDistMatSse -------------------------------------- //
4 | void LevinsonRecursionToeplitzMatrix(float *mT, float *vY, float *vX, int numRows)
5 | {
6 | int ii, jj;
7 | float epsF, epsB, epsX, scalingFctr;
8 | //DECLARE_ALIGN float coordDiff[SSE_STRIDE];
9 | float *vF, *vFPrev, *vB, *vBPrev;
10 |
11 | vF = (float*)_aligned_malloc(numRows * sizeof(float), SSE_ALIGNMENT);
12 | vFPrev = (float*)_aligned_malloc(numRows * sizeof(float), SSE_ALIGNMENT);
13 | vB = (float*)_aligned_malloc(numRows * sizeof(float), SSE_ALIGNMENT);
14 | vBPrev = (float*)_aligned_malloc(numRows * sizeof(float), SSE_ALIGNMENT);
15 | //vX = (float*)_aligned_malloc(numRows * sizeof(float), SSE_ALIGNMENT);
16 |
17 | for (ii = 0; ii < numRows; ii++){
18 | vF[ii] = 0;
19 | vB[ii] = 0;
20 | vX[ii] = 0;
21 | }
22 |
23 | vF[0] = 1 / mT[0];
24 | vB[0] = 1 / mT[0];
25 | vX[0] = vY[0] / mT[0];
26 |
27 | for (ii = 1; ii < numRows; ii++){
28 | epsF = 0;
29 | epsB = 0;
30 | epsX = 0;
31 | for (jj = 0; jj < ii; jj++){
32 | epsF += mT[(jj * numRows) + ii] * vF[jj];
33 | epsB += mT[(jj + 1) * numRows] * vB[jj];
34 | epsX += mT[(jj * numRows) + ii] * vX[jj];
35 | }
36 |
37 | for (jj = 0; jj <= ii; jj++){
38 | vFPrev[jj] = vF[jj];
39 | vBPrev[jj] = vB[jj];
40 | }
41 |
42 | scalingFctr = 1 / (1 - epsF * epsB);
43 |
44 | for (jj = 0; jj <= ii; jj++){
45 | if (jj == 0){
46 | vF[0] = scalingFctr * vF[0];
47 | }
48 | else{
49 | vF[jj] = (scalingFctr * vF[jj]) - ((epsF * scalingFctr) * vB[jj - 1]);
50 | }
51 | }
52 | for (jj = 0; jj <= ii; jj++){
53 | if (jj == 0){
54 | vB[0] = -(epsB * scalingFctr) * vFPrev[0];
55 | }
56 | else{
57 | vB[jj] = (scalingFctr * vBPrev[jj - 1]) - ((epsB * scalingFctr) * vFPrev[jj]);
58 | }
59 | }
60 | for (jj = 0; jj <= ii; jj++){
61 | vX[jj] = vX[jj] + ((vY[ii] - epsX) * vB[jj]);
62 | }
63 | }
64 |
65 | _aligned_free(vF);
66 | _aligned_free(vB);
67 | }
68 |
--------------------------------------------------------------------------------
/ImageBilateralFilter/ImageBilateralFilterIntel/ImageBilateralFilterIntel.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 | Source Files
40 |
41 |
42 | Source Files
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ImageConvolution/GCC/CompileExeGcc.m:
--------------------------------------------------------------------------------
1 | % Compile Executable Using GCC
2 | %
3 | % References:
4 | % 1. https://linux.die.net/man/1/gcc.
5 | % 2. http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/.
6 | % Remarks:
7 | % 1. Matrix is assumed to be n x n in size.
8 | % TODO:
9 | % 1. Add Eigen based implementation.
10 | % Release Notes
11 | % - 1.0.000 04/08/2017
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | run('InitScript.m');
18 |
19 | figureIdx = 0;
20 | figureCounterSpec = '%04d';
21 |
22 | generateFigures = OFF;
23 |
24 | GCC_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\';
25 | GCC_BIN_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\bin\';
26 |
27 |
28 | %% Set System Enviorment (PATH Variable)
29 |
30 | orgSystemPath = getenv('PATH');
31 |
32 | setenv('PATH', [orgSystemPath, GCC_BIN_FOLDER_PATH, ';']);
33 | setenv('C_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
34 | setenv('CPLUS_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
35 |
36 |
37 | %% Set Compiling Flags
38 |
39 |
40 | %% Compile
41 |
42 | gccCommand01 = 'gcc -O3 -fopenmp ../ImageConvolution/ImageConvolutionMain.c ../ImageConvolution/ImageConvolution.c ../ImageConvolution/ImageConvolutionGaussianKernel.c ../ImageConvolution/ImageConvolutionSeparableKernel.c -c -D _USRDLL';
43 | gccCommand02 = 'gcc -O3 -fopenmp -o ImageConvolutionDll.exe ImageConvolutionMain.o ImageConvolution.o ImageConvolutionSeparableKernel.o ImageConvolutionGaussianKernel.o';
44 |
45 | % -Ofast superceds -O3 with -ffast-math
46 | gccCommand01 = 'gcc -Ofast -fopenmp ../ImageConvolution/ImageConvolutionMain.c ../ImageConvolution/ImageConvolution.c ../ImageConvolution/ImageConvolutionGaussianKernel.c ../ImageConvolution/ImageConvolutionSeparableKernel.c -c -D _USRDLL';
47 | gccCommand02 = 'gcc -Ofast -fopenmp -o ImageConvolutionDll.exe ImageConvolutionMain.o ImageConvolution.o ImageConvolutionSeparableKernel.o ImageConvolutionGaussianKernel.o';
48 |
49 | system('gcc --version');
50 | system(gccCommand01);
51 | system(gccCommand02);
52 |
53 |
54 | %% Restore Defaults
55 |
56 | % set(0, 'DefaultFigureWindowStyle', 'normal');
57 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
58 |
59 |
--------------------------------------------------------------------------------
/ImageToColumns/GCC/CompileExeGcc.m:
--------------------------------------------------------------------------------
1 | % Compile Executable Using GCC
2 | %
3 | % References:
4 | % 1. https://linux.die.net/man/1/gcc.
5 | % 2. http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/.
6 | % Remarks:
7 | % 1. Matrix is assumed to be n x n in size.
8 | % TODO:
9 | % 1. Add Eigen based implementation.
10 | % Release Notes
11 | % - 1.0.000 04/08/2017
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | run('InitScript.m');
18 |
19 | figureIdx = 0;
20 | figureCounterSpec = '%04d';
21 |
22 | generateFigures = OFF;
23 |
24 | GCC_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\';
25 | GCC_BIN_FOLDER_PATH = 'D:\Applications\Programming\MinGW64\bin\';
26 |
27 |
28 | %% Set System Enviorment (PATH Variable)
29 |
30 | orgSystemPath = getenv('PATH');
31 |
32 | setenv('PATH', [orgSystemPath, GCC_BIN_FOLDER_PATH, ';']);
33 | setenv('C_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
34 | setenv('CPLUS_INCLUDE_PATH', [GCC_FOLDER_PATH, 'include\']);
35 |
36 |
37 | %% Set Compiling Flags
38 |
39 |
40 | %% Compile
41 |
42 | gccCommand01 = 'gcc -O3 -fopenmp ../ImageConvolution/ImageConvolutionMain.c ../ImageConvolution/ImageConvolution.c ../ImageConvolution/ImageConvolutionGaussianKernel.c ../ImageConvolution/ImageConvolutionSeparableKernel.c -c -D _USRDLL';
43 | gccCommand02 = 'gcc -O3 -fopenmp -o ImageConvolutionDll.exe ImageConvolutionMain.o ImageConvolution.o ImageConvolutionSeparableKernel.o ImageConvolutionGaussianKernel.o';
44 |
45 | % -Ofast superceds -O3 with -ffast-math
46 | gccCommand01 = 'gcc -Ofast -fopenmp ../ImageConvolution/ImageConvolutionMain.c ../ImageConvolution/ImageConvolution.c ../ImageConvolution/ImageConvolutionGaussianKernel.c ../ImageConvolution/ImageConvolutionSeparableKernel.c -c -D _USRDLL';
47 | gccCommand02 = 'gcc -Ofast -fopenmp -o ImageConvolutionDll.exe ImageConvolutionMain.o ImageConvolution.o ImageConvolutionSeparableKernel.o ImageConvolutionGaussianKernel.o';
48 |
49 | system('gcc --version');
50 | system(gccCommand01);
51 | system(gccCommand02);
52 |
53 |
54 | %% Restore Defaults
55 |
56 | % set(0, 'DefaultFigureWindowStyle', 'normal');
57 | % set(0, 'DefaultAxesLooseInset', defaultLoosInset);
58 |
59 |
--------------------------------------------------------------------------------
/LevinsonRecursion/LevinsonRecursionToeplitzMatrix.cpp:
--------------------------------------------------------------------------------
1 | #include "LevinsonRecursionToeplitzMatrix.h"
2 | #include "xmmintrin.h"
3 |
4 | // --------------------------------------- CalcDistMatSse -------------------------------------- //
5 | void LevinsonRecursionToeplitzMatrix(float *mT, float *vY, float *vX, int numRows)
6 | {
7 | int ii, jj;
8 | float epsF, epsB, epsX, scalingFctr;
9 | //DECLARE_ALIGN float coordDiff[SSE_STRIDE];
10 | float *vF, *vFPrev, *vB, *vBPrev;
11 |
12 | vF = (float*)_mm_malloc(numRows * sizeof(float), 16);
13 | vFPrev = (float*)_mm_malloc(numRows * sizeof(float), 16);
14 | vB = (float*)_mm_malloc(numRows * sizeof(float), 16);
15 | vBPrev = (float*)_mm_malloc(numRows * sizeof(float), 16);
16 | //vX = (float*)_aligned_malloc(numRows * sizeof(float), SSE_ALIGNMENT);
17 |
18 |
19 | // Use faster initialization
20 | /*for (ii = 0; ii < numRows; ii++){
21 | vF[ii] = 0;
22 | vB[ii] = 0;
23 | vX[ii] = 0;
24 | }*/
25 |
26 | memset(vF, 0.0, numRows * sizeof(float));
27 | memset(vB, 0.0, numRows * sizeof(float));
28 | memset(vX, 0.0, numRows * sizeof(float));
29 |
30 | vF[0] = 1 / mT[0];
31 | vB[0] = 1 / mT[0];
32 | vX[0] = vY[0] / mT[0];
33 |
34 | for (ii = 1; ii < numRows; ii++){
35 | epsF = 0;
36 | epsB = 0;
37 | epsX = 0;
38 | for (jj = 0; jj < ii; jj++){
39 | epsF += mT[(jj * numRows) + ii] * vF[jj];
40 | epsB += mT[(jj + 1) * numRows] * vB[jj];
41 | epsX += mT[(jj * numRows) + ii] * vX[jj];
42 | }
43 |
44 | // Use faster MemCopy
45 | /*for (jj = 0; jj <= ii; jj++){
46 | vFPrev[jj] = vF[jj];
47 | vBPrev[jj] = vB[jj];
48 | }*/
49 |
50 | memcpy(vFPrev, vF, (ii + 1) * sizeof(float));
51 | memcpy(vBPrev, vB, (ii + 1) * sizeof(float));
52 |
53 | scalingFctr = 1 / (1 - epsF * epsB);
54 |
55 | vF[0] = scalingFctr * vF[0];
56 | for (jj = 1; jj <= ii; jj++){
57 | vF[jj] = (scalingFctr * vF[jj]) - ((epsF * scalingFctr) * vB[jj - 1]);
58 |
59 | }
60 |
61 | vB[0] = -(epsB * scalingFctr) * vFPrev[0];
62 | for (jj = 1; jj <= ii; jj++){
63 | vB[jj] = (scalingFctr * vBPrev[jj - 1]) - ((epsB * scalingFctr) * vFPrev[jj]);
64 |
65 | }
66 |
67 | for (jj = 0; jj <= ii; jj++){
68 | vX[jj] = vX[jj] + ((vY[ii] - epsX) * vB[jj]);
69 | }
70 | }
71 |
72 | _mm_free(vF);
73 | _mm_free(vB);
74 | }
75 |
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CalcDistanceMatrix.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcDistanceMatrix", "CalcDistanceMatrix\CalcDistanceMatrix.vcxproj", "{B7567430-2865-4FA2-8FD8-F8F8D27D178E}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcDistanceMatrixDll", "CalcDistanceMatrixDll\CalcDistanceMatrixDll.vcxproj", "{351B6D2C-A13F-4211-A353-1BAF575F270D}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | CLang|x64 = CLang|x64
13 | Debug|x64 = Debug|x64
14 | ICC|x64 = ICC|x64
15 | Release|x64 = Release|x64
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.CLang|x64.ActiveCfg = CLang|x64
19 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.CLang|x64.Build.0 = CLang|x64
20 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.ActiveCfg = Debug|x64
21 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Debug|x64.Build.0 = Debug|x64
22 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.ICC|x64.ActiveCfg = ICC|x64
23 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.ICC|x64.Build.0 = ICC|x64
24 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.ActiveCfg = Release|x64
25 | {B7567430-2865-4FA2-8FD8-F8F8D27D178E}.Release|x64.Build.0 = Release|x64
26 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.CLang|x64.ActiveCfg = CLang|x64
27 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.CLang|x64.Build.0 = CLang|x64
28 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.ActiveCfg = Debug|x64
29 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Debug|x64.Build.0 = Debug|x64
30 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.ICC|x64.ActiveCfg = ICC|x64
31 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.ICC|x64.Build.0 = ICC|x64
32 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.ActiveCfg = Release|x64
33 | {351B6D2C-A13F-4211-A353-1BAF575F270D}.Release|x64.Build.0 = Release|x64
34 | EndGlobalSection
35 | GlobalSection(SolutionProperties) = preSolution
36 | HideSolutionNode = FALSE
37 | EndGlobalSection
38 | GlobalSection(ExtensibilityGlobals) = postSolution
39 | SolutionGuid = {8E399353-832E-4A4F-93CB-DA9389F416C8}
40 | EndGlobalSection
41 | EndGlobal
42 |
--------------------------------------------------------------------------------
/TaskAssignmentProblem/ImageToHTML/+se/+utils/HtmlText.m:
--------------------------------------------------------------------------------
1 | %HtmlText HTML text container
2 |
3 | % Steve Eddins
4 | % Copyright 2011 The MathWorks, Inc.
5 |
6 | classdef HtmlText < handle
7 |
8 | properties (Hidden)
9 | Queue
10 | OpenTags
11 | end
12 |
13 | methods
14 | function self = HtmlText
15 | self.Queue = se.utils.Deque;
16 | self.OpenTags = se.utils.Deque;
17 | end
18 |
19 | function addLine(self, line)
20 | self.Queue.pushBack(sprintf('%s%s', ...
21 | se.utils.spaces(self.indentationLevel), ...
22 | line));
23 | end
24 |
25 | function openTag(self,tag_type,tag_attributes)
26 | tag_str = tag_type;
27 | if nargin >= 3
28 | tag_str = sprintf('%s %s',tag_str,tag_attributes);
29 | end
30 | line = sprintf('%s<%s>',...
31 | se.utils.spaces(self.indentationLevel()),...
32 | tag_str);
33 | pushBack(self.Queue, line);
34 |
35 | pushBack(self.OpenTags, tag_type);
36 | end
37 |
38 | function closeTag(self,tag_type)
39 | last_tag = popBack(self.OpenTags);
40 | if ~strcmp(last_tag, tag_type)
41 | warning('se:HtmlText:MismatchedTags',...
42 | 'Tag type "%s" does not match currently open tag type "%s".', ...
43 | tag_type, last_tag);
44 | end
45 | pushBack(self.Queue, ...
46 | sprintf('%s%s>', se.utils.spaces(self.indentationLevel()), tag_type));
47 | end
48 |
49 | function comment(self,comment_text)
50 | addLine(self, sprintf('', comment_text));
51 | end
52 |
53 | function addBlankLine(self)
54 | self.Queue.pushBack('');
55 | end
56 |
57 | function level = indentationLevel(self)
58 | level = 2*self.OpenTags.NumItems;
59 | end
60 |
61 | function s = toString(self)
62 | lines = self.Queue.Items;
63 | s = [sprintf('%s\n', lines{1:end-1}), lines{end}];
64 | end
65 | end
66 |
67 | end
--------------------------------------------------------------------------------
/CalcDistanceMatrix/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required (VERSION 3.10)
2 |
3 | # General Settings
4 | set(CMAKE_VERBOSE_MAKEFILE ON)
5 |
6 | # Project
7 | project(CalcDistanceMatrix)
8 |
9 | set(EIGEN_INCLUDE_FOLDER "${CMAKE_SOURCE_DIR}/../../../Libraries/EigenLib/Eigen/")
10 |
11 | set(HEADER_FILES "$EIGEN_INCLUDE_FOLDER/Dense")
12 |
13 | set(RESOURCES "")
14 |
15 | file(GLOB SOURCES "${CMAKE_SOURCE_DIR}/CalcDistanceMatrix/*.cpp")
16 | list(APPEND SOURCES_EXE ${RESOURCES} ${SOURCES})
17 |
18 | # Removing items for DLL / LIB See https://stackoverflow.com/a/16450083
19 | list(REMOVE_ITEM SOURCES "${CMAKE_SOURCE_DIR}/CalcDistanceMatrix/CalcDistanceMatrixMain.cpp")
20 | list(REMOVE_ITEM SOURCES "${CMAKE_SOURCE_DIR}/CalcDistanceMatrix/CalcDistanceMatrixUnitTest.cpp")
21 | list(APPEND SOURCES_LIB ${RESOURCES} ${SOURCES})
22 |
23 | message("SOURCES LIB: ${SOURCES_LIB}")
24 |
25 | # Targets
26 | # add_executable(CalcDistanceMatrix ${SOURCES_EXE} ${HEADER_FILES})
27 | # add_library(CalcDistanceMatrixDll SHARED ${SOURCES_LIB} ${HEADER_FILES})
28 | add_executable(CalcDistanceMatrix ${SOURCES_EXE})
29 | add_library(CalcDistanceMatrixDll SHARED ${SOURCES_LIB})
30 |
31 | # Set Compiling Flags
32 | target_compile_options(CalcDistanceMatrix PUBLIC -Ofast -fopenmp -mavx2)
33 | target_compile_definitions(CalcDistanceMatrix PUBLIC -D_DNDEBUG)
34 | target_compile_options(CalcDistanceMatrixDll PUBLIC -Ofast -fopenmp -mavx2)
35 | target_compile_definitions(CalcDistanceMatrixDll PUBLIC -D_DNDEBUG -D_USRDLL)
36 |
37 | # For LINK_FLAGS use single "...."
38 | SET_TARGET_PROPERTIES(CalcDistanceMatrix PROPERTIES LINK_FLAGS -fopenmp) # Set Link Flags
39 | SET_TARGET_PROPERTIES(CalcDistanceMatrixDll PROPERTIES LINK_FLAGS -fopenmp) # Set Link Flags
40 |
41 | SET_TARGET_PROPERTIES(CalcDistanceMatrixDll PROPERTIES PREFIX "") # Remove lib Prefix
42 | SET_TARGET_PROPERTIES(CalcDistanceMatrix PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/x64/GCC/") # Remove lib Prefix
43 | SET_TARGET_PROPERTIES(CalcDistanceMatrixDll PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/x64/GCC/") # DLL is considered Run Time
44 | # Currently works with GCC only
45 |
46 | # Run the Process
47 | # cmake .. -G"Visual Studio 15 2017 Win64"
48 | # cmake .. -G"Visual Studio 15 2017 Win64" -T"Intel C++ Compiler 18.0"
49 | # cmake .. -G"MinGW Makefiles"
50 |
51 | # cmake --build . --config Release
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Localization/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. If there is a predefined variable called 'subStreamNumberDefault'
4 | % it will be used to set the SubStream of the Random Number
5 | % Generator.
6 | % TODO:
7 | % 1. ds
8 | % Release Notes
9 | % - 1.0.004 05/07/2018 Royi Avital
10 | % * Added case for 'subStreamNumberDefault = 0'.
11 | % - 1.0.003 29/06/2018 Royi Avital
12 | % * Clearing all variables but 'subStreamNumberDefault'.
13 | % * Setting 'subStreamNumber' only if 'subStreamNumberDefault' not
14 | % defined.
15 | % - 1.0.002 19/04/2018 Royi Avital
16 | % * Added 'markerSizeMedium' (Matches 'markerSizeNormal').
17 | % - 1.0.001 24/11/2016 Royi Avital
18 | % * Added figure positions options.
19 | % - 1.0.000 08/11/2016 Royi Avital
20 | % * First release.
21 | %
22 | %
23 | %% General Parameters
24 |
25 | close('all');
26 | clearvars('-except', 'subStreamNumberDefault');
27 | clc();
28 |
29 | % set(0, 'DefaultFigureWindowStyle', 'docked');
30 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
31 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
32 |
33 | figPosSmall = [100, 100, 0400, 0300];
34 | figPosMedium = [100, 100, 0800, 0600];
35 | figPosLarge = [100, 100, 0960, 0720];
36 | figPosXLarge = [100, 100, 1100, 0825];
37 | figPosX2Large = [100, 100, 1200, 0900];
38 | figPosX3Large = [100, 100, 1400, 1050];
39 | figPosDefault = [100, 100, 0560, 0420];
40 |
41 | fontSizeTitle = 14;
42 | fontSizeAxis = 12;
43 | fontSizeString = 12;
44 |
45 | lineWidthThin = 1;
46 | lineWidthNormal = 3;
47 | lineWidthThick = 4;
48 |
49 | markerSizeSmall = 4;
50 | markerSizeMedium = 8;
51 | markerSizeNormal = 8;
52 | markerSizeLarge = 10;
53 |
54 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
55 | % https://www.mathworks.com/matlabcentral/answers/160332
56 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
57 |
58 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
59 |
60 | if(exist('subStreamNumberDefault', 'var') && (subStreamNumberDefault ~= 0))
61 | subStreamNumber = subStreamNumberDefault;
62 | else
63 | subStreamNumber = round(sum(clock()));
64 | end
65 | set(randomNumberStream, 'Substream', subStreamNumber);
66 | RandStream.setGlobalStream(randomNumberStream);
67 |
68 | FALSE = 0;
69 | TRUE = 1;
70 |
71 | OFF = 0;
72 | ON = 1;
73 |
74 |
--------------------------------------------------------------------------------
/Optimization/ProxFunctions/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. If there is a predefined variable called 'subStreamNumberDefault'
4 | % it will be used to set the SubStream of the Random Number
5 | % Generator.
6 | % TODO:
7 | % 1. ds
8 | % Release Notes
9 | % - 1.0.004 05/07/2018 Royi Avital
10 | % * Added case for 'subStreamNumberDefault = 0'.
11 | % - 1.0.003 29/06/2018 Royi Avital
12 | % * Clearing all variables but 'subStreamNumberDefault'.
13 | % * Setting 'subStreamNumber' only if 'subStreamNumberDefault' not
14 | % defined.
15 | % - 1.0.002 19/04/2018 Royi Avital
16 | % * Added 'markerSizeMedium' (Matches 'markerSizeNormal').
17 | % - 1.0.001 24/11/2016 Royi Avital
18 | % * Added figure positions options.
19 | % - 1.0.000 08/11/2016 Royi Avital
20 | % * First release.
21 | %
22 | %
23 | %% General Parameters
24 |
25 | close('all');
26 | clearvars('-except', 'subStreamNumberDefault');
27 | clc();
28 |
29 | % set(0, 'DefaultFigureWindowStyle', 'docked');
30 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
31 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
32 |
33 | figPosSmall = [100, 100, 0400, 0300];
34 | figPosMedium = [100, 100, 0800, 0600];
35 | figPosLarge = [100, 100, 0960, 0720];
36 | figPosXLarge = [100, 100, 1100, 0825];
37 | figPosX2Large = [100, 100, 1200, 0900];
38 | figPosX3Large = [100, 100, 1400, 1050];
39 | figPosDefault = [100, 100, 0560, 0420];
40 |
41 | fontSizeTitle = 14;
42 | fontSizeAxis = 12;
43 | fontSizeString = 12;
44 |
45 | lineWidthThin = 1;
46 | lineWidthNormal = 3;
47 | lineWidthThick = 4;
48 |
49 | markerSizeSmall = 4;
50 | markerSizeMedium = 8;
51 | markerSizeNormal = 8;
52 | markerSizeLarge = 10;
53 |
54 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
55 | % https://www.mathworks.com/matlabcentral/answers/160332
56 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
57 |
58 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
59 |
60 | if(exist('subStreamNumberDefault', 'var') && (subStreamNumberDefault ~= 0))
61 | subStreamNumber = subStreamNumberDefault;
62 | else
63 | subStreamNumber = round(sum(clock()));
64 | end
65 | set(randomNumberStream, 'Substream', subStreamNumber);
66 | RandStream.setGlobalStream(randomNumberStream);
67 |
68 | FALSE = 0;
69 | TRUE = 1;
70 |
71 | OFF = 0;
72 | ON = 1;
73 |
74 |
--------------------------------------------------------------------------------
/Optimization/LsTvSolversAnalysis/InitScript.m:
--------------------------------------------------------------------------------
1 | % Init Script
2 | % Remarks:
3 | % 1. If there is a predefined variable called 'subStreamNumberDefault'
4 | % it will be used to set the SubStream of the Random Number
5 | % Generator.
6 | % TODO:
7 | % 1. ds
8 | % Release Notes
9 | % - 1.0.004 05/07/2018 Royi Avital
10 | % * Added case for 'subStreamNumberDefault = 0'.
11 | % - 1.0.003 29/06/2018 Royi Avital
12 | % * Clearing all variables but 'subStreamNumberDefault'.
13 | % * Setting 'subStreamNumber' only if 'subStreamNumberDefault' not
14 | % defined.
15 | % - 1.0.002 19/04/2018 Royi Avital
16 | % * Added 'markerSizeMedium' (Matches 'markerSizeNormal').
17 | % - 1.0.001 24/11/2016 Royi Avital
18 | % * Added figure positions options.
19 | % - 1.0.000 08/11/2016 Royi Avital
20 | % * First release.
21 | %
22 | %
23 | %% General Parameters
24 |
25 | close('all');
26 | clearvars('-except', 'subStreamNumberDefault');
27 | clc();
28 |
29 | % set(0, 'DefaultFigureWindowStyle', 'docked');
30 | % defaultLoosInset = get(0, 'DefaultAxesLooseInset');
31 | % set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);
32 |
33 | figPosSmall = [100, 100, 0400, 0300];
34 | figPosMedium = [100, 100, 0800, 0600];
35 | figPosLarge = [100, 100, 0960, 0720];
36 | figPosXLarge = [100, 100, 1100, 0825];
37 | figPosX2Large = [100, 100, 1200, 0900];
38 | figPosX3Large = [100, 100, 1400, 1050];
39 | figPosDefault = [100, 100, 0560, 0420];
40 |
41 | fontSizeTitle = 14;
42 | fontSizeAxis = 12;
43 | fontSizeString = 12;
44 |
45 | lineWidthThin = 1;
46 | lineWidthNormal = 3;
47 | lineWidthThick = 4;
48 |
49 | markerSizeSmall = 4;
50 | markerSizeMedium = 8;
51 | markerSizeNormal = 8;
52 | markerSizeLarge = 10;
53 |
54 | % https://www.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html
55 | % https://www.mathworks.com/matlabcentral/answers/160332
56 | mColorOrder = get(groot, 'DefaultAxesColorOrder');
57 |
58 | randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');
59 |
60 | if(exist('subStreamNumberDefault', 'var') && (subStreamNumberDefault ~= 0))
61 | subStreamNumber = subStreamNumberDefault;
62 | else
63 | subStreamNumber = round(sum(clock()));
64 | end
65 | set(randomNumberStream, 'Substream', subStreamNumber);
66 | RandStream.setGlobalStream(randomNumberStream);
67 |
68 | FALSE = 0;
69 | TRUE = 1;
70 |
71 | OFF = 0;
72 | ON = 1;
73 |
74 |
--------------------------------------------------------------------------------
/Optimization/LsTvSolversAnalysis/GradientAnalysis.m:
--------------------------------------------------------------------------------
1 | % Gradient Analysis
2 | % References:
3 | % 1. aa
4 | % Remarks:
5 | % 1.
6 | % Known Issues:
7 | % 1. IRLS Solver doesn't work.
8 | % TODO:
9 | % 1. Add Coordinate Descent based algorithm.
10 | % Release Notes
11 | % - 1.0.000 27/11/2019
12 | % * First release.
13 |
14 |
15 | %% General Parameters
16 |
17 | subStreamNumberDefault = 0;
18 |
19 | run('InitScript.m');
20 |
21 | figureIdx = 0;
22 | figureCounterSpec = '%04d';
23 |
24 | generateFigures = ON;
25 |
26 | DIFF_MODE_FORWARD = 1;
27 | DIFF_MODE_BACKWARD = 2;
28 | DIFF_MODE_CENTRAL = 3;
29 | DIFF_MODE_COMPLEX = 4;
30 |
31 |
32 | %% Simulation Parameters
33 |
34 | numRows = 10;
35 | numCols = 5;
36 |
37 | paramLambda = 0.1;
38 |
39 | diffMode = DIFF_MODE_CENTRAL;
40 | epsVal = 1e-7;
41 |
42 |
43 | %% Generate Data
44 |
45 | mA = randn(numRows, numCols);
46 | % mA = eye(numRows);
47 | vB = randn(numRows, 1);
48 |
49 | vP = randn(numCols - 1, 1);
50 |
51 | % Generate the Diff Operator (1D Gradient) by Finite Differences
52 | mD = spdiags([-ones(numCols, 1), ones(numCols, 1)], [0, 1], numCols - 1, numCols);
53 |
54 | vAB = mA.' * vB;
55 | mAAInv = inv(mA.' * mA); % 1)
36 | if numel(varargin{2}) == 3
37 | map = varargin{2};
38 | else
39 | center = varargin{2};
40 | end
41 | end
42 |
43 | if (nargin > 2)
44 | center = varargin{3};
45 | end
46 |
47 | % Display the image.
48 | if isempty(map)
49 | hIm = imshow(A);
50 | else
51 | hIm = imshow(A,map);
52 | end
53 |
54 | hImageFigure = ancestor(hIm, 'figure');
55 |
56 | hPixelRegionFig = impixelregion(hIm);
57 | set(hPixelRegionFig, 'Position', get(0, 'DefaultFigurePosition'));
58 |
59 | if ~isempty(center)
60 | % Adjust the center of the view. To do this we have to find the
61 | % imscrollpanel and get its API.
62 | hPixelRegionIm = findobj(hPixelRegionFig, 'type', 'image');
63 | if verLessThan('matlab','8.2')
64 | hScrollable = ancestor(hPixelRegionIm, 'uipanel');
65 | hImscrollPanel = get(hScrollable, 'Parent');
66 | else
67 | hImscrollPanel = ancestor(hPixelRegionIm, 'uipanel');
68 | end
69 | spApi = iptgetapi(hImscrollPanel);
70 | currentMag = spApi.getMagnification();
71 | spApi.setMagnificationAndCenter(currentMag, center(1), center(2));
72 | end
73 |
74 | % Execute the "print to figure" operation.
75 | menu = findobj(hPixelRegionFig, 'Label', '&Print to Figure');
76 | fcn = get(menu, 'Callback');
77 | fcn();
78 |
79 | delete(hPixelRegionFig);
80 | delete(hImageFigure);
81 |
82 |
--------------------------------------------------------------------------------