svd.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. //// This only works on MAC ...
  9. //#ifdef __APPLE__
  10. //#include "svd.h"
  11. //#include <Accelerate/Accelerate.h>
  12. //#include <cstdlib>
  13. //#include <cstdio>
  14. //
  15. //bool igl::svd3x3(double * a, double * u, double * s, double * vt)
  16. //{
  17. // /* Locals */
  18. // int m = 3, n = 3, lda = 3, ldu = 3, ldvt = 3, info, lwork;
  19. // double wkopt;
  20. // double* work;
  21. // /* Local arrays */
  22. // /* iwork dimension should be at least 8*min(m,n) */
  23. // int iwork[8*3];
  24. // //double s[3], u[3*3], vt[3*3];
  25. // //double a[3*3] = {8,3,4,1,5,9,6,7,2};
  26. // /* Query and allocate the optimal workspace */
  27. // lwork = -1;
  28. // dgesdd_(
  29. // "Singular vectors",
  30. // &m, &n, a, &lda, s, u, &ldu, vt, &ldvt, &wkopt, &lwork, iwork, &info);
  31. // lwork = (int)wkopt;
  32. // work = (double*)malloc( lwork*sizeof(double) );
  33. // /* Compute SVD */
  34. // dgesdd_(
  35. // "Singular vectors",
  36. // &m, &n, a, &lda, s, u, &ldu, vt, &ldvt, work, &lwork, iwork, &info );
  37. // /* Check for convergence */
  38. // if( info > 0 )
  39. // {
  40. // printf("The algorithm computing SVD failed to converge.\n" );
  41. // return false;
  42. // }
  43. // /* Free workspace */
  44. // free( (void*)work );
  45. // return true;
  46. //}
  47. //#endif