MatrixXf A = MatrixXf::Random(3, 3);
MatrixXf B = A.row(1);
std::vector<float> vec;
我想建立矢量&#34; vec&#34;使用行特征矩阵&#34; B&#34;中的元素。像这样的东西&#34; vec = B.data()&#34;
答案 0 :(得分:2)
除了明显的答案(手动kubectl edit deployment nginx-deployment
或预分配+索引索引分配),您可以使用apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 2 # tells deployment to run 2 pods matching the template
template: # create pods using pod definition in this template
metadata:
# unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is
# generated from the deployment name
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
返回的基指针直接初始化它:
push_back
请注意,Eigen可能会使用内存对齐来利用SSE系列指令,因此它可能无法在更高维度下正常工作。
答案 1 :(得分:0)
只需使用循环:
MatrixXf A = MatrixXf::Random(3, 3);
MatrixXf B = A.row(1);
std::vector<float> vec(B.size());
for(size_t row=0; row < vec.size(); row++) {
vec[row] = B[row];
}