Skip to content

Commit 85ec1e9

Browse files
authored
Merge branch 'development' into update-lexci-models
2 parents 74e5f65 + df448b0 commit 85ec1e9

File tree

102 files changed

+657
-649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+657
-649
lines changed

.gitignore

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,54 @@ build/
7979
.settings
8080
python/tests/__pycache__
8181
*.h.gch
82-
*~
82+
*~
83+
84+
### CMake ###
85+
CMakeLists.txt.user
86+
CMakeCache.txt
87+
CMakeFiles
88+
CMakeScripts
89+
Testing
90+
Makefile
91+
cmake_install.cmake
92+
install_manifest.txt
93+
compile_commands.json
94+
CTestTestfile.cmake
95+
_deps
96+
97+
# CMake External projects (created by CMake fetchcontent module)
98+
*-prefix/
99+
100+
### C++ ###
101+
# Prerequisites
102+
*.d
103+
104+
# Compiled Object files
105+
*.slo
106+
*.lo
107+
*.o
108+
*.obj
109+
110+
# Precompiled Headers
111+
*.gch
112+
*.pch
113+
114+
# Compiled Dynamic libraries
115+
*.so
116+
*.dylib
117+
*.dll
118+
119+
# Fortran module files
120+
*.mod
121+
*.smod
122+
123+
# Compiled Static libraries
124+
*.lai
125+
*.la
126+
*.a
127+
*.lib
128+
129+
# Executables
130+
*.exe
131+
*.out
132+
*.app

CMakeLists.txt

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1-
cmake_minimum_required(VERSION 3.0)
2-
project(Sopt CXX)
1+
cmake_minimum_required(VERSION 3.13.4) # CMake 3.13.4 is the currently default in Debian 10 repositories
2+
project(Sopt
3+
DESCRIPTION "Sparse OPTimisation using state-of-the-art convex optimisation algorithms."
4+
HOMEPAGE_URL "http://astro-informatics.github.io/sopt/"
5+
LANGUAGES CXX)
6+
7+
set(CMAKE_CXX_STANDARD 17)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9+
set(CMAKE_CXX_EXTENSIONS OFF)
10+
11+
# https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html
12+
# Enable output of compile commands during generation. If enabled, generates a compile_commands.json file containing the exact compiler calls for all translation units of the project in machine-readable form. This can be consumed by various IDEs and static analysers to provide smarter project diagnostics/completions etc.
13+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
14+
15+
# https://stackoverflow.com/a/67410042
16+
# Create a symlink to compile_commands.json located in CMAKE_BINARY_DIR to the project root (works across filesystems)
17+
execute_process(
18+
COMMAND ${CMAKE_COMMAND} -E create_symlink
19+
${CMAKE_BINARY_DIR}/compile_commands.json
20+
${CMAKE_SOURCE_DIR}/compile_commands.json)
321

422
# Location of extra cmake includes for the project
523
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_files)
@@ -33,11 +51,7 @@ if(tests)
3351
enable_testing()
3452
endif()
3553

36-
# Add c++11 stuff
37-
#include(AddCPP11Flags)
38-
set(CMAKE_CXX_STANDARD 17)
39-
include(CheckCXX11Features)
40-
cxx11_feature_check(REQUIRED unique_ptr override)
54+
4155
include(compilations)
4256

4357
# search/install dependencies

cpp/benchmarks/conjugate_gradient.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void function_cg(benchmark::State &state) {
2626

2727
auto const AhA = A.matrix().transpose().conjugate() * A.matrix();
2828
auto const Ahb = A.matrix().transpose().conjugate() * b.matrix();
29-
typedef sopt::Vector<TYPE> t_Vector;
29+
using t_Vector = sopt::Vector<TYPE>;
3030
auto func = [&AhA](t_Vector &out, t_Vector const &input) { out = AhA * input; };
3131
auto output = sopt::Vector<TYPE>::Zero(N).eval();
3232
sopt::ConjugateGradient cg(0, epsilon);

cpp/benchmarks/l1_proximal.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
template <class TYPE>
88
void function_l1p(benchmark::State &state) {
9-
typedef typename sopt::real_type<TYPE>::type Real;
9+
using Real = typename sopt::real_type<TYPE>::type;
1010
auto const N = state.range_x();
1111
auto const input = sopt::Vector<TYPE>::Random(N).eval();
1212
auto const Psi = sopt::Matrix<TYPE>::Random(input.size(), input.size() * 10).eval();

cpp/docs/Doxyfile.in

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ SUBGROUPING = YES
391391
INLINE_GROUPED_CLASSES = NO
392392

393393
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
394-
# with only public data fields or simple typedef fields will be shown inline in
394+
# with only public data fields or simple type alias fields will be shown inline in
395395
# the documentation of the scope in which they are defined (i.e. file,
396396
# namespace, or group documentation), provided this scope is documented. If set
397397
# to NO, structs, classes, and unions are shown on a separate page (for HTML and
@@ -400,16 +400,16 @@ INLINE_GROUPED_CLASSES = NO
400400

401401
INLINE_SIMPLE_STRUCTS = NO
402402

403-
# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
404-
# enum is documented as struct, union, or enum with the name of the typedef. So
405-
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
406-
# with name TypeT. When disabled the typedef will appear as a member of a file,
403+
# When TYPEALIAS_HIDES_STRUCT tag is enabled, a type alias of a struct, union, or
404+
# enum is documented as struct, union, or enum with the name of the type alias. So
405+
# using TypeT = struct TypeS {}; will appear in the documentation as a struct
406+
# with name TypeT. When disabled the type alias will appear as a member of a file,
407407
# namespace, or class. And the struct will be named TypeS. This can typically be
408408
# useful for C code in case the coding convention dictates that all compound
409-
# types are typedef'ed and only the typedef is referenced, never the tag name.
409+
# types are type aliases and only the alias is referenced, never the tag name.
410410
# The default value is: NO.
411411

412-
TYPEDEF_HIDES_STRUCT = NO
412+
TYPEALIAS_HIDES_STRUCT = NO
413413

414414
# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
415415
# cache is used to resolve symbols given their name and scope. Since this can be
@@ -874,7 +874,7 @@ RECURSIVE = YES
874874
# Note that relative paths are relative to the directory from which doxygen is
875875
# run.
876876

877-
EXCLUDE =
877+
EXCLUDE =
878878

879879
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
880880
# directories that are symbolic links (a Unix file system feature) are excluded

cpp/examples/conjugate_gradient.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ int main(int, char const **) {
88
// Lets try both approaches.
99

1010
// Creates the input.
11-
typedef sopt::Vector<sopt::t_complex> t_Vector;
12-
typedef sopt::Matrix<sopt::t_complex> t_Matrix;
11+
using t_Vector = sopt::Vector<sopt::t_complex>;
12+
using t_Matrix = sopt::Matrix<sopt::t_complex>;
1313
t_Vector const b = t_Vector::Random(8);
1414
t_Matrix const A = t_Matrix::Random(b.size(), b.size());
1515

cpp/examples/forward_backward/inpainting.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222

2323
// \min_{x} ||\Psi^Tx||_1 \quad \mbox{s.t.} \quad ||y - Ax||_2 < \epsilon and x \geq 0
2424
int main(int argc, char const **argv) {
25-
// Some typedefs for simplicity
26-
typedef double Scalar;
25+
// Some type aliases for simplicity
26+
using Scalar = double;
2727
// Column vector - linear algebra - A * x is a matrix-vector multiplication
2828
// type expected by Forward Backward
29-
typedef sopt::Vector<Scalar> Vector;
29+
using Vector = sopt::Vector<Scalar>;
3030
// Matrix - linear algebra - A * x is a matrix-vector multiplication
3131
// type expected by Forward Backward
32-
typedef sopt::Matrix<Scalar> Matrix;
32+
using Matrix = sopt::Matrix<Scalar>;
3333
// Image - 2D array - A * x is a coefficient-wise multiplication
3434
// Type expected by wavelets and image write/read functions
35-
typedef sopt::Image<Scalar> Image;
35+
using Image = sopt::Image<Scalar>;
3636

3737
std::string const input = argc >= 2 ? argv[1] : "cameraman256";
3838
std::string const output = argc == 3 ? argv[2] : "none";
@@ -46,9 +46,9 @@ int main(int argc, char const **argv) {
4646
exit(0);
4747
}
4848
// Set up random numbers for C and C++
49-
auto const seed = std::time(0);
50-
std::srand((unsigned int)seed);
51-
std::mt19937 mersenne(std::time(0));
49+
auto const seed = std::time(nullptr);
50+
std::srand(static_cast<unsigned int>(seed));
51+
std::mt19937 mersenne(std::time(nullptr));
5252

5353
// Initializes and sets logger (if compiled with logging)
5454
// See set_level function for levels.

cpp/examples/forward_backward/inpainting_credible_interval.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323

2424
// \min_{x} ||\Psi^Tx||_1 \quad \mbox{s.t.} \quad ||y - Ax||_2 < \epsilon and x \geq 0
2525
int main(int argc, char const **argv) {
26-
// Some typedefs for simplicity
27-
typedef sopt::t_real Scalar;
26+
// Some type aliases for simplicity
27+
using Scalar = sopt::t_real;
2828
// Column vector - linear algebra - A * x is a matrix-vector multiplication
2929
// type expected by Forward Backward
30-
typedef sopt::Vector<Scalar> Vector;
30+
using Vector = sopt::Vector<Scalar>;
3131
// Matrix - linear algebra - A * x is a matrix-vector multiplication
3232
// type expected by Forward Backward
33-
typedef sopt::Matrix<Scalar> Matrix;
33+
using Matrix = sopt::Matrix<Scalar>;
3434
// Image - 2D array - A * x is a coefficient-wise multiplication
3535
// Type expected by wavelets and image write/read functions
36-
typedef sopt::Image<Scalar> Image;
36+
using Image = sopt::Image<Scalar>;
3737

3838
std::string const input = argc >= 2 ? argv[1] : "cameraman256";
3939
std::string const output = argc == 3 ? argv[2] : "none";
@@ -47,9 +47,9 @@ int main(int argc, char const **argv) {
4747
exit(0);
4848
}
4949
// Set up random numbers for C and C++
50-
auto const seed = std::time(0);
51-
std::srand((unsigned int)seed);
52-
std::mt19937 mersenne(std::time(0));
50+
auto const seed = std::time(nullptr);
51+
std::srand(static_cast<unsigned int>(seed));
52+
std::mt19937 mersenne(std::time(nullptr));
5353

5454
// Initializes and sets logger (if compiled with logging)
5555
// See set_level function for levels.

cpp/examples/forward_backward/inpainting_joint_map.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323

2424
// \min_{x} ||\Psi^Tx||_1 \quad \mbox{s.t.} \quad ||y - Ax||_2 < \epsilon and x \geq 0
2525
int main(int argc, char const **argv) {
26-
// Some typedefs for simplicity
27-
typedef double Scalar;
26+
// Some type aliases for simplicity
27+
using Scalar = double;
2828
// Column vector - linear algebra - A * x is a matrix-vector multiplication
2929
// type expected by Forward Backward
30-
typedef sopt::Vector<Scalar> Vector;
30+
using Vector = sopt::Vector<Scalar>;
3131
// Matrix - linear algebra - A * x is a matrix-vector multiplication
3232
// type expected by Forward Backward
33-
typedef sopt::Matrix<Scalar> Matrix;
33+
using Matrix = sopt::Matrix<Scalar>;
3434
// Image - 2D array - A * x is a coefficient-wise multiplication
3535
// Type expected by wavelets and image write/read functions
36-
typedef sopt::Image<Scalar> Image;
36+
using Image = sopt::Image<Scalar>;
3737

3838
std::string const input = argc >= 2 ? argv[1] : "cameraman256";
3939
std::string const output = argc == 3 ? argv[2] : "none";
@@ -47,9 +47,9 @@ int main(int argc, char const **argv) {
4747
exit(0);
4848
}
4949
// Set up random numbers for C and C++
50-
auto const seed = std::time(0);
51-
std::srand((unsigned int)seed);
52-
std::mt19937 mersenne(std::time(0));
50+
auto const seed = std::time(nullptr);
51+
std::srand(static_cast<unsigned int>(seed));
52+
std::mt19937 mersenne(std::time(nullptr));
5353

5454
// Initializes and sets logger (if compiled with logging)
5555
// See set_level function for levels.

cpp/examples/forward_backward/l2_inpainting.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121
// \min_{x} ||\Psi^Tx||_1 \quad \mbox{s.t.} \quad ||y - Ax||_2 < \epsilon and x \geq 0
2222
int main(int argc, char const **argv) {
23-
// Some typedefs for simplicity
24-
typedef double Scalar;
23+
// Some type aliases for simplicity
24+
using Scalar = double;
2525
// Column vector - linear algebra - A * x is a matrix-vector multiplication
2626
// type expected by Forward Backward
27-
typedef sopt::Vector<Scalar> Vector;
27+
using Vector = sopt::Vector<Scalar>;
2828
// Matrix - linear algebra - A * x is a matrix-vector multiplication
2929
// type expected by Forward Backward
30-
typedef sopt::Matrix<Scalar> Matrix;
30+
using Matrix = sopt::Matrix<Scalar>;
3131
// Image - 2D array - A * x is a coefficient-wise multiplication
3232
// Type expected by wavelets and image write/read functions
33-
typedef sopt::Image<Scalar> Image;
33+
using Image = sopt::Image<Scalar>;
3434

3535
std::string const input = argc >= 2 ? argv[1] : "cameraman256";
3636
std::string const output = argc == 3 ? argv[2] : "none";
@@ -44,9 +44,9 @@ int main(int argc, char const **argv) {
4444
exit(0);
4545
}
4646
// Set up random numbers for C and C++
47-
auto const seed = std::time(0);
48-
std::srand((unsigned int)seed);
49-
std::mt19937 mersenne(std::time(0));
47+
auto const seed = std::time(nullptr);
48+
std::srand(static_cast<unsigned int>(seed));
49+
std::mt19937 mersenne(std::time(nullptr));
5050

5151
// Initializes and sets logger (if compiled with logging)
5252
// See set_level function for levels.

0 commit comments

Comments
 (0)