POV-Ray : Newsgroups : povray.text.scene-files : [Minimum Volume] Bounding Ellipsoid via SVD : Re: [Minimum Volume] Bounding Ellipsoid via SVD Server Time
18 Apr 2024 14:08:02 EDT (-0400)
  Re: [Minimum Volume] Bounding Ellipsoid via SVD  
From: Bald Eagle
Date: 17 Nov 2019 20:25:00
Message: <web.5dd1f28bf7b9a3af4eec112d0@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.