本文整理汇总了C++中eigen::MatrixXf::transposeInPlace方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXf::transposeInPlace方法的具体用法?C++ MatrixXf::transposeInPlace怎么用?C++ MatrixXf::transposeInPlace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXf
的用法示例。
在下文中一共展示了MatrixXf::transposeInPlace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: basis_splines_endreps_local_v2
/**
* Create the augmented knots vector and fill in matrix Xt with the spline basis vectors
*/
void basis_splines_endreps_local_v2(float *knots, int n_knots, int order, int *boundaries, int n_boundaries, Eigen::MatrixXf &Xt) {
assert(n_boundaries == 2 && boundaries[0] < boundaries[1]);
int n_rows = boundaries[1] - boundaries[0]; // this is frames so evaluate at each frame we'll need
int n_cols = n_knots + order; // number of basis vectors we'll have at end
Xt.resize(n_cols, n_rows); // swapped to transpose later. This order lets us use it as a scratch space
Xt.fill(0);
int n_std_knots = n_knots + 2 * order;
float std_knots[n_std_knots];
// Repeat the boundary knots on there to ensure linear out side of knots
for (int i = 0; i < order; i++) {
std_knots[i] = boundaries[0];
}
// Our original boundary knots here
for (int i = 0; i < n_knots; i++) {
std_knots[i+order] = knots[i];
}
// Repeat the boundary knots on there to ensure linear out side of knots
for (int i = 0; i < order; i++) {
std_knots[i+order+n_knots] = boundaries[1];
}
// Evaluate our basis splines at each frame.
for (int i = boundaries[0]; i < boundaries[1]; i++) {
int idx = -1;
// find index such that i >= knots[idx] && i < knots[idx+1]
float *val = std::upper_bound(std_knots, std_knots + n_std_knots - 1, 1.0f * i);
idx = val - std_knots - 1;
assert(idx >= 0);
float *f = Xt.data() + i * n_cols + idx - (order - 1); //column offset
basis_spline_xi_v2(std_knots, n_std_knots, order, idx, i, f);
}
// Put in our conventional format where each column is a basis vector
Xt.transposeInPlace();
}
示例2: in
void
readLDRFile(const std::string& file, Eigen::MatrixXf& data)
{
std::ifstream in(file.c_str(), std::ios::in | std::ios::binary);
in.seekg(0, std::ios::end);
int size = in.tellg();
in.seekg(0, std::ios::beg);
int num_floats = size / (sizeof(float) / sizeof (char));
int num_rows = num_floats / 6;
data.resize(6, num_rows);
float* row_arr = new float[num_floats];
in.read((char*)(row_arr), size);
float* data_arr = data.data();
for (int k = 0; k < num_floats; k++)
data_arr[k] = row_arr[k];
data.transposeInPlace();
in.close();
}