SVD_def.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SVD_def.h
  2. *
  3. * Copyright (C) 1994-2018 David Weenink
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #define ooSTRUCT SVD
  19. oo_DEFINE_CLASS (SVD, Daata)
  20. oo_DOUBLE (tolerance)
  21. oo_INTEGER (numberOfRows)
  22. oo_INTEGER (numberOfColumns) // new invariant: numberOfRows >= numberOfColumns!
  23. oo_FROM (1)
  24. oo_QUESTION (isTransposed)
  25. oo_ENDFROM
  26. #if oo_READING
  27. oo_VERSION_UNTIL (1)
  28. if (our numberOfRows < our numberOfColumns) {
  29. integer tmp = our numberOfRows;
  30. our numberOfRows = our numberOfColumns;
  31. our numberOfColumns = tmp;
  32. our isTransposed = true;
  33. oo_MAT (v, numberOfColumns, numberOfColumns)
  34. oo_MAT (u, numberOfRows, numberOfColumns)
  35. } else {
  36. our isTransposed = false;
  37. oo_MAT (u, numberOfRows, numberOfColumns)
  38. oo_MAT (v, numberOfColumns, numberOfColumns)
  39. }
  40. oo_VERSION_ELSE
  41. oo_MAT (u, numberOfRows, numberOfColumns)
  42. oo_MAT (v, numberOfColumns, numberOfColumns)
  43. oo_VERSION_END
  44. #else
  45. oo_MAT (u, numberOfRows, numberOfColumns)
  46. oo_MAT (v, numberOfColumns, numberOfColumns)
  47. #endif
  48. oo_VEC (d, numberOfColumns)
  49. #if oo_DECLARING
  50. void v_info ()
  51. override;
  52. #endif
  53. oo_END_CLASS (SVD)
  54. #undef ooSTRUCT
  55. #define ooSTRUCT GSVD
  56. oo_DEFINE_CLASS (GSVD, Daata)
  57. oo_DOUBLE (tolerance)
  58. oo_INTEGER (numberOfColumns)
  59. oo_MAT ( q, numberOfColumns, numberOfColumns)
  60. oo_MAT ( r, numberOfColumns, numberOfColumns)
  61. oo_VEC (d1, numberOfColumns)
  62. oo_VEC (d2, numberOfColumns)
  63. #if oo_DECLARING
  64. void v_info ()
  65. override;
  66. #endif
  67. oo_END_CLASS (GSVD)
  68. #undef ooSTRUCT
  69. /* End of file SVD_def.h */