diff --git a/.cproject b/.cproject
index 7257e427d..9b476b986 100644
--- a/.cproject
+++ b/.cproject
@@ -613,6 +613,14 @@
true
true
+
+ make
+ -j6 -j8
+ testWhiteNoiseFactor.run
+ true
+ true
+ true
+
make
-j5
@@ -621,54 +629,6 @@
true
true
-
- make
- -j5
- testPlanarSLAM.run
- true
- true
- true
-
-
- make
- -j5
- testPose2SLAM.run
- true
- true
- true
-
-
- make
- -j5
- testPose3SLAM.run
- true
- true
- true
-
-
- make
- -j5
- testSimulated2D.run
- true
- true
- true
-
-
- make
- -j5
- testSimulated2DOriented.run
- true
- true
- true
-
-
- make
- -j5
- testVisualSLAM.run
- true
- true
- true
-
make
-j5
@@ -677,14 +637,6 @@
true
true
-
- make
- -j5
- testSerializationSLAM.run
- true
- true
- true
-
make
-j5
@@ -693,6 +645,22 @@
true
true
+
+ make
+ -j6 -j8
+ testAntiFactor.run
+ true
+ true
+ true
+
+
+ make
+ -j6 -j8
+ testBetweenFactor.run
+ true
+ true
+ true
+
make
-j2
@@ -1793,6 +1761,14 @@
true
true
+
+ make
+ -j5
+ testMatrix.run
+ true
+ true
+ true
+
make
-j5
@@ -2468,6 +2444,30 @@
true
true
+
+ make
+ -j6 -j8
+ gtsam_unstable-shared
+ true
+ true
+ true
+
+
+ make
+ -j6 -j8
+ gtsam_unstable-static
+ true
+ true
+ true
+
+
+ make
+ -j6 -j8
+ check.nonlinear_unstable
+ true
+ true
+ true
+
make
-j5
diff --git a/gtsam/base/Matrix.cpp b/gtsam/base/Matrix.cpp
index c4ad41879..187280bbf 100644
--- a/gtsam/base/Matrix.cpp
+++ b/gtsam/base/Matrix.cpp
@@ -523,6 +523,25 @@ Matrix stack(size_t nrMatrices, ...)
return A;
}
+/* ************************************************************************* */
+Matrix stack(const std::vector& blocks) {
+ if (blocks.size() == 1) return blocks.at(0);
+ int nrows = 0, ncols = blocks.at(0).cols();
+ BOOST_FOREACH(const Matrix& mat, blocks) {
+ nrows += mat.rows();
+ if (ncols != mat.cols())
+ throw invalid_argument("Matrix::stack(): column size mismatch!");
+ }
+ Matrix result(nrows, ncols);
+
+ int cur_row = 0;
+ BOOST_FOREACH(const Matrix& mat, blocks) {
+ result.middleRows(cur_row, mat.rows()) = mat;
+ cur_row += mat.rows();
+ }
+ return result;
+}
+
/* ************************************************************************* */
Matrix collect(const std::vector& matrices, size_t m, size_t n)
{
diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h
index 39b980855..0c0b54c5d 100644
--- a/gtsam/base/Matrix.h
+++ b/gtsam/base/Matrix.h
@@ -404,6 +404,7 @@ GTSAM_EXPORT Vector backSubstituteLower(const Matrix& L, const Vector& b, bool u
* @return combined matrix [A1; A2; A3]
*/
GTSAM_EXPORT Matrix stack(size_t nrMatrices, ...);
+GTSAM_EXPORT Matrix stack(const std::vector& blocks);
/**
* create a matrix by concatenating
diff --git a/gtsam/base/tests/testMatrix.cpp b/gtsam/base/tests/testMatrix.cpp
index 196f139a9..c5fae2585 100644
--- a/gtsam/base/tests/testMatrix.cpp
+++ b/gtsam/base/tests/testMatrix.cpp
@@ -149,6 +149,12 @@ TEST( matrix, stack )
C(i + 2, j) = B(i, j);
EQUALITY(C,AB);
+
+ std::vector matrices;
+ matrices.push_back(A);
+ matrices.push_back(B);
+ Matrix AB2 = stack(matrices);
+ EQUALITY(C,AB2);
}
/* ************************************************************************* */