I'm trying to use the pcabuildbasis function to find the basis vectors of a group of 3D points. But the returned matrix of eigenvectors contains -1.#INF00 values for the last 2 principle components. Here's the values for the S2 and V arrays.
S2[0] = 15784.371094 S2[1] = 2748.227783 S3[2] = 0.000000
V[0] = 0.985108 V[1] = 0.171937 V[2] = 0.000000 V[3] = -1.#INF000 V[4] = -0.17937 V[5] = 0.985108 V[6] = 0.000000 V[7] = -1.#INF000 V[8] = 0.000000
Any ideas on why this would happen? I'm sure I'm filling the data structures correctly. My code for doing so is below.
int numComponents = 3; double* data = new double[points.size() * numComponents]; for (int i = 0; i < points.size(); i++) { data[i*numComponents+0] = points[i].x; data[i*numComponents+1] = points[i].y; data[i*numComponents+2] = points[i].z; }
alglib::real_2d_array arr; arr.setcontent(points.size(), numComponents, data); alglib::ae_int_t info; alglib::real_1d_array s2; alglib::real_2d_array v; pcabuildbasis(arr, points.size(), numComponents, info, s2, v);
|