Skip to content
This repository was archived by the owner on May 21, 2022. It is now read-only.

Commit 81b5560

Browse files
committed
Added std::vector to Eigen map convenience function
1 parent 5df5946 commit 81b5560

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

matrix_ops.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ typedef Eigen::Matrix<FP, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> NNMat
2929
typedef Eigen::Matrix<FP, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> NNMatrixRM;
3030
typedef Eigen::Matrix<FP, 1, Eigen::Dynamic, Eigen::RowMajor> NNVector;
3131

32+
typedef Eigen::Map<NNVector> VectorMap;
33+
3234
using Eigen::MatrixBase;
3335

3436
struct MatrixRegion
@@ -164,4 +166,9 @@ void MatrixMultiplyWithSemiSparse(const EigenA &a, const SemiSparseMatrix<EigenB
164166
}
165167
}
166168

169+
inline VectorMap MapStdVector(std::vector<float> &v)
170+
{
171+
return VectorMap(v.data(), 1, static_cast<int64_t>(v.size()));
172+
}
173+
167174
#endif // MATRIX_OPS_H

0 commit comments

Comments
 (0)