Commit 18c1cc40ccfdfae7ee7a43d4443230a7cb559a03
1 parent
15dbd763
Updated SIproc for vcpkg
Showing
10 changed files
with
174 additions
and
599 deletions
Show diff stats
CMakeLists.txt
... | ... | @@ -64,14 +64,15 @@ if(WIN32) |
64 | 64 | endif(WIN32) |
65 | 65 | |
66 | 66 | #find LAPACK and supporting link_libraries |
67 | -find_package(LAPACKE REQUIRED) | |
67 | +find_package(clapack CONFIG REQUIRED) | |
68 | +find_package(OpenBLAS CONFIG REQUIRED) | |
68 | 69 | #if(MSVC) |
69 | 70 | # message("Warning: VS2015 made a change to printf and scanf functions that requires linking to legacy_stdio_definitions.lib") |
70 | 71 | #endif() |
71 | 72 | |
72 | 73 | #include include directories |
73 | 74 | include_directories(${CUDA_INCLUDE_DIRS} |
74 | - ${LAPACKE_INCLUDE_DIR} | |
75 | + ${CLAPACK_INCLUDE_DIR} | |
75 | 76 | ${STIM_INCLUDE_DIRS} |
76 | 77 | ${OpenGL_INCLUDE_DIRS} |
77 | 78 | ${GLUT_INCLUDE_DIR} |
... | ... | @@ -96,9 +97,11 @@ add_executable(siproc |
96 | 97 | target_link_libraries(siproc ${CUDA_LIBRARIES} |
97 | 98 | ${CUDA_CUBLAS_LIBRARIES} |
98 | 99 | ${CUDA_CUFFT_LIBRARIES} |
99 | - ${LAPACKE_LIBRARIES} | |
100 | + ${CLAPACK_LIBRARIES} | |
100 | 101 | ${CMAKE_THREAD_LIBS_INIT} |
101 | 102 | ${X11_LIBRARIES} |
103 | + OpenBLAS::OpenBLAS | |
104 | + f2c lapack | |
102 | 105 | ) |
103 | 106 | |
104 | 107 | #create the VIEW executable---------------------------------------------- |
... | ... | @@ -112,7 +115,7 @@ target_link_libraries(siview |
112 | 115 | ${GLUT_LIBRARIES} |
113 | 116 | ) |
114 | 117 | if(WIN32) |
115 | - target_link_libraries(siview ${GLEW_GLEW_LIBRARY}) | |
118 | + target_link_libraries(siview ${GLEW_LIBRARIES}) | |
116 | 119 | endif(WIN32) |
117 | 120 | |
118 | 121 | #create instrument-specific subroutine executables |
... | ... | @@ -140,7 +143,7 @@ target_link_libraries(spero |
140 | 143 | #if Boost is found, set an environment variable to use with preprocessor directives |
141 | 144 | if(Boost_FILESYSTEM_FOUND) |
142 | 145 | target_link_libraries(siproc ${Boost_FILESYSTEM_LIBRARIES} |
143 | - ${Boost_SYSTEM_LIBRARY} | |
146 | + ${Boost_SYSTEM_LIBRARY} | |
144 | 147 | ) |
145 | 148 | target_link_libraries(siview |
146 | 149 | ${Boost_FILESYSTEM_LIBRARIES} | ... | ... |
FindFANN.cmake deleted
1 | -# | |
2 | -# Windows users: define the GLEW_PATH environment variable to point | |
3 | -# to the directory containing: | |
4 | -# include/fann.h | |
5 | -# lib/*fann.lib | |
6 | - | |
7 | - | |
8 | -# FANN_FOUND - system has fann | |
9 | -# FANN_INCLUDE_DIRS - the fann include directory | |
10 | -# FANN_LIBRARIES - Link these to use fann | |
11 | -# FANN_DEFINITIONS - Compiler switches required for using fann | |
12 | -# | |
13 | - | |
14 | -if(FANN_LIBRARIES AND FANN_INCLUDE_DIRS) | |
15 | - set(FANN_FOUND TRUE) | |
16 | -else() | |
17 | - find_path(FANN_INCLUDE_DIR | |
18 | - NAMES | |
19 | - fann.h | |
20 | - PATHS | |
21 | - $ENV{FANN_PATH}/include | |
22 | - ${FANN_DIR}/include | |
23 | - /usr/include | |
24 | - /usr/local/include | |
25 | - /opt/local/include | |
26 | - /sw/include | |
27 | - ) | |
28 | - | |
29 | - set( _libraries doublefann floatfann ) | |
30 | - | |
31 | - foreach( _lib ${_libraries} ) | |
32 | - string( TOUPPER ${_lib} _name ) | |
33 | - | |
34 | - find_library(${_name}_LIBRARY | |
35 | - NAMES | |
36 | - ${_lib} | |
37 | - PATHS | |
38 | - $ENV{FANN_PATH}/lib | |
39 | - ${FANN_DIR}/lib | |
40 | - /usr/lib | |
41 | - /usr/local/lib | |
42 | - /opt/local/lib | |
43 | - /sw/lib | |
44 | - ) | |
45 | - endforeach() | |
46 | - | |
47 | - | |
48 | - set(FANN_INCLUDE_DIRS | |
49 | - ${FANN_INCLUDE_DIR} | |
50 | - ) | |
51 | - | |
52 | - set(FANN_LIBRARIES | |
53 | - ${FANN_LIBRARIES} | |
54 | - ${FANN_LIBRARY} | |
55 | - ${DOUBLEFANN_LIBRARY} | |
56 | - ${FIXEDFANN_LIBRARY} | |
57 | - ${FLOATFANN_LIBRARY} | |
58 | - ) | |
59 | - | |
60 | - if( UNIX ) | |
61 | - set( FANN_LIBRARIES ${FANN_LIBRARIES} m ) | |
62 | - endif() | |
63 | - | |
64 | - if(FANN_INCLUDE_DIRS AND FANN_LIBRARIES) | |
65 | - set(FANN_FOUND TRUE) | |
66 | - endif() | |
67 | - | |
68 | - if(FANN_FOUND) | |
69 | - if(NOT FANN_FIND_QUIETLY) | |
70 | - message(STATUS "Found FANN") | |
71 | - #message(STATUS "FANN_INCLUDE_DIRS: ${FANN_INCLUDE_DIRS}") | |
72 | - #message(STATUS "FANN_LIBRARIES: ${FANN_LIBRARIES}") | |
73 | - endif() | |
74 | - else() | |
75 | - if(FANN_FIND_REQUIRED) | |
76 | - message(FATAL_ERROR "Could not find FANN") | |
77 | - endif() | |
78 | - endif() | |
79 | - | |
80 | - mark_as_advanced(FANN_INCLUDE_DIRS FANN_LIBRARIES) | |
81 | -endif() |
FindGLEW.cmake deleted
1 | -# Copyright (c) 2012-2016 DreamWorks Animation LLC | |
2 | -# | |
3 | -# All rights reserved. This software is distributed under the | |
4 | -# Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ ) | |
5 | -# | |
6 | -# Redistributions of source code must retain the above copyright | |
7 | -# and license notice and the following restrictions and disclaimer. | |
8 | -# | |
9 | -# * Neither the name of DreamWorks Animation nor the names of | |
10 | -# its contributors may be used to endorse or promote products derived | |
11 | -# from this software without specific prior written permission. | |
12 | -# | |
13 | -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
14 | -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
15 | -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
16 | -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
17 | -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, | |
18 | -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
19 | -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
20 | -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
21 | -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 | -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
23 | -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | -# IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE | |
25 | -# LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00. | |
26 | -# | |
27 | - | |
28 | -#-*-cmake-*- | |
29 | -# - Find GLEW | |
30 | -# | |
31 | -# Author : Nicholas Yue yue.nicholas@gmail.com | |
32 | -# | |
33 | -# This auxiliary CMake file helps in find the GLEW headers and libraries | |
34 | -# | |
35 | -# GLEW_FOUND set if Glew is found. | |
36 | -# GLEW_INCLUDE_DIR GLEW's include directory | |
37 | -# GLEW_GLEW_LIBRARY GLEW libraries | |
38 | -# GLEW_glewmx_LIBRARY GLEWmx libraries (Mulitple Rendering Context) | |
39 | - | |
40 | -FIND_PACKAGE ( PackageHandleStandardArgs ) | |
41 | - | |
42 | -FIND_PATH( GLEW_LOCATION include/GL/glew.h | |
43 | - "$ENV{GLEW_ROOT}" | |
44 | - NO_DEFAULT_PATH | |
45 | - NO_SYSTEM_ENVIRONMENT_PATH | |
46 | - ) | |
47 | - | |
48 | -FIND_PACKAGE_HANDLE_STANDARD_ARGS ( GLEW | |
49 | - REQUIRED_VARS GLEW_LOCATION | |
50 | - ) | |
51 | - | |
52 | -IF ( GLEW_LOCATION ) | |
53 | - SET( GLEW_INCLUDE_DIR "${GLEW_LOCATION}/include" CACHE STRING "GLEW include path") | |
54 | - | |
55 | - SET ( ORIGINAL_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) | |
56 | - IF (GLEW_USE_STATIC_LIBS) | |
57 | - IF (APPLE) | |
58 | - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") | |
59 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW PATHS ${GLEW_LOCATION}/lib | |
60 | - NO_DEFAULT_PATH | |
61 | - NO_SYSTEM_ENVIRONMENT_PATH | |
62 | - ) | |
63 | - FIND_LIBRARY ( GLEWmx_LIBRARY_PATH GLEWmx PATHS ${GLEW_LOCATION}/lib | |
64 | - NO_DEFAULT_PATH | |
65 | - NO_SYSTEM_ENVIRONMENT_PATH | |
66 | - ) | |
67 | - # MESSAGE ( "APPLE STATIC" ) | |
68 | - # MESSAGE ( "GLEW_LIBRARY_PATH = " ${GLEW_LIBRARY_PATH} ) | |
69 | - ELSEIF (WIN32) | |
70 | - message("Windows Found!") | |
71 | - # Link library | |
72 | - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") | |
73 | - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
74 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW32S PATHS $ENV{GLEW_ROOT}/lib/x64 NO_DEFAULT_PATH) | |
75 | - message("64-bit library") | |
76 | - else( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
77 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW32S PATHS $ENV{GLEW_ROOT}/lib NO_DEFAULT_PATH) | |
78 | - message("32-bit library") | |
79 | - endif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
80 | - ELSE (APPLE) | |
81 | - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") | |
82 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW PATHS ${GLEW_LOCATION}/lib | |
83 | - NO_DEFAULT_PATH | |
84 | - NO_SYSTEM_ENVIRONMENT_PATH | |
85 | - ) | |
86 | - FIND_LIBRARY ( GLEWmx_LIBRARY_PATH GLEWmx PATHS ${GLEW_LOCATION}/lib | |
87 | - NO_DEFAULT_PATH | |
88 | - NO_SYSTEM_ENVIRONMENT_PATH | |
89 | - ) | |
90 | - # MESSAGE ( "LINUX STATIC" ) | |
91 | - # MESSAGE ( "GLEW_LIBRARY_PATH = " ${GLEW_LIBRARY_PATH} ) | |
92 | - ENDIF (APPLE) | |
93 | - ELSE () | |
94 | - IF (APPLE) | |
95 | - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib") | |
96 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW PATHS ${GLEW_LOCATION}/lib ) | |
97 | - FIND_LIBRARY ( GLEWmx_LIBRARY_PATH GLEWmx PATHS ${GLEW_LOCATION}/lib ) | |
98 | - ELSEIF (WIN32) | |
99 | - # Link library | |
100 | - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") | |
101 | - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
102 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW32S PATHS $ENV{GLEW_ROOT}/lib/x64 NO_DEFAULT_PATH) | |
103 | - else( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
104 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW32S PATHS $ENV{GLEW_ROOT}/lib NO_DEFAULT_PATH) | |
105 | - endif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
106 | - ELSE (APPLE) | |
107 | - # Unices | |
108 | - FIND_LIBRARY ( GLEW_LIBRARY_PATH GLEW PATHS ${GLEW_LOCATION}/lib | |
109 | - NO_DEFAULT_PATH | |
110 | - NO_SYSTEM_ENVIRONMENT_PATH | |
111 | - ) | |
112 | - FIND_LIBRARY ( GLEWmx_LIBRARY_PATH GLEWmx PATHS ${GLEW_LOCATION}/lib | |
113 | - NO_DEFAULT_PATH | |
114 | - NO_SYSTEM_ENVIRONMENT_PATH | |
115 | - ) | |
116 | - ENDIF (APPLE) | |
117 | - ENDIF () | |
118 | - # MUST reset | |
119 | - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${ORIGINAL_CMAKE_FIND_LIBRARY_SUFFIXES}) | |
120 | - | |
121 | - SET( GLEW_GLEW_LIBRARY ${GLEW_LIBRARY_PATH} CACHE STRING "GLEW library") | |
122 | - SET( GLEW_GLEWmx_LIBRARY ${GLEWmx_LIBRARY_PATH} CACHE STRING "GLEWmx library") | |
123 | - | |
124 | -ENDIF () |
FindGLUT.cmake deleted
1 | -#.rst: | |
2 | -# FindGLUT | |
3 | -# -------- | |
4 | -# | |
5 | -# try to find glut library and include files. | |
6 | -# | |
7 | -# IMPORTED Targets | |
8 | -# ^^^^^^^^^^^^^^^^ | |
9 | -# | |
10 | -# This module defines the :prop_tgt:`IMPORTED` targets: | |
11 | -# | |
12 | -# ``GLUT::GLUT`` | |
13 | -# Defined if the system has GLUT. | |
14 | -# | |
15 | -# Result Variables | |
16 | -# ^^^^^^^^^^^^^^^^ | |
17 | -# | |
18 | -# This module sets the following variables: | |
19 | -# | |
20 | -# :: | |
21 | -# | |
22 | -# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc. | |
23 | -# GLUT_LIBRARIES, the libraries to link against | |
24 | -# GLUT_FOUND, If false, do not try to use GLUT. | |
25 | -# | |
26 | -# Also defined, but not for general use are: | |
27 | -# | |
28 | -# :: | |
29 | -# | |
30 | -# GLUT_glut_LIBRARY = the full path to the glut library. | |
31 | -# GLUT_Xmu_LIBRARY = the full path to the Xmu library. | |
32 | -# GLUT_Xi_LIBRARY = the full path to the Xi Library. | |
33 | - | |
34 | -#============================================================================= | |
35 | -# Copyright 2001-2009 Kitware, Inc. | |
36 | -# | |
37 | -# Distributed under the OSI-approved BSD License (the "License"); | |
38 | -# see accompanying file Copyright.txt for details. | |
39 | -# | |
40 | -# This software is distributed WITHOUT ANY WARRANTY; without even the | |
41 | -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
42 | -# See the License for more information. | |
43 | -#============================================================================= | |
44 | -# (To distribute this file outside of CMake, substitute the full | |
45 | -# License text for the above reference.) | |
46 | - | |
47 | -if (WIN32) | |
48 | - find_path( GLUT_INCLUDE_DIR NAMES GL/glut.h | |
49 | - PATHS $ENV{GLUT_ROOT}/include) | |
50 | - | |
51 | - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
52 | - find_library( GLUT_glut_LIBRARY NAMES freeglut | |
53 | - PATHS | |
54 | - $ENV{GLUT_ROOT}/lib/x64 | |
55 | - | |
56 | - NO_DEFAULT_PATH | |
57 | - ) | |
58 | - else( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
59 | - find_library( GLUT_glut_LIBRARY NAMES glut glut32 freeglut | |
60 | - PATHS | |
61 | - $ENV{GLUT_ROOT}/lib | |
62 | - ) | |
63 | - endif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | |
64 | - | |
65 | -else () | |
66 | - | |
67 | - if (APPLE) | |
68 | - find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR}) | |
69 | - find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX") | |
70 | - find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX") | |
71 | - | |
72 | - if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa) | |
73 | - add_library(GLUT::Cocoa UNKNOWN IMPORTED) | |
74 | - # Cocoa should always be a Framework, but we check to make sure. | |
75 | - if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$") | |
76 | - set_target_properties(GLUT::Cocoa PROPERTIES | |
77 | - IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}") | |
78 | - else() | |
79 | - set_target_properties(GLUT::Cocoa PROPERTIES | |
80 | - IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}") | |
81 | - endif() | |
82 | - endif() | |
83 | - else () | |
84 | - | |
85 | - if (BEOS) | |
86 | - | |
87 | - set(_GLUT_INC_DIR /boot/develop/headers/os/opengl) | |
88 | - set(_GLUT_glut_LIB_DIR /boot/develop/lib/x86) | |
89 | - | |
90 | - else() | |
91 | - | |
92 | - find_library( GLUT_Xi_LIBRARY Xi | |
93 | - /usr/openwin/lib | |
94 | - ) | |
95 | - | |
96 | - find_library( GLUT_Xmu_LIBRARY Xmu | |
97 | - /usr/openwin/lib | |
98 | - ) | |
99 | - | |
100 | - if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi) | |
101 | - add_library(GLUT::Xi UNKNOWN IMPORTED) | |
102 | - set_target_properties(GLUT::Xi PROPERTIES | |
103 | - IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}") | |
104 | - endif() | |
105 | - | |
106 | - if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu) | |
107 | - add_library(GLUT::Xmu UNKNOWN IMPORTED) | |
108 | - set_target_properties(GLUT::Xmu PROPERTIES | |
109 | - IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}") | |
110 | - endif() | |
111 | - | |
112 | - endif () | |
113 | - | |
114 | - find_path( GLUT_INCLUDE_DIR GL/glut.h | |
115 | - /usr/include/GL | |
116 | - /usr/openwin/share/include | |
117 | - /usr/openwin/include | |
118 | - /opt/graphics/OpenGL/include | |
119 | - /opt/graphics/OpenGL/contrib/libglut | |
120 | - ${_GLUT_INC_DIR} | |
121 | - ) | |
122 | - | |
123 | - find_library( GLUT_glut_LIBRARY glut | |
124 | - /usr/openwin/lib | |
125 | - ${_GLUT_glut_LIB_DIR} | |
126 | - ) | |
127 | - | |
128 | - unset(_GLUT_INC_DIR) | |
129 | - unset(_GLUT_glut_LIB_DIR) | |
130 | - | |
131 | - endif () | |
132 | - | |
133 | -endif () | |
134 | - | |
135 | -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR) | |
136 | - | |
137 | -if (GLUT_FOUND) | |
138 | - # Is -lXi and -lXmu required on all platforms that have it? | |
139 | - # If not, we need some way to figure out what platform we are on. | |
140 | - set( GLUT_LIBRARIES | |
141 | - ${GLUT_glut_LIBRARY} | |
142 | - ${GLUT_Xmu_LIBRARY} | |
143 | - ${GLUT_Xi_LIBRARY} | |
144 | - ${GLUT_cocoa_LIBRARY} | |
145 | - ) | |
146 | - | |
147 | - if(NOT TARGET GLUT::GLUT) | |
148 | - add_library(GLUT::GLUT UNKNOWN IMPORTED) | |
149 | - set_target_properties(GLUT::GLUT PROPERTIES | |
150 | - INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}") | |
151 | - if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$") | |
152 | - set_target_properties(GLUT::GLUT PROPERTIES | |
153 | - IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}") | |
154 | - else() | |
155 | - set_target_properties(GLUT::GLUT PROPERTIES | |
156 | - IMPORTED_LOCATION "${GLUT_glut_LIBRARY}") | |
157 | - endif() | |
158 | - | |
159 | - if(TARGET GLUT::Xmu) | |
160 | - set_property(TARGET GLUT::GLUT APPEND | |
161 | - PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu) | |
162 | - endif() | |
163 | - | |
164 | - if(TARGET GLUT::Xi) | |
165 | - set_property(TARGET GLUT::GLUT APPEND | |
166 | - PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi) | |
167 | - endif() | |
168 | - | |
169 | - if(TARGET GLUT::Cocoa) | |
170 | - set_property(TARGET GLUT::GLUT APPEND | |
171 | - PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa) | |
172 | - endif() | |
173 | - endif() | |
174 | - | |
175 | - #The following deprecated settings are for backwards compatibility with CMake1.4 | |
176 | - set (GLUT_LIBRARY ${GLUT_LIBRARIES}) | |
177 | - set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) | |
178 | -endif() | |
179 | - | |
180 | -mark_as_advanced( | |
181 | - GLUT_INCLUDE_DIR | |
182 | - GLUT_glut_LIBRARY | |
183 | - GLUT_Xmu_LIBRARY | |
184 | - GLUT_Xi_LIBRARY | |
185 | - ) |
FindLAPACKE.cmake deleted
1 | -# - Try to find LAPACKE | |
2 | -# | |
3 | -# Once done this will define | |
4 | -# LAPACKE_FOUND - System has LAPACKE | |
5 | -# LAPACKE_INCLUDE_DIRS - The LAPACKE include directories | |
6 | -# LAPACKE_LIBRARIES - The libraries needed to use LAPACKE | |
7 | -# LAPACKE_DEFINITIONS - Compiler switches required for using LAPACKE | |
8 | -# | |
9 | -# Usually, LAPACKE requires LAPACK and the BLAS. This module does | |
10 | -# not enforce anything about that. | |
11 | - | |
12 | -find_path(LAPACKE_INCLUDE_DIR | |
13 | - NAMES lapacke.h | |
14 | - PATHS $ENV{LAPACK_ROOT} $ENV{LAPACK_PATH} ${INCLUDE_INSTALL_DIR} | |
15 | - PATHS ENV INCLUDE) | |
16 | - | |
17 | -find_library(LAPACKE_LIBRARY liblapacke lapacke | |
18 | - PATHS $ENV{LAPACK_ROOT} $ENV{LAPACK_PATH} ${LIB_INSTALL_DIR} | |
19 | - PATHS ENV LIBRARY_PATH | |
20 | - PATHS ENV LD_LIBRARY_PATH) | |
21 | - | |
22 | -if(MSVC) | |
23 | - find_library(LAPACK_LIBRARY liblapack lapack | |
24 | - PATHS $ENV{LAPACK_ROOT} $ENV{LAPACK_PATH} ${LIB_INSTALL_DIR} | |
25 | - PATHS ENV LIBRARY_PATH | |
26 | - PATHS ENV LD_LIBRARY_PATH) | |
27 | - | |
28 | - find_library(BLAS_LIBRARY libblas blas | |
29 | - PATHS $ENV{LAPACK_ROOT} $ENV{LAPACK_PATH} ${LIB_INSTALL_DIR} | |
30 | - PATHS ENV LIBRARY_PATH | |
31 | - PATHS ENV LD_LIBRARY_PATH) | |
32 | - | |
33 | -else() | |
34 | - find_library(LAPACK REQUIRED) | |
35 | - find_library(BLAS REQUIRED) | |
36 | -endif() | |
37 | -set(LAPACKE_LIBRARIES ${LAPACKE_LIBRARY} ${LAPACK_LIBRARY} ${BLAS_LIBRARY}) | |
38 | - | |
39 | -include(FindPackageHandleStandardArgs) | |
40 | -find_package_handle_standard_args(LAPACKE DEFAULT_MSG | |
41 | - LAPACKE_INCLUDE_DIR | |
42 | - LAPACKE_LIBRARIES) | |
43 | -mark_as_advanced(LAPACKE_INCLUDE_DIR LAPACKE_LIBRARIES) |
README.md
1 | -HSIproc can be built using CMake (https://cmake.org/) and a C/C++ compiler. | |
2 | - | |
3 | -The STIM codebase is required, but will be cloned automatically if Git (https://git-scm.com/) is installed. The codebase can be downloaded manually here: | |
4 | -https://git.stim.ee.uh.edu/codebase/stimlib | |
5 | - | |
6 | -Required libraries: | |
7 | -OpenCV: http://opencv.org/ | |
8 | - | |
9 | - | |
10 | - | |
11 | ------------------------------------------------------------------------ | |
12 | -Step-by-step instructions: | |
13 | - | |
14 | -1) Download and install CMake | |
15 | - | |
16 | -2) Download and install OpenCV | |
17 | - | |
18 | -3) Download and install Git | |
19 | - | |
20 | -4) Set the CMake source directory to the directory containing this file | |
21 | - | |
22 | -5) Specify the CMake build directory where you want the executable built | |
23 | - | |
24 | -6) Use CMake to Configure and Generate the build environment | |
25 | - | |
26 | -7) Build the software (ex. in Visual Studio you will open the generated solution and compile) | |
1 | +SIproc is written using C++ and compatible with both CMake (https://cmake.org/) and the vcpkg (https://docs.microsoft.com/en-us/cpp/build/vcpkg) package manager. | |
2 | + | |
3 | +STIM (https://git.stim.ee.uh.edu/codebase/stimlib) is also required. | |
4 | + | |
5 | +Step-by-step instructions (Windows): | |
6 | +============= | |
7 | +1) Download and install CMake (https://cmake.org/) | |
8 | +2) Download and install Git (https://git-scm.com/) | |
9 | +3) Download and install vcpkg (https://github.com/microsoft/vcpkg): | |
10 | + | |
11 | + git clone https://github.com/Microsoft/vcpkg.git | |
12 | + cd vcpkg | |
13 | +4) Install the required packages: | |
14 | + | |
15 | + vcpkg install boost:x64-windows | |
16 | + vcpkg install glew:x64-windows | |
17 | + vcpkg install freeglut:x64-windows | |
18 | + vcpkg install clapack:x64-windows | |
19 | +5) Clone SIproc: | |
20 | + | |
21 | + git clone https://git.stim.ee.uh.edu/release/siproc.git | |
22 | +6) Run CMake, and select the cloned siproc directory and your choice of build location | |
23 | +7) Configure the build environment: | |
24 | +a) Click __Configure__ | |
25 | +b) Select your preferred build environment (ex. Visual Studio) | |
26 | +c) Set the platform to __x64__ | |
27 | +d) Select the option to __Specify toolchain file for cross-compiling__ | |
28 | +e) Click __ Next__ | |
29 | +f) When asked, provide the vcpkg toolchain file in: | |
30 | + | |
31 | + [vcpkg directory]\scripts\buildsystems\vcpkg.cmake | |
32 | +g) Assuming no errors were encountered, click __Generate__ | |
33 | +8) Click __Open Project__ to open your build environment | |
34 | +9) Build the project (ex. Visual Studio's __Build Project__) | |
35 | + | ... | ... |
1 | + | |
2 | +// This file contains a set of wrapper functions that are linked to the corresponding functions in CLAPACK | |
3 | + | |
4 | +extern "C" { | |
5 | +#include "f2c.h" | |
6 | +#include "clapack.h" | |
7 | +} | |
8 | + | |
9 | +void LINALG_dgeev( | |
10 | + char JOBVL, | |
11 | + char JOBVR, | |
12 | + int n, | |
13 | + double* A, | |
14 | + int LDA, | |
15 | + double* WR, | |
16 | + double* WI, | |
17 | + double* VL, | |
18 | + int LDVL, | |
19 | + double* VR, | |
20 | + int LDVR) | |
21 | +{ | |
22 | + integer LWORK = -1; | |
23 | + double WORK[1]; | |
24 | + integer INFO; | |
25 | + dgeev_(&JOBVL, &JOBVR, (integer*)&n, A, (integer*)&LDA, WR, WI, VL, (integer*)&LDVL, VR, (integer*)&LDVR, WORK, &LWORK, &INFO); | |
26 | +} | |
27 | + | |
28 | +void LINALG_dgetrf( | |
29 | + int M, | |
30 | + int N, | |
31 | + double* A, | |
32 | + int LDA, | |
33 | + int* IPIV) | |
34 | +{ | |
35 | + integer INFO; | |
36 | + dgetrf_((integer*)&M, (integer*)&N, A, (integer*)&LDA, (integer*)IPIV, &INFO); | |
37 | +} | |
38 | + | |
39 | +void LINALG_dgetri( | |
40 | + int N, | |
41 | + double* A, | |
42 | + int LDA, | |
43 | + int* IPIV) | |
44 | +{ | |
45 | + integer LWORK = -1; | |
46 | + double WORK[1]; | |
47 | + integer INFO; | |
48 | + dgetri_((integer*)&N, A, (integer*)&LDA, (integer*)IPIV, WORK, &LWORK, &INFO); | |
49 | +} | |
0 | 50 | \ No newline at end of file | ... | ... |
1 | +void LINALG_dgeev( | |
2 | + char JOBVL, | |
3 | + char JOBVR, | |
4 | + int n, | |
5 | + double* A, | |
6 | + int LDA, | |
7 | + double* WR, | |
8 | + double* WI, | |
9 | + double* VL, | |
10 | + int LDVL, | |
11 | + double* VR, | |
12 | + int LDVR); | |
13 | + | |
14 | +void LINALG_dgetrf( | |
15 | + int M, | |
16 | + int N, | |
17 | + double* A, | |
18 | + int LDA, | |
19 | + int* IPIV); | |
20 | + | |
21 | +void LINALG_dgetri( | |
22 | + int N, | |
23 | + double* A, | |
24 | + int LDA, | |
25 | + int* IPIV); | |
0 | 26 | \ No newline at end of file | ... | ... |
src/proc/hsiproc.cpp
1 | +//#include "lapacke.h" | |
2 | +//#include "cblas.h" | |
3 | + | |
4 | +//#include <string> | |
5 | +#include "linalg.h" | |
6 | + | |
1 | 7 | #include <iostream> |
2 | 8 | #include <fstream> |
3 | 9 | #include <random> |
... | ... | @@ -13,18 +19,16 @@ |
13 | 19 | #include <stim/envi/agilent_binary.h> |
14 | 20 | #include <stim/math/matrix.h> |
15 | 21 | #include <time.h> |
16 | -#include <fstream> | |
17 | 22 | #include <thread> |
18 | 23 | |
19 | 24 | //LAPACKE support for Visual Studio |
20 | -#include <complex> | |
21 | -#ifndef LAPACK_COMPLEX_CUSTOM | |
22 | -#define LAPACK_COMPLEX_CUSTOM | |
23 | -#define lapack_complex_float std::complex<float> | |
24 | -#define lapack_complex_double std::complex<double> | |
25 | -#endif | |
26 | -#include "lapacke.h" | |
27 | -//#include "cblas.h" | |
25 | +//#include <complex> | |
26 | +//#ifndef LAPACK_COMPLEX_CUSTOM | |
27 | +//#define LAPACK_COMPLEX_CUSTOM | |
28 | +//#define lapack_complex_float std::complex<float> | |
29 | +//#define lapack_complex_double std::complex<double> | |
30 | +//#endif | |
31 | + | |
28 | 32 | |
29 | 33 | void baseline(std::string infile, std::string outfile, std::string headerfile, std::vector<double> points, unsigned char* mask); |
30 | 34 | void normalize(std::string infile, std::string outfile, std::string headerfile, double band, unsigned char* mask); |
... | ... | @@ -512,12 +516,6 @@ int main(int argc, char** argv){ |
512 | 516 | //output the average spectrum |
513 | 517 | std::ofstream csv(outfile.c_str()); //open a CSV file to write the mean |
514 | 518 | |
515 | - /*if (ENVI.header.wavelength.size() > 0) //output the first wavelength | |
516 | - csv << ENVI.header.wavelength[0]<<','; | |
517 | - csv << spectrum[0]; //output the first variable | |
518 | - for (unsigned long long b = 1; b < B; b++) //for each band | |
519 | - csv << "," << spectrum[b]; //output the next variable | |
520 | - */ | |
521 | 519 | for (unsigned long long b = 0; b < B; b++) { //for each band |
522 | 520 | if (ENVI.header.wavelength.size() == B) //output the wavelength, if available |
523 | 521 | csv << ENVI.header.wavelength[b] << ','; |
... | ... | @@ -552,22 +550,6 @@ int main(int argc, char** argv){ |
552 | 550 | csv << m[b] << "," << std[b] << std::endl; |
553 | 551 | } |
554 | 552 | |
555 | - | |
556 | - | |
557 | - | |
558 | - | |
559 | - //output the average spectrum | |
560 | - /*std::ofstream csv(outfile.c_str()); //open a CSV file to write the mean | |
561 | - csv<<m[0]; //output the first variable | |
562 | - for(unsigned long long b = 1; b < B; b++) //for each band | |
563 | - csv<<","<<m[b]; //output the next variable | |
564 | - | |
565 | - //output the standard deviation | |
566 | - csv<<std::endl; | |
567 | - csv<<std[0]; | |
568 | - for(unsigned long long b = 1; b < B; b++) //for each band | |
569 | - csv<<","<<std[b]; //output the next variable | |
570 | - */ | |
571 | 553 | csv.close(); //close the output file |
572 | 554 | |
573 | 555 | free(m); //free memory storing the mean spectrum |
... | ... | @@ -703,9 +685,13 @@ int main(int argc, char** argv){ |
703 | 685 | |
704 | 686 | stim::matrix<double> JtJi = JtJ; //allocate space for the matrix inverse |
705 | 687 | int* piv = (int*) malloc(JtJi.rows() * sizeof(int)); //allocate space to store the LU decomposition pivot indices |
706 | - LAPACKE_dgetrf(LAPACK_COL_MAJOR, (int)JtJi.rows(), (int)JtJi.cols(), JtJi.data(), (int)JtJi.rows(), piv); //use LAPACK for LU decomposition | |
707 | - LAPACKE_dgetri(LAPACK_COL_MAJOR, (int)JtJi.rows(), JtJi.data(), (int)JtJi.rows(), piv); //use LAPACK to solve the inverse | |
688 | + //LAPACKE_dgetrf(LAPACK_COL_MAJOR, (int)JtJi.rows(), (int)JtJi.cols(), JtJi.data(), (int)JtJi.rows(), piv); //use LAPACK for LU decomposition | |
689 | + //LAPACKE_dgetri(LAPACK_COL_MAJOR, (int)JtJi.rows(), JtJi.data(), (int)JtJi.rows(), piv); //use LAPACK to solve the inverse | |
708 | 690 | |
691 | + // REPLACED THE ABOVE LAPACKE functions with new CLAPACK functions in linalg.cpp | |
692 | + LINALG_dgetrf((int)JtJi.rows(), (int)JtJi.cols(), JtJi.data(), (int)JtJi.rows(), piv); //use LAPACK for LU decomposition | |
693 | + LINALG_dgetri((int)JtJi.rows(), JtJi.data(), (int)JtJi.rows(), piv); //use LAPACK to solve the inverse | |
694 | + | |
709 | 695 | |
710 | 696 | stim::matrix<double> C = JtJi * Jt; //calculate C |
711 | 697 | |
... | ... | @@ -781,7 +767,12 @@ int main(int argc, char** argv){ |
781 | 767 | double* lambda_real = (double*) malloc(B * sizeof(double)); |
782 | 768 | double* lambda_imag = (double*) malloc(B * sizeof(double)); |
783 | 769 | double* evec = (double*) malloc(B * B * sizeof(double)); |
784 | - LAPACKE_dgeev(LAPACK_COL_MAJOR, 'N', 'V', (int)B, co, (int)B, lambda_real, lambda_imag, NULL, (int)B, evec, (int)B); | |
770 | + //LAPACKE_dgeev(LAPACK_COL_MAJOR, 'N', 'V', (int)B, co, (int)B, lambda_real, lambda_imag, NULL, (int)B, evec, (int)B); | |
771 | + | |
772 | + // REPLACED THE ABOVE LAPACKE functions with new CLAPACK functions in linalg.cpp | |
773 | + LINALG_dgeev('N', 'V', (int)B, co, (int)B, lambda_real, lambda_imag, NULL, (int)B, evec, (int)B); | |
774 | + | |
775 | + | |
785 | 776 | std::ofstream csv(outfile.c_str(), std::ios::out); //create a text file to store the PCA stats (mean and covariance matrix) |
786 | 777 | |
787 | 778 | csv<<mu[0]; //output the mean spectrum |
... | ... | @@ -789,12 +780,6 @@ int main(int argc, char** argv){ |
789 | 780 | csv<<","<<mu[i]; |
790 | 781 | csv<<std::endl; |
791 | 782 | |
792 | - /*for (unsigned long long j = 0; j < B; j++){ //output the principle components | |
793 | - csv<<eigenvectors.at<double>((int)j, 0); | |
794 | - for (unsigned long long i = 1; i < B; i++) | |
795 | - csv<<","<<eigenvectors.at<double>((int)j, (int)i); | |
796 | - csv << std::endl; | |
797 | - }*/ | |
798 | 783 | for(size_t j = 0; j < B; j++){ |
799 | 784 | csv<<evec[j * B + 0]; //output the first element of the eigenvector |
800 | 785 | for(size_t i = 1; i < B; i++){ |
... | ... | @@ -1060,85 +1045,7 @@ int main(int argc, char** argv){ |
1060 | 1045 | t1.join(); //wait for the progress bar thread to finish (it probably already is) |
1061 | 1046 | C.close(); //close the appended file |
1062 | 1047 | } |
1063 | - /*else if(args["mosaic"].is_set()){ | |
1064 | - if (args["mosaic"].as_string() == "cary"){ | |
1065 | - //use the file extension to determine if the mosaic is an interferogram or spectrum | |
1066 | - stim::filename f(infile); | |
1067 | - if(f.extension() == "drd" || f.extension() == "DRD") | |
1068 | - mosaic_agilent_interferogram(infile, outfile, args["elwn"].as_float(0), args["udr"].as_int(0)); | |
1069 | - | |
1070 | - } | |
1071 | - if(args["mosaic"].as_string(0) == "spero"){ | |
1072 | - mosaic_spero(infile, outfile); | |
1073 | - } | |
1074 | - else { | |
1075 | - std::cout << "ERROR: mosaic construction has been moved to other executables." << std::endl; | |
1076 | - exit(1); | |
1077 | - } | |
1078 | - }*/ | |
1079 | - /*else if(args["fft"].is_set()){ //if the user requests batch FFT processing | |
1080 | - | |
1081 | - double wn_min = args["fft-range"].as_float(0); //get the minimum and maximum bounds for the spectrum | |
1082 | - double wn_max = args["fft-range"].as_float(1); | |
1083 | - double elwn = args["elwn"].as_float(0); //get the Effective Laser Wave Number | |
1084 | - int udr = args["udr"].as_int(0); //get the UDR filter/sampling method | |
1085 | - | |
1086 | - bool ratio = false; //default to calculating a ratio | |
1087 | - void* background = NULL; | |
1088 | - stim::agilent_binary<float> bkg; | |
1089 | - if(args["background"].is_set()){ //if a background is specified | |
1090 | - stim::filename bkg_file(args["background"].as_string(0)); //create a filename for the background file | |
1091 | - if(bkg_file.extension() != "seq"){ | |
1092 | - std::cout<<"ERROR - Agilent SEQ file expected for the background."<<std::endl; | |
1093 | - exit(1); | |
1094 | - } | |
1095 | - std::cout<<"background file: "<<args["background"].as_string(0)<<std::endl; | |
1096 | - bkg.load(args["background"].as_string(0)); //load the background interferogram | |
1097 | - ratio = true; | |
1098 | - } | |
1099 | - if(ENVI){ //if the input file is an ENVI mosaic | |
1100 | - std::thread t1(progress_thread_envi, &ENVI); //start the progress bar thread | |
1101 | - | |
1102 | - if(ratio){ | |
1103 | - background = (void*) malloc(bkg.bytes()); //allocate a pointer for the raw background data | |
1104 | - bkg.bip((float*)background); //copy the background interferogram to a BIP file | |
1105 | - } | |
1106 | - size_t samples = 0; | |
1107 | - if(args["fft"].nargs() == 1) samples = args["fft"].as_int(0); | |
1108 | - ENVI.fft(outfile, wn_min, wn_max, samples, background, bkg.dim(0), bkg.dim(1), true, args["cuda"].as_int()); //if the input is an ENVI file, run the ENVI FFT | |
1109 | - | |
1110 | - t1.join(); //wait for the progress bar thread to finish (it probably already is) | |
1111 | - }*/ | |
1112 | - /*else{ | |
1113 | - stim::filepath fp = infile; | |
1114 | - stim::filename f(fp, "*.drd"); | |
1115 | - std::vector<stim::filename> drd_list = f.get_list(); //generate a list of DRD files | |
1116 | - if(drd_list.size() == 0){ | |
1117 | - std::cerr<<"ERROR: no interferogram (*.drd) files found."<<std::endl; | |
1118 | - exit(1); | |
1119 | - } | |
1120 | - | |
1121 | - double progress = 0; | |
1122 | - std::thread t1(progress_thread_double, &progress); //start the progress bar thread | |
1123 | - for(size_t i = 0; i < drd_list.size(); i++){ | |
1124 | - //std::cout<<drd_list[i].str()<<std::endl; | |
1125 | - stim::agilent_binary<float> interferogram(drd_list[i].str()); //load the interferogram | |
1126 | - interferogram.meancenter(); //mean center the interferogram | |
1127 | - interferogram.zeropad(); //pad to the nearest power-of-two | |
1128 | - stim::agilent_binary<float> fft = interferogram.fft(wn_min, wn_max, elwn, udr); //calculate the FFT and crop out the desired wavenumber range | |
1129 | - if(i == 0){ //if this is the first file | |
1130 | - stim::envi_header header = fft.create_header(); //create a header | |
1131 | - header.save(drd_list[0].extension("hdr")); //save the header | |
1132 | - } | |
1133 | - | |
1134 | - if(ratio) fft.absorbance(&bkg_fft); //if we are calculating a ratio to a background, calculate the absorbance | |
1135 | - fft.save(drd_list[i].extension("dmd")); //save the output file as a DMD | |
1136 | - //std::cout<<progress<<std::endl; | |
1137 | - progress = (double)(i+1) / (double) drd_list.size() * 100; | |
1138 | - } | |
1139 | - t1.join(); //wait for the progress bar thread to finish (it probably already is) | |
1140 | - } | |
1141 | - }*/ | |
1048 | + | |
1142 | 1049 | else if(args["mnf"].is_set()){ |
1143 | 1050 | if (args["mnf"].nargs() == 0){ |
1144 | 1051 | std::cout << "ERROR: no mnf parameters specified" << std::endl; |
... | ... | @@ -1176,4 +1083,4 @@ int main(int argc, char** argv){ |
1176 | 1083 | |
1177 | 1084 | //close the input file |
1178 | 1085 | ENVI.close(); |
1179 | 1086 | -} |
1087 | +} | |
1180 | 1088 | \ No newline at end of file | ... | ... |
src/proc/mnf.cpp
1 | +#include "linalg.h" | |
2 | + | |
1 | 3 | #include <iostream> |
2 | 4 | #include <stim/envi/envi.h> |
3 | 5 | #include "stim/envi/envi_header.h" |
... | ... | @@ -5,20 +7,18 @@ |
5 | 7 | #include <stim/image/image.h> |
6 | 8 | #include <stim/math/matrix.h> |
7 | 9 | #include <time.h> |
8 | -//#include <opencv2/opencv.hpp> | |
9 | 10 | #include <fstream> |
10 | 11 | #include <thread> |
11 | 12 | #include "stim/envi/bil.h" |
12 | -//#include <opencv2/core/core.hpp> | |
13 | 13 | |
14 | 14 | //LAPACKE support for Visual Studio |
15 | -#include <complex> | |
16 | -#ifndef LAPACK_COMPLEX_CUSTOM | |
17 | -#define LAPACK_COMPLEX_CUSTOM | |
18 | -#define lapack_complex_float std::complex<float> | |
19 | -#define lapack_complex_double std::complex<double> | |
20 | -#endif | |
21 | -#include "lapacke.h" | |
15 | +//#include <complex> | |
16 | +//#ifndef LAPACK_COMPLEX_CUSTOM | |
17 | +//#define LAPACK_COMPLEX_CUSTOM | |
18 | +//#define lapack_complex_float std::complex<float> | |
19 | +//#define lapack_complex_double std::complex<double> | |
20 | +//#endif | |
21 | +//#include "lapacke.h" | |
22 | 22 | |
23 | 23 | |
24 | 24 | |
... | ... | @@ -101,8 +101,14 @@ void mnf(std::string outfile, int keptComponents, std::string NoiseFractions, in |
101 | 101 | |
102 | 102 | std::cout << std::endl << "Calculating the inverse covariance matrix S^(-1)..."; |
103 | 103 | int *IPIV = (int*)malloc(sizeof(int) * B); |
104 | - LAPACKE_dgetrf(LAPACK_COL_MAJOR, (int)B, (int)B, cov.data(), (int)B, IPIV); //perform LU factorization | |
105 | - LAPACKE_dgetri(LAPACK_COL_MAJOR, (int)B, cov.data(), (int)B, IPIV); //calculate matrix inverse | |
104 | + | |
105 | + //LAPACKE_dgetrf(LAPACK_COL_MAJOR, (int)B, (int)B, cov.data(), (int)B, IPIV); //perform LU factorization | |
106 | + //LAPACKE_dgetri(LAPACK_COL_MAJOR, (int)B, cov.data(), (int)B, IPIV); //calculate matrix inverse | |
107 | + | |
108 | + // REPLACED THE ABOVE LAPACKE functions with new CLAPACK functions in linalg.cpp | |
109 | + LINALG_dgetrf((int)B, (int)B, cov.data(), (int)B, IPIV); //perform LU factorization | |
110 | + LINALG_dgetri((int)B, cov.data(), (int)B, IPIV); //calculate matrix inverse | |
111 | + | |
106 | 112 | free(IPIV); |
107 | 113 | std::cout << "done." << std::endl; |
108 | 114 | |
... | ... | @@ -118,7 +124,11 @@ void mnf(std::string outfile, int keptComponents, std::string NoiseFractions, in |
118 | 124 | |
119 | 125 | std::cout << std::endl << "Calculating left eigenvectors X * A = v * X..."; |
120 | 126 | stim::matrix<double> ev_left(B, B); |
121 | - LAPACKE_dgeev(LAPACK_COL_MAJOR, 'V', 'N', (int)B, Q.data(), (int)B, EigenvaluesReal, EigenvaluesIm, ev_left.data(), (int)B, 0, (int)B); //perform eigenvalue decomposition | |
127 | + //LAPACKE_dgeev(LAPACK_COL_MAJOR, 'V', 'N', (int)B, Q.data(), (int)B, EigenvaluesReal, EigenvaluesIm, ev_left.data(), (int)B, 0, (int)B); //perform eigenvalue decomposition | |
128 | + | |
129 | + // REPLACED THE ABOVE LAPACKE functions with new CLAPACK functions in linalg.cpp | |
130 | + LINALG_dgeev('V', 'N', (int)B, Q.data(), (int)B, EigenvaluesReal, EigenvaluesIm, ev_left.data(), (int)B, 0, (int)B); //perform eigenvalue decomposition | |
131 | + | |
122 | 132 | std::cout << "done." << std::endl; |
123 | 133 | |
124 | 134 | std::cout << std::endl << "Sorting eigenvectors..."; |
... | ... | @@ -157,8 +167,13 @@ void mnf(std::string outfile, int keptComponents, std::string NoiseFractions, in |
157 | 167 | |
158 | 168 | //calculate inverse of As matrix |
159 | 169 | int *IPIV2 = (int*)malloc(sizeof(int) * B); |
160 | - LAPACKE_dgetrf(LAPACK_COL_MAJOR, (int)B, (int)B, As.data(), (int)B, IPIV2); | |
161 | - LAPACKE_dgetri(LAPACK_COL_MAJOR, (int)B, As.data(), (int)B, IPIV2); | |
170 | + //LAPACKE_dgetrf(LAPACK_COL_MAJOR, (int)B, (int)B, As.data(), (int)B, IPIV2); | |
171 | + //LAPACKE_dgetri(LAPACK_COL_MAJOR, (int)B, As.data(), (int)B, IPIV2); | |
172 | + | |
173 | + // REPLACED THE ABOVE LAPACKE functions with new CLAPACK functions in linalg.cpp | |
174 | + LINALG_dgetrf((int)B, (int)B, As.data(), (int)B, IPIV2); | |
175 | + LINALG_dgetri((int)B, As.data(), (int)B, IPIV2); | |
176 | + | |
162 | 177 | free(IPIV2); |
163 | 178 | |
164 | 179 | //calculate transpose of As inversed matrix (transpose of transformation matrix inveresed ) . |
... | ... | @@ -186,4 +201,4 @@ void mnf(std::string outfile, int keptComponents, std::string NoiseFractions, in |
186 | 201 | csv << "\n" << EigenSortedIndices[b] << ", " << EigenvaluesReal[EigenSortedIndices[b]]; //output the next variable |
187 | 202 | csv.close(); |
188 | 203 | } |
189 | 204 | -} //end MNF |
205 | +} //end MNF | |
190 | 206 | \ No newline at end of file | ... | ... |