nareshmlx/opencv-pr huggingface dataset:
**File:** modules/core/src/dxt.cpp
**Change Type:** modified
**Context:** PR #2634: IPP: cv::dct - **merge with Itseez/opencv_extra#174** check_regression=_dct_ test_modules=core build_examples=OFF

**Code Changes:**
```diff
@@ -2880,6 +2880,131 @@ static void IDCT_64f(const double* src, int src_step, double* dft_src, double* d
 
 }
 
+namespace cv
+{
+#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
+
+typedef IppStatus (CV_STDCALL * ippiDCTFunc)(const Ipp32f*, int, Ipp32f*, int, const void*, Ipp8u*);
+typedef IppStatus (CV_STDCALL * ippiDCTInitAlloc)(void**, IppiSize, IppHintAlgorithm);
```

Review comment:
it's better to use constructions such as <pre> status = some_error; if (ippInitAlloc(&pDCTSpec, ..) &gt;= 0 && ippGetBufSize(...) &gt;= 0) { buf.allocate(...); status = ippFunc(...); } if(pDCTSpec) ippFree(pDCTSpec); return status &gt;= 0; </pre> to avoid duplicated and error-prone code if(status &lt; 0) { free something and return false }
**File:** modules/core/src/dxt.cpp
**Change Type:** modified
**Context:** PR #2634: IPP: cv::dct - **merge with Itseez/opencv_extra#174** check_regression=_dct_ test_modules=core build_examples=OFF

**Code Changes:**
```diff
@@ -2880,6 +2880,131 @@ static void IDCT_64f(const double* src, int src_step, double* dft_src, double* d
 
 }
 
+namespace cv
+{
+#if defined HAVE_IPP && IPP_VERSION_MAJOR >= 7 && !defined HAVE_IPP_ICV_ONLY
+
+typedef IppStatus (CV_STDCALL * ippiDCTFunc)(const Ipp32f*, int, Ipp32f*, int, const void*, Ipp8u*);
+typedef IppStatus (CV_STDCALL * ippiDCTInitAlloc)(void**, IppiSize, IppHintAlgorithm);
```

Review comment:
I normally recommend to use pointers instead of references in such cases, and then you may skip the ugly trick with hidden "operator =" below.
**File:** modules/core/perf/perf_dft.cpp
**Change Type:** modified
**Context:** PR #2634: IPP: cv::dct - **merge with Itseez/opencv_extra#174** check_regression=_dct_ test_modules=core build_examples=OFF
**Review Line:** 60

**Code Changes:**
```diff
+    declare
+        .in(src, WARMUP_RNG)
+        .out(dst)
+        .time(60);
+
+    TEST_CYCLE() dct(src, dst, flags);
+
     SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
 }
\ No newline at end of file
```

Review comment:
general question. A few years ago I tried IPP DCT and at that time doing DCT via IPP DFT was more efficient than using IPP DCT. Did you measure the performance? Does it make sense to use IPP DCT?
**File:** modules/core/perf/perf_dft.cpp
**Change Type:** modified
**Context:** PR #2634: IPP: cv::dct - **merge with Itseez/opencv_extra#174** check_regression=_dct_ test_modules=core build_examples=OFF
**Review Line:** 60

**Code Changes:**
```diff
+    declare
+        .in(src, WARMUP_RNG)
+        .out(dst)
+        .time(60);
+
+    TEST_CYCLE() dct(src, dst, flags);
+
     SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE);
 }
\ No newline at end of file
```

Review comment:
Yes I measured the performance. ippiDCT have acceleration up to 3.12 in not-parallel and 9.20 in parallel case compared with OpenCV on our buildbot. And about 1.2 compared with IPP DFT.
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #2321: opencv_run_all_tests.sh implemented for Android SDK.

**Code Changes:**
```diff
@@ -580,16 +580,24 @@ include(cmake/OpenCVGenConfig.cmake)
 include(cmake/OpenCVGenInfoPlist.cmake)
 
 # Generate environment setup file
-if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX AND NOT ANDROID)
-  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
-                 "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY)
-  install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh"
-          DESTINATION /etc/profile.d/ COMPONENT tests)
-  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests.sh.in"
```

Review comment:
I'd use `install(PROGRAMS)` here, which uses correct permissions by default. Also, this command looks identical in both branches, so it should be outside the inner `if`.
**File:** cmake/templates/opencv_run_all_tests_android.sh.in
**Change Type:** added
**Context:** PR #2321: opencv_run_all_tests.sh implemented for Android SDK.

**Code Changes:**
```diff
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+BASE_DIR=`dirname $0`
+OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
+OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
+
+if [ $# -ne 1 ]; then
+  echo "Device architecture is not preset in command line"
+  echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
```

Review comment:
`TEST_PATH` is absolute, isn't it? That means that this script breaks if the SDK is moved from its original location. You should probably use the script's own location to find other things.
**File:** cmake/templates/opencv_run_all_tests_android.sh.in
**Change Type:** added
**Context:** PR #2321: opencv_run_all_tests.sh implemented for Android SDK.

**Code Changes:**
```diff
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+BASE_DIR=`dirname $0`
+OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
+OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
+
+if [ $# -ne 1 ]; then
+  echo "Device architecture is not preset in command line"
+  echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
```

Review comment:
OK, but then... how does it even work? You'd have to call it from the SDK root.
**File:** cmake/templates/opencv_run_all_tests_android.sh.in
**Change Type:** added
**Context:** PR #2321: opencv_run_all_tests.sh implemented for Android SDK.

**Code Changes:**
```diff
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+BASE_DIR=`dirname $0`
+OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
+OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
+
+if [ $# -ne 1 ]; then
+  echo "Device architecture is not preset in command line"
+  echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
```

Review comment:
The second pattern begins differently. Is that intentional?
**File:** cmake/templates/opencv_run_all_tests_android.sh.in
**Change Type:** added
**Context:** PR #2321: opencv_run_all_tests.sh implemented for Android SDK.

**Code Changes:**
```diff
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+BASE_DIR=`dirname $0`
+OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
+OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
+
+if [ $# -ne 1 ]; then
+  echo "Device architecture is not preset in command line"
+  echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
```

Review comment:
Yes, SDK is not installed to any fixed place on file system. In common case it is placed in users home. So, the only way is to run it from there.
**File:** cmake/templates/opencv_run_all_tests_android.sh.in
**Change Type:** added
**Context:** PR #2321: opencv_run_all_tests.sh implemented for Android SDK.

**Code Changes:**
```diff
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+BASE_DIR=`dirname $0`
+OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
+OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
+
+if [ $# -ne 1 ]; then
+  echo "Device architecture is not preset in command line"
+  echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
```

Review comment:
Then why not make it so that it can be ran from anywhere? Seems needlessly restrictive.
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...

**Code Changes:**
```diff
@@ -201,6 +201,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi
 
 # OpenCV build options
 # ===================================================
+OCV_OPTION(ENABLE_DYNAMIC_CUDA        "Enabled dynamic CUDA linkage"                             ON   IF ANDROID )
 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers"                                  ON   IF (NOT IOS) )
 OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
 OCV_OPTION(ENABLE_PROFILING           "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF  IF CMAKE_COMPILER_IS_GNUCXX )
@@ -461,7 +462,11 @@ endif()
 # ----------------------------------------------------------------------------
```

Review comment:
As I remember, CMake doesn't have built-in `LINUX` variable. Can it be change to `UNIX`?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...

**Code Changes:**
```diff
@@ -201,6 +201,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi
 
 # OpenCV build options
 # ===================================================
+OCV_OPTION(ENABLE_DYNAMIC_CUDA        "Enabled dynamic CUDA linkage"                             ON   IF ANDROID )
 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers"                                  ON   IF (NOT IOS) )
 OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
 OCV_OPTION(ENABLE_PROFILING           "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF  IF CMAKE_COMPILER_IS_GNUCXX )
@@ -461,7 +462,11 @@ endif()
 # ----------------------------------------------------------------------------
```

Review comment:
Or this dynamic linking must work only on Android?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...

**Code Changes:**
```diff
@@ -201,6 +201,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi
 
 # OpenCV build options
 # ===================================================
+OCV_OPTION(ENABLE_DYNAMIC_CUDA        "Enabled dynamic CUDA linkage"                             ON   IF ANDROID )
 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers"                                  ON   IF (NOT IOS) )
 OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
 OCV_OPTION(ENABLE_PROFILING           "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF  IF CMAKE_COMPILER_IS_GNUCXX )
@@ -461,7 +462,11 @@ endif()
 # ----------------------------------------------------------------------------
```

Review comment:
Yeah, why is this even enabled on Linux? BTW, the CMake way to test for Linux is CMAKE_SYSTEM_NAME STREQUAL Linux.
**File:** modules/dynamicuda/CMakeLists.txt
**Change Type:** added
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...

**Code Changes:**
```diff
@@ -0,0 +1,15 @@
+if(NOT DYNAMIC_CUDA_SUPPORT)
+  ocv_module_disable(dynamicuda)
+endif()
+
+set(the_description "Dynamic CUDA linkage")
+
+add_definitions(-DUSE_CUDA)
+ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef)
+ocv_module_include_directories("${OpenCV_SOURCE_DIR}/modules/gpu/include")
```

Review comment:
Is `q` symbol in `q${CUDA_LIBRARIES}` a misprint?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...

**Code Changes:**
```diff
@@ -201,6 +201,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi
 
 # OpenCV build options
 # ===================================================
+OCV_OPTION(ENABLE_DYNAMIC_CUDA        "Enabled dynamic CUDA linkage"                             ON   IF ANDROID )
 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers"                                  ON   IF (NOT IOS) )
 OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
 OCV_OPTION(ENABLE_PROFILING           "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF  IF CMAKE_COMPILER_IS_GNUCXX )
@@ -461,7 +462,11 @@ endif()
 # ----------------------------------------------------------------------------
```

Review comment:
On Linux we have another issue. CUDA is also used in OpenGL wrappers (if both `WITH_CUDA` and `WITH_OPENGL` were enabled). Probably the easiest way will be to disable dynamic CUDA linkage on Linux now and possibly return to this task in 3.0.
**File:** modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp
**Change Type:** added
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...

**Code Changes:**
```diff
@@ -0,0 +1,1112 @@
+#ifndef __GPUMAT_CUDA_HPP__
+#define __GPUMAT_CUDA_HPP__
+
+#ifndef HAVE_CUDA
+typedef void* cudaStream_t;
+#endif
+
+class DeviceInfoFuncTable
+{
```

Review comment:
This must be public inheritance: ``` class CudaDeviceInfoFuncTable : public DeviceInfoFuncTable ```
**File:** modules/core/CMakeLists.txt
**Change Type:** modified
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...
**Review Line:** 32

**Code Changes:**
```diff
@@ -14,11 +28,26 @@ endif()
 file(GLOB lib_cuda_hdrs        "include/opencv2/${name}/cuda/*.hpp"        "include/opencv2/${name}/cuda/*.h")
 file(GLOB lib_cuda_hdrs_detail "include/opencv2/${name}/cuda/detail/*.hpp" "include/opencv2/${name}/cuda/detail/*.h")
 
+if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
+  file(GLOB lib_cuda           "../dynamicuda/src/cuda/*.cu*")
+  ocv_include_directories(${CUDA_INCLUDE_DIRS})
+  ocv_cuda_compile(cuda_objs ${lib_cuda})
+endif()
+
 source_group("Cuda Headers"         FILES ${lib_cuda_hdrs})
```

Review comment:
This won't add build rule for `matrix_operations.cu` file. `ocv_create_module` compiles CUDA files only for .cu files from module folder. This can be fixed by adding explicit compilation command: ``` if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA) file(GLOB lib_cuda "../dynamicuda/src/cuda/*.cu*") ocv_include_directories(${CUDA_INCLUDE_DIRS}) ocv_cuda_compile(cuda_objs ${lib_cuda}) endif() ... else() ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc" ${lib_cuda} ${cuda_objs} HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail}) endif() ```
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #2022: Dynamic CUDA linkage for Android - Pull request separates opencv_core module on two parts. The first part is old core module without CUDA re...
**Review Line:** 464

**Code Changes:**
```diff
 OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
 OCV_OPTION(ENABLE_PROFILING           "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF  IF CMAKE_COMPILER_IS_GNUCXX )
@@ -461,7 +462,11 @@ endif()
 # ----------------------------------------------------------------------------
 # Add CUDA libraries (needed for apps/tools, samples)
 # ----------------------------------------------------------------------------
-if(HAVE_CUDA)
+if(NOT HAVE_CUDA)
+  set(ENABLE_DYNAMIC_CUDA OFF)
+endif()
+
```

Review comment:
Why did you remove this lines? It fixes build issues on desktop. Could you just disable it only for dynamic linkage? ``` if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA) ```
**File:** modules/core/include/opencv2/core/types.hpp
**Change Type:** modified
**Context:** PR #1373: Python bindings for KeyPoint methods - 1. Added Python bindings for Keypoints method like `convert()`, `overlap()` etc **Usage:** ``` import...

**Code Changes:**
```diff
@@ -551,18 +551,18 @@ class CV_EXPORTS_W_SIMPLE KeyPoint
     size_t hash() const;
 
     //! converts vector of keypoints to vector of points
-    static void convert(const std::vector<KeyPoint>& keypoints,
-                        CV_OUT std::vector<Point2f>& points2f,
-                        const std::vector<int>& keypointIndexes=std::vector<int>());
+    CV_WRAP static void convert(const std::vector<KeyPoint>& keypoints,
+                                CV_OUT std::vector<Point2f>& points2f,
+                                const std::vector<int>& keypointIndexes=std::vector<int>());
```

Review comment:
Could you realign the parameter lists?
**File:** modules/optim/include/opencv2/optim.hpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...

**Code Changes:**
```diff
@@ -0,0 +1,62 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
mat.hpp is big header with inline implementations of Mat ops. It should not be included in the external headers since it's not required there.
**File:** modules/optim/include/opencv2/optim.hpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...

**Code Changes:**
```diff
@@ -0,0 +1,62 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
iostream is not required in this header. Move it to the internal header (such as precomp.hpp)
**File:** modules/optim/src/lpsolver.cpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...
**Review Line:** 9

**Code Changes:**
```diff
+#include <cstdarg>
+
+namespace cv{namespace optim{
+using std::vector;
+
+#ifdef ALEX_DEBUG
+#define dprintf(x) printf x
+static void print_matrix(const Mat& x){
+    print(x);
+    printf("\n");
+}
```

Review comment:
the helper printing functions should be made real functions, not macros. It's more safe and they are not required to be super-fast
**File:** modules/optim/src/lpsolver.cpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...

**Code Changes:**
```diff
@@ -0,0 +1,322 @@
+#include "precomp.hpp"
+#include <climits>
+#include <algorithm>
+#include <cstdarg>
+
+namespace cv{namespace optim{
+using std::vector;
+
+#ifdef ALEX_DEBUG
```

Review comment:
The function should allow 32f input as well; The input matrices are copied anyway. Just call src.convertTo(dst, CV_64F) instead of src.copyTo(dst). More generally, you can just check that the number of channels is 1. That is, user can even pass matrices of type CV_32S etc.
**File:** modules/optim/src/lpsolver.cpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...

**Code Changes:**
```diff
@@ -0,0 +1,322 @@
+#include "precomp.hpp"
+#include <climits>
+#include <algorithm>
+#include <cstdarg>
+
+namespace cv{namespace optim{
+using std::vector;
+
+#ifdef ALEX_DEBUG
```

Review comment:
The function should allow single-column Func in addition to single-row Func. That is, the assert should be changed to CV_Assert(Func.rows == 1 || Func.cols == 1); You can transpose Func in the latter case.
**File:** modules/optim/src/lpsolver.cpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...

**Code Changes:**
```diff
@@ -0,0 +1,322 @@
+#include "precomp.hpp"
+#include <climits>
+#include <algorithm>
+#include <cstdarg>
+
+namespace cv{namespace optim{
+using std::vector;
+
+#ifdef ALEX_DEBUG
```

Review comment:
why z has 2 rows? Shouldn't it have one? Also, we normally use single-column matrices for 1D case, not single-row, e.g. ideally z should have (c.cols x 1) size.
**File:** modules/optim/src/precomp.hpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...
**Review Line:** 46

**Code Changes:**
```diff
+//M*/
+
+#ifndef __OPENCV_PRECOMP_H__
+#define __OPENCV_PRECOMP_H__
+
+#include "opencv2/optim.hpp"
+
+#endif
```

Review comment:
iostream, mat.hpp etc should be put here instead of the external header
**File:** modules/optim/test/test_lpsolver.cpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...

**Code Changes:**
```diff
@@ -0,0 +1,101 @@
+#include "test_precomp.hpp"
+#include <iostream>
+
+TEST(Optim_LpSolver, regression_basic){
+    cv::Mat A,B,z,etalon_z;
+
+#if 1
+    //cormen's example #1
+    A=(cv::Mat_<double>(3,1)<<3,1,2);
```

Review comment:
this is the main header of the tested module and it's already included in test_precomp.hpp. There is no need to put it here.
**File:** modules/optim/src/lpsolver.cpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...
**Review Line:** 76

**Code Changes:**
```diff
+        Mat FuncT=Func.t();
+        FuncT.convertTo(bigC.colRange(1,bigC.cols),CV_64FC1);
+    }
+    Constr.convertTo(bigB.colRange(1,bigB.cols),CV_64FC1);
+    double v=0;
+    vector<int> N,B;
+    vector<unsigned int> indexToRow;
+
+    if(initialize_simplex(bigC,bigB,v,N,B,indexToRow)==SOLVELP_UNFEASIBLE){
+        return SOLVELP_UNFEASIBLE;
+    }
```

Review comment:
basic solution is stored as vector of int's (vector of var indices) and therefore you always need to run find() algorithm to check if certain var belongs to the basic solution or not. May be, it makes sense to have byte mask vector instead? <pre> vector&lt;uchar&gt; basic_solution_mask(var_num); ... if (basic_solution_mask[i]) { ... } else {...} </pre> If you decide to make this modification, please, do not use vector&lt;bool&gt; - it's slow custom implementation of a vector and it's not recommended to use.
**File:** modules/optim/include/opencv2/optim.hpp
**Change Type:** added
**Context:** PR #1108: Optim lp - I'm working on generic numerical optimization module for openCV within the Google Summer of Code 2013 initiative (mentor: Vadim P...

**Code Changes:**
```diff
@@ -0,0 +1,62 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
you use references to cv::Mat, not cv::Mat itself. Just try to move this include to precomp.hpp and build it