| 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 | |
| 19 | #define ooSTRUCT SVD |
| 20 | oo_DEFINE_CLASS (SVD, Daata) |
| 21 | |
| 22 | oo_DOUBLE (tolerance) |
| 23 | oo_INTEGER (numberOfRows) |
| 24 | oo_INTEGER (numberOfColumns) // new invariant: numberOfRows >= numberOfColumns! |
| 25 | oo_FROM (1) |
| 26 | oo_QUESTION (isTransposed) |
| 27 | oo_ENDFROM |
| 28 | #if oo_READING |
| 29 | oo_VERSION_UNTIL (1) |
| 30 | if (our numberOfRows < our numberOfColumns) { |
| 31 | integer tmp = our numberOfRows; |
| 32 | our numberOfRows = our numberOfColumns; |
| 33 | our numberOfColumns = tmp; |
| 34 | our isTransposed = true; |
| 35 | oo_MAT (v, numberOfColumns, numberOfColumns) |
| 36 | oo_MAT (u, numberOfRows, numberOfColumns) |
| 37 | } else { |
| 38 | our isTransposed = false; |
| 39 | oo_MAT (u, numberOfRows, numberOfColumns) |
| 40 | oo_MAT (v, numberOfColumns, numberOfColumns) |
| 41 | } |
| 42 | oo_VERSION_ELSE |
| 43 | oo_MAT (u, numberOfRows, numberOfColumns) |
| 44 | oo_MAT (v, numberOfColumns, numberOfColumns) |
| 45 | oo_VERSION_END |
| 46 | #else |
| 47 | oo_MAT (u, numberOfRows, numberOfColumns) |
| 48 | oo_MAT (v, numberOfColumns, numberOfColumns) |
| 49 | #endif |
| 50 | oo_VEC (d, numberOfColumns) |
| 51 | |
| 52 | #if oo_DECLARING |
| 53 | void v1_info () |
| 54 | override; |
| 55 | #endif |
| 56 | |
| 57 | oo_END_CLASS (SVD) |
| 58 | #undef ooSTRUCT |
| 59 | |
| 60 | |
| 61 | #define ooSTRUCT GSVD |
| 62 | oo_DEFINE_CLASS (GSVD, Daata) |
| 63 | |
| 64 | oo_DOUBLE (tolerance) |
| 65 | oo_INTEGER (numberOfColumns) |
| 66 | oo_MAT ( q, numberOfColumns, numberOfColumns) |
| 67 | oo_MAT ( r, numberOfColumns, numberOfColumns) |
| 68 | oo_VEC (d1, numberOfColumns) |
| 69 | oo_VEC (d2, numberOfColumns) |
| 70 | |
| 71 | #if oo_DECLARING |
| 72 | void v1_info () |
| 73 | override; |
| 74 | #endif |
| 75 | |
| 76 | oo_END_CLASS (GSVD) |
| 77 | #undef ooSTRUCT |
| 78 | |
| 79 | |
| 80 | /* End of file SVD_def.h */ |