|
|
So, since I don't code in c++, I'm kinda coding by imitation and trial and
error.
I get the current small bit of test code to compile, but when I run it with my
dataset: "400" followed by 1200 numbers "value\n"
#write (Output, NumPoints, "\n")
#write (Output, P[PonS].x, "\n")
#write (Output, P[PonS].y, "\n")
#write (Output, P[PonS].z, "\n")
I get a segmentation fault.
template<typename Arg = cpp_bin_float_4096>
void generate_matrix(std::vector<std::vector<cpp_bin_float_4096> >& \
matrix, std::size_t rows, std::size_t cols)
{
std::cin >> rows;
std::srand((unsigned int)std::time(nullptr)); matrix.resize(rows);
for (std::size_t row = 0; row < matrix.size(); row++)
{
matrix[row].resize(3);
for (std::size_t col = 0; col < 3; col++)
//std::cin >> ignore(100, '\n') >> matrix[rows][cols];
std::cin >> matrix[rows][cols];
}
std::cout << "Data imported. \n\n";
}
int main(int argc, char* argv[])
{
std::size_t matrix_size = 0;
std::vector<std::vector<cpp_bin_float_4096> > u, v;
std::vector<std::vector<cpp_bin_float_4096> > matrix, s;
std::cout << "Importing data into matrix . . . \n\n";
generate_matrix(matrix, matrix_size, matrix_size);
std::cout << "\nA = \n"; print_matrix(matrix);
//svd(matrix, s, u, v);
//std::cout << "\nS = \n"; print_matrix(s);
//std::cout << "\nU = \n"; print_matrix(u);
//std::cout << "\nV = \n"; print_matrix(v);
std::cin.get();
//std::cin.get();
return 0;
}
Post a reply to this message
|
|