| 1 | #cxx . . $ `<file>/melder/MAT.h`/pragma once |
| 2 | /* MAT.h |
| 3 | * |
| 4 | * Copyright (C) 2017-2021,2024 Paul Boersma |
| 5 | * |
| 6 | * This code is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or (at |
| 9 | * your option) any later version. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 14 | * See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:20:9`!(operator, op) \ |
| 21 | inline void operator (MATVU const& target, double number) noexcept { \ |
| 22 | integer mindim = ( target.rowStride < target.colStride ? 1 : 2 ); \ |
| 23 | if (mindim == 1) \ |
| 24 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 25 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 26 | target [irow] [icol] op number; \ |
| 27 | else \ |
| 28 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 29 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 30 | target [irow] [icol] op number; \ |
| 31 | } |
| 32 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 33 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:20:9`! |
| 34 | |
| 35 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:35:9`!(operator, op) \ |
| 36 | inline void operator (MATVU const& target, constMATVU const& x) { \ |
| 37 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.nrow == x.nrow); \ |
| 38 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == x.ncol); \ |
| 39 | integer mindim = ( target.rowStride < target.colStride ? 1 : 2 ); \ |
| 40 | if (mindim == 1) \ |
| 41 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 42 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 43 | target [irow] [icol] op x [irow] [icol]; \ |
| 44 | else \ |
| 45 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 46 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 47 | target [irow] [icol] op x [irow] [icol]; \ |
| 48 | } |
| 49 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 50 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:35:9`! |
| 51 | |
| 52 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:52:9`!(operator, op) \ |
| 53 | inline void operator (MATVU const& target, constVECVU const& x) { \ |
| 54 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == x.size); \ |
| 55 | integer mindim = ( target.rowStride < target.colStride ? 1 : 2 ); \ |
| 56 | if (mindim == 1) \ |
| 57 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 58 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 59 | target [irow] [icol] op x [icol]; \ |
| 60 | else \ |
| 61 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 62 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 63 | target [irow] [icol] op x [icol]; \ |
| 64 | } |
| 65 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 66 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:52:9`! |
| 67 | |
| 68 | struct TypeMATadd_MAT_NUMcxx . . $ TypeMATadd_MAT_NUM# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATadd_MAT_NUM#x.; double numbercxx . . $ TypeMATadd_MAT_NUM#number.; }; |
| 69 | inline TypeMATadd_MAT_NUMcxx . . $ TypeMATadd_MAT_NUM# operatorcxx . . $ operator+(a1743dea189d4e35).+ (constMATVUcxx . . $ constMATVU# const& x, double number) { return { x, number }; } |
| 70 | inline TypeMATadd_MAT_NUMcxx . . $ TypeMATadd_MAT_NUM# operatorcxx . . $ operator+(f51ce004bf8b037).+ (double number, constMATVUcxx . . $ constMATVU# const& x) { return { x, number }; } |
| 71 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:71:9`!(operator, op) \ |
| 72 | inline void operator (MATVU const& target, TypeMATadd_MAT_NUM const& expr) { \ |
| 73 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 74 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 75 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 76 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 77 | target [irow] [icol] op expr.x [irow] [icol] + expr.number; \ |
| 78 | } |
| 79 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 80 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:71:9`! |
| 81 | inline autoMATcxx . . $ autoMAT# add_MATcxx . . $ add_MAT(d05068067bdbbf5a). (constMATVUcxx . . $ constMATVU# const& x, double number) { |
| 82 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 83 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(6b172435901c393e). x +cxx . . $ operator+(a1743dea189d4e35). number; |
| 84 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 85 | } |
| 86 | |
| 87 | struct TypeMATmultiply_MAT_NUMcxx . . $ TypeMATmultiply_MAT_NUM# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATmultiply_MAT_NUM#x.; double numbercxx . . $ TypeMATmultiply_MAT_NUM#number.; }; |
| 88 | inline TypeMATmultiply_MAT_NUMcxx . . $ TypeMATmultiply_MAT_NUM# operatorcxx . . $ `operator*`(3dd25102fdc24343).* (constMATVUcxx . . $ constMATVU# const& x, double number) { return { x, number }; } |
| 89 | inline TypeMATmultiply_MAT_NUMcxx . . $ TypeMATmultiply_MAT_NUM# operatorcxx . . $ `operator*`(63c818071e7f3db9).* (double number, constMATVUcxx . . $ constMATVU# const& x) { return { x, number }; } |
| 90 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:90:9`!(operator, op) \ |
| 91 | inline void operator (MATVU const& target, TypeMATmultiply_MAT_NUM const& expr) { \ |
| 92 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 93 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 94 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 95 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 96 | target [irow] [icol] op expr.x [irow] [icol] * expr.number; \ |
| 97 | } |
| 98 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 99 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:90:9`! |
| 100 | inline autoMATcxx . . $ autoMAT# multiply_MATcxx . . $ multiply_MAT(d05068067bdbbf5a). (constMATVUcxx . . $ constMATVU# const& x, double number) { |
| 101 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 102 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(b78e8a4998bd3572). x *cxx . . $ `operator*`(3dd25102fdc24343). number; |
| 103 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 104 | } |
| 105 | |
| 106 | struct TypeMATsubtract_MAT_NUMcxx . . $ TypeMATsubtract_MAT_NUM# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATsubtract_MAT_NUM#x.; double numbercxx . . $ TypeMATsubtract_MAT_NUM#number.; }; |
| 107 | inline TypeMATsubtract_MAT_NUMcxx . . $ TypeMATsubtract_MAT_NUM# operatorcxx . . $ operator-(2729b31e7ac305e).- (constMATVUcxx . . $ constMATVU# const& x, double number) { return { x, number }; } |
| 108 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:108:9`!(operator, op) \ |
| 109 | inline void operator (MATVU const& target, TypeMATsubtract_MAT_NUM const& expr) { \ |
| 110 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 111 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 112 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 113 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 114 | target [irow] [icol] op expr.x [irow] [icol] - expr.number; \ |
| 115 | } |
| 116 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 117 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:108:9`! |
| 118 | inline autoMATcxx . . $ autoMAT# subtract_MATcxx . . $ subtract_MAT(d05068067bdbbf5a). (constMATVUcxx . . $ constMATVU# const& x, double number) { |
| 119 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 120 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(fe066fa036ac1bbc). x -cxx . . $ operator-(2729b31e7ac305e). number; |
| 121 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 122 | } |
| 123 | |
| 124 | struct TypeMATsubtract_NUM_MATcxx . . $ TypeMATsubtract_NUM_MAT# { double numbercxx . . $ TypeMATsubtract_NUM_MAT#number.; constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATsubtract_NUM_MAT#x.; }; |
| 125 | inline TypeMATsubtract_NUM_MATcxx . . $ TypeMATsubtract_NUM_MAT# operatorcxx . . $ operator-(2e231a40e376599d).- (double number, constMATVUcxx . . $ constMATVU# const& x) { return { number, x }; } |
| 126 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:126:9`!(operator, op) \ |
| 127 | inline void operator (MATVU const& target, TypeMATsubtract_NUM_MAT const& expr) { \ |
| 128 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 129 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 130 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 131 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 132 | target [irow] [icol] op expr.number - expr.x [irow] [icol]; \ |
| 133 | } |
| 134 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 135 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:126:9`! |
| 136 | inline autoMATcxx . . $ autoMAT# subtract_MATcxx . . $ subtract_MAT(1da3dfb72ceffafb). (double number, constMATVUcxx . . $ constMATVU# const& x) { |
| 137 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 138 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(76726a1d257abf4d). number -cxx . . $ operator-(2e231a40e376599d). x; |
| 139 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 140 | } |
| 141 | |
| 142 | struct TypeMATadd_MAT_VECcxx . . $ TypeMATadd_MAT_VEC# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATadd_MAT_VEC#x.; constVECVUcxx . . $ constVECVU# const& ycxx . . $ TypeMATadd_MAT_VEC#y.; }; |
| 143 | inline TypeMATadd_MAT_VECcxx . . $ TypeMATadd_MAT_VEC# operatorcxx . . $ operator+(2e1c2b368b3573c0).+ (constMATVUcxx . . $ constMATVU# const& x, constVECVUcxx . . $ constVECVU# const& y) { return { x, y }; } |
| 144 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:144:9`!(operator, op) \ |
| 145 | inline void operator (MATVU const& target, TypeMATadd_MAT_VEC const& expr) { \ |
| 146 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 147 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 148 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == expr.y.size); \ |
| 149 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 150 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 151 | target [irow] [icol] op expr.x [irow] [icol] + expr.y [icol]; \ |
| 152 | } |
| 153 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 154 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:144:9`! |
| 155 | inline autoMATcxx . . $ autoMAT# add_MATcxx . . $ add_MAT(58a61c4ec227c4d). (constMATVUcxx . . $ constMATVU# const& x, constVECVUcxx . . $ constVECVU# const& y) { |
| 156 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 157 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(f06f0c2ee3e650b7). x +cxx . . $ operator+(2e1c2b368b3573c0). y; |
| 158 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 159 | } |
| 160 | |
| 161 | struct TypeMATmultiply_MAT_VECcxx . . $ TypeMATmultiply_MAT_VEC# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATmultiply_MAT_VEC#x.; constVECVUcxx . . $ constVECVU# const& ycxx . . $ TypeMATmultiply_MAT_VEC#y.; }; |
| 162 | inline TypeMATmultiply_MAT_VECcxx . . $ TypeMATmultiply_MAT_VEC# operatorcxx . . $ `operator*`(17c58c40303602b5).* (constMATVUcxx . . $ constMATVU# const& x, constVECVUcxx . . $ constVECVU# const& y) { return { x, y }; } |
| 163 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:163:9`!(operator, op) \ |
| 164 | inline void operator (MATVU const& target, TypeMATmultiply_MAT_VEC const& expr) { \ |
| 165 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 166 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 167 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == expr.y.size); \ |
| 168 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 169 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 170 | target [irow] [icol] op expr.x [irow] [icol] * expr.y [icol]; \ |
| 171 | } |
| 172 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 173 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:163:9`! |
| 174 | inline autoMATcxx . . $ autoMAT# multiply_MATcxx . . $ multiply_MAT(58a61c4ec227c4d). (constMATVUcxx . . $ constMATVU# const& x, constVECVUcxx . . $ constVECVU# const& y) { |
| 175 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 176 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(57fd11fd46642c5d). x *cxx . . $ `operator*`(17c58c40303602b5). y; |
| 177 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 178 | } |
| 179 | |
| 180 | struct TypeMATsubtract_MAT_VECcxx . . $ TypeMATsubtract_MAT_VEC# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATsubtract_MAT_VEC#x.; constVECVUcxx . . $ constVECVU# const& ycxx . . $ TypeMATsubtract_MAT_VEC#y.; }; |
| 181 | inline TypeMATsubtract_MAT_VECcxx . . $ TypeMATsubtract_MAT_VEC# operatorcxx . . $ operator-(b5eb0b4cd90d249a).- (constMATVUcxx . . $ constMATVU# const& x, constVECVUcxx . . $ constVECVU# const& y) { return { x, y }; } |
| 182 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:182:9`!(operator, op) \ |
| 183 | inline void operator (MATVU const& target, TypeMATsubtract_MAT_VEC const& expr) { \ |
| 184 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 185 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 186 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == expr.y.size); \ |
| 187 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 188 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 189 | target [irow] [icol] op expr.x [irow] [icol] - expr.y [icol]; \ |
| 190 | } |
| 191 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 192 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:182:9`! |
| 193 | inline autoMATcxx . . $ autoMAT# subtract_MATcxx . . $ subtract_MAT(58a61c4ec227c4d). (constMATVUcxx . . $ constMATVU# const& x, constVECVUcxx . . $ constVECVU# const& y) { |
| 194 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 195 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(20d388cbf5f89ed1). x -cxx . . $ operator-(b5eb0b4cd90d249a). y; |
| 196 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 197 | } |
| 198 | |
| 199 | struct TypeMATadd_VEC_MATcxx . . $ TypeMATadd_VEC_MAT# { constVECVUcxx . . $ constVECVU# const& xcxx . . $ TypeMATadd_VEC_MAT#x.; constMATVUcxx . . $ constMATVU# const& ycxx . . $ TypeMATadd_VEC_MAT#y.; }; |
| 200 | inline TypeMATadd_VEC_MATcxx . . $ TypeMATadd_VEC_MAT# operatorcxx . . $ operator+(95f67ff37c20aa13).+ (constVECVUcxx . . $ constVECVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { return { x, y }; } |
| 201 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:201:9`!(operator, op) \ |
| 202 | inline void operator (MATVU const& target, TypeMATadd_VEC_MAT const& expr) { \ |
| 203 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.nrow == expr.x.size); \ |
| 204 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.nrow == target.nrow); \ |
| 205 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.ncol == target.ncol); \ |
| 206 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 207 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 208 | target [irow] [icol] op expr.x [irow] + expr.y [irow] [icol]; \ |
| 209 | } |
| 210 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 211 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:201:9`! |
| 212 | inline autoMATcxx . . $ autoMAT# add_MATcxx . . $ add_MAT(f284c9185690a20e). (constVECVUcxx . . $ constVECVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 213 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (y.nrowcxx . . $ constmatrixview#nrow., y.ncolcxx . . $ constmatrixview#ncol.); |
| 214 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(7ad23e41a97e9000). x +cxx . . $ operator+(95f67ff37c20aa13). y; |
| 215 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 216 | } |
| 217 | |
| 218 | struct TypeMATmultiply_VEC_MATcxx . . $ TypeMATmultiply_VEC_MAT# { constVECVUcxx . . $ constVECVU# const& xcxx . . $ TypeMATmultiply_VEC_MAT#x.; constMATVUcxx . . $ constMATVU# const& ycxx . . $ TypeMATmultiply_VEC_MAT#y.; }; |
| 219 | inline TypeMATmultiply_VEC_MATcxx . . $ TypeMATmultiply_VEC_MAT# operatorcxx . . $ `operator*`(9e43e834c16ae382).* (constVECVUcxx . . $ constVECVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { return { x, y }; } |
| 220 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:220:9`!(operator, op) \ |
| 221 | inline void operator (MATVU const& target, TypeMATmultiply_VEC_MAT const& expr) noexcept { \ |
| 222 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.nrow == expr.x.size); \ |
| 223 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.nrow == target.nrow); \ |
| 224 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.ncol == target.ncol); \ |
| 225 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 226 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 227 | target [irow] [icol] op expr.x [irow] * expr.y [irow] [icol]; \ |
| 228 | } |
| 229 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 230 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:220:9`! |
| 231 | inline autoMATcxx . . $ autoMAT# multiply_MATcxx . . $ multiply_MAT(f284c9185690a20e). (constVECVUcxx . . $ constVECVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 232 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (y.nrowcxx . . $ constmatrixview#nrow., y.ncolcxx . . $ constmatrixview#ncol.); |
| 233 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(e9da2181a271c4b4). x *cxx . . $ `operator*`(9e43e834c16ae382). y; |
| 234 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 235 | } |
| 236 | |
| 237 | struct TypeMATsubtract_VEC_MATcxx . . $ TypeMATsubtract_VEC_MAT# { constVECVUcxx . . $ constVECVU# const& xcxx . . $ TypeMATsubtract_VEC_MAT#x.; constMATVUcxx . . $ constMATVU# const& ycxx . . $ TypeMATsubtract_VEC_MAT#y.; }; |
| 238 | inline TypeMATsubtract_VEC_MATcxx . . $ TypeMATsubtract_VEC_MAT# operatorcxx . . $ operator-(c8fab9ce909c5d29).- (constVECVUcxx . . $ constVECVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { return { x, y }; } |
| 239 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:239:9`!(operator, op) \ |
| 240 | inline void operator (MATVU const& target, TypeMATsubtract_VEC_MAT const& expr) { \ |
| 241 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.nrow == expr.x.size); \ |
| 242 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.nrow == target.nrow); \ |
| 243 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.y.ncol == target.ncol); \ |
| 244 | for (integer irow = 1; irow <= target.nrow; irow ++) \ |
| 245 | for (integer icol = 1; icol <= target.ncol; icol ++) \ |
| 246 | target [irow] [icol] op expr.x [irow] - expr.y [irow] [icol]; \ |
| 247 | } |
| 248 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 249 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:239:9`! |
| 250 | inline autoMATcxx . . $ autoMAT# subtract_MATcxx . . $ subtract_MAT(f284c9185690a20e). (constVECVUcxx . . $ constVECVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 251 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (y.nrowcxx . . $ constmatrixview#nrow., y.ncolcxx . . $ constmatrixview#ncol.); |
| 252 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(f445312c32d2678d). x -cxx . . $ operator-(c8fab9ce909c5d29). y; |
| 253 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 254 | } |
| 255 | |
| 256 | struct TypeMATadd_MAT_MATcxx . . $ TypeMATadd_MAT_MAT# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATadd_MAT_MAT#x.; constMATVUcxx . . $ constMATVU# const& ycxx . . $ TypeMATadd_MAT_MAT#y.; }; |
| 257 | inline TypeMATadd_MAT_MATcxx . . $ TypeMATadd_MAT_MAT# operatorcxx . . $ operator+(c2ef99eb8d29dfbc).+ (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { return { x, y }; } |
| 258 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:258:9`!(operator, op) \ |
| 259 | inline void operator (MATVU const& target, TypeMATadd_MAT_MAT const& expr) { \ |
| 260 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 261 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 262 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == expr.y.nrow); \ |
| 263 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == expr.y.ncol); \ |
| 264 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 265 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 266 | target [irow] [icol] op expr.x [irow] [icol] + expr.y [irow] [icol]; \ |
| 267 | } |
| 268 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 269 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:258:9`! |
| 270 | inline autoMATcxx . . $ autoMAT# add_MATcxx . . $ add_MAT(341c1d932d99e4e3). (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 271 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 272 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(299e4f787c8f08b6). x +cxx . . $ operator+(c2ef99eb8d29dfbc). y; |
| 273 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 274 | } |
| 275 | |
| 276 | struct TypeMATmultiply_MAT_MATcxx . . $ TypeMATmultiply_MAT_MAT# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATmultiply_MAT_MAT#x.; constMATVUcxx . . $ constMATVU# const& ycxx . . $ TypeMATmultiply_MAT_MAT#y.; }; |
| 277 | inline TypeMATmultiply_MAT_MATcxx . . $ TypeMATmultiply_MAT_MAT# operatorcxx . . $ `operator*`(5a9ee21e83812b2e).* (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { return { x, y }; } |
| 278 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:278:9`!(operator, op) \ |
| 279 | inline void operator (MATVU const& target, TypeMATmultiply_MAT_MAT const& expr) noexcept { \ |
| 280 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 281 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 282 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == expr.y.nrow); \ |
| 283 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == expr.y.ncol); \ |
| 284 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 285 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 286 | target [irow] [icol] op expr.x [irow] [icol] * expr.y [irow] [icol]; \ |
| 287 | } |
| 288 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 289 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:278:9`! |
| 290 | inline autoMATcxx . . $ autoMAT# multiply_MATcxx . . $ multiply_MAT(341c1d932d99e4e3). (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 291 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 292 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(d79d6a7aa2bc1fec). x *cxx . . $ `operator*`(5a9ee21e83812b2e). y; |
| 293 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 294 | } |
| 295 | |
| 296 | struct TypeMATsubtract_MAT_MATcxx . . $ TypeMATsubtract_MAT_MAT# { constMATVUcxx . . $ constMATVU# const& xcxx . . $ TypeMATsubtract_MAT_MAT#x.; constMATVUcxx . . $ constMATVU# const& ycxx . . $ TypeMATsubtract_MAT_MAT#y.; }; |
| 297 | inline TypeMATsubtract_MAT_MATcxx . . $ TypeMATsubtract_MAT_MAT# operatorcxx . . $ operator-(8538f57502d6bea9).- (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { return { x, y }; } |
| 298 | #define GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:298:9`!(operator, op) \ |
| 299 | inline void operator (MATVU const& target, TypeMATsubtract_MAT_MAT const& expr) { \ |
| 300 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == target.nrow); \ |
| 301 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == target.ncol); \ |
| 302 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.nrow == expr.y.nrow); \ |
| 303 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (expr.x.ncol == expr.y.ncol); \ |
| 304 | for (integer irow = 1; irow <= expr.x.nrow; irow ++) \ |
| 305 | for (integer icol = 1; icol <= expr.x.ncol; icol ++) \ |
| 306 | target [irow] [icol] op expr.x [irow] [icol] - expr.y [irow] [icol]; \ |
| 307 | } |
| 308 | GENERATE_FIVE_TENSOR_FUNCTIONScxx . . $ `melder/VEC.h:20:9`! |
| 309 | #undef GENERATE_ONE_TENSOR_FUNCTIONcxx . . $ `melder/MAT.h:298:9`! |
| 310 | inline autoMATcxx . . $ autoMAT# subtract_MATcxx . . $ subtract_MAT(341c1d932d99e4e3). (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 311 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 312 | result.allcxx . . $ automatrix#all(2114117ba8ed4224).() <<=cxx . . $ `operator<<=`(7b88dc05e9f3af85). x -cxx . . $ operator-(8538f57502d6bea9). y; |
| 313 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 314 | } |
| 315 | |
| 316 | inline void abs_MAT_outcxx . . $ abs_MAT_out(a7d93ba40fe22fe0). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x) { |
| 317 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.nrow == x.nrow); |
| 318 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == x.ncol); |
| 319 | for (integercxx . . $ integer# irow = 1; irow <= x.nrowcxx . . $ constmatrixview#nrow.; irow ++) |
| 320 | for (integercxx . . $ integer# icol = 1; icol <= x.ncolcxx . . $ constmatrixview#ncol.; icol ++) |
| 321 | target [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = fabscxx . . $ fabs(fee4f1d22bc8e617). (x [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).irow] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).icol]); |
| 322 | } |
| 323 | inline void abs_MAT_inoutcxx . . $ abs_MAT_inout(5dd9f6ea610bc98c). (MATVUcxx . . $ MATVU# const& x) noexcept { |
| 324 | for (integercxx . . $ integer# irow = 1; irow <= x.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 325 | for (integercxx . . $ integer# icol = 1; icol <= x.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 326 | x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = fabscxx . . $ fabs(fee4f1d22bc8e617). (x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol]); |
| 327 | } |
| 328 | inline autoMATcxx . . $ autoMAT# abs_MATcxx . . $ abs_MAT(a392b09ce3fc3972). (constMATVUcxx . . $ constMATVU# const& x) { |
| 329 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 330 | abs_MAT_outcxx . . $ abs_MAT_out(a7d93ba40fe22fe0). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), x); |
| 331 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 332 | } |
| 333 | |
| 334 | /* |
| 335 | Make the average of each column zero. |
| 336 | a[i][j] -= a[.][j] |
| 337 | */ |
| 338 | extern void centreEachColumn_MAT_inoutcxx . . $ centreEachColumn_MAT_inout(5dd9f6ea610bc98c). (MATVUcxx . . $ MATVU# const& x) noexcept; |
| 339 | |
| 340 | /* |
| 341 | Make the average of each row zero. |
| 342 | a[i][j] -= a[i][.] |
| 343 | */ |
| 344 | extern void centreEachRow_MAT_inoutcxx . . $ centreEachRow_MAT_inout(5dd9f6ea610bc98c). (MATVUcxx . . $ MATVU# const& x) noexcept; |
| 345 | |
| 346 | /* |
| 347 | Make the average of every column and every row zero. |
| 348 | a[i][j] += - a[i][.] - a[.][j] + a[.][.] |
| 349 | */ |
| 350 | extern void doubleCentre_MAT_inoutcxx . . $ doubleCentre_MAT_inout(5dd9f6ea610bc98c). (MATVUcxx . . $ MATVU# const& x) noexcept; |
| 351 | |
| 352 | extern void mtm_MAT_outcxx . . $ mtm_MAT_out(bcb62980f535259). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x) noexcept; |
| 353 | inline autoMATcxx . . $ autoMAT# mtm_MATcxx . . $ mtm_MAT(a392b09ce3fc3972). (constMATVUcxx . . $ constMATVU# const& x) { |
| 354 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.ncolcxx . . $ constmatrixview#ncol., x.ncolcxx . . $ constmatrixview#ncol.); |
| 355 | mtm_MAT_outcxx . . $ mtm_MAT_out(bcb62980f535259). (resultcxx . . $ matrixview#matrixview(eed9513d24570b3d)..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), x); |
| 356 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 357 | } |
| 358 | |
| 359 | /* |
| 360 | Precise matrix multiplication, using pairwise summation. |
| 361 | */ |
| 362 | extern void _mul_MAT_outcxx . . $ _mul_MAT_out(d00f56e4262f6880). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) noexcept; |
| 363 | inline void mul_MAT_outcxx . . $ mul_MAT_out(9e368e0da0f1874a). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 364 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.nrow == x.nrow); |
| 365 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == y.ncol); |
| 366 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (x.ncol == y.nrow); |
| 367 | _mul_MAT_outcxx . . $ _mul_MAT_out(d00f56e4262f6880). (target, x, y); |
| 368 | } |
| 369 | inline autoMATcxx . . $ autoMAT# mul_MATcxx . . $ mul_MAT(341c1d932d99e4e3). (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 370 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., y.ncolcxx . . $ constmatrixview#ncol.); |
| 371 | mul_MAT_outcxx . . $ mul_MAT_out(9e368e0da0f1874a). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), x, y); |
| 372 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 373 | } |
| 374 | /* |
| 375 | Faster multiplication of large matrices, |
| 376 | which allocates new matrices to make x.colStride and y.rowStride 1 |
| 377 | (unless they are already 1). |
| 378 | Because of the use of malloc, this function may not be thread-safe. |
| 379 | */ |
| 380 | extern void _mul_forceAllocation_MAT_outcxx . . $ _mul_forceAllocation_MAT_out(4e78c3c576663480). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# x, constMATVUcxx . . $ constMATVU# y); |
| 381 | inline void mul_forceAllocation_MAT_outcxx . . $ mul_forceAllocation_MAT_out(4e78c3c576663480). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# x, constMATVUcxx . . $ constMATVU# y) { |
| 382 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.nrow == x.nrow); |
| 383 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == y.ncol); |
| 384 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (x.ncol == y.nrow); |
| 385 | _mul_forceAllocation_MAT_outcxx . . $ _mul_forceAllocation_MAT_out(4e78c3c576663480). (target, x, y); |
| 386 | } |
| 387 | inline autoMATcxx . . $ autoMAT# newMATmul_forceAllocationcxx . . $ newMATmul_forceAllocation(341c1d932d99e4e3). (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 388 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., y.ncolcxx . . $ constmatrixview#ncol.); |
| 389 | mul_forceAllocation_MAT_outcxx . . $ mul_forceAllocation_MAT_out(4e78c3c576663480). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), x, y); |
| 390 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 391 | } |
| 392 | /* |
| 393 | The faster of mul_forceAllocation_MAT_out and mul_MAT_out. |
| 394 | Because of the use of malloc, this function may not be thread-safe. |
| 395 | */ |
| 396 | extern void _mul_allowAllocation_MAT_outcxx . . $ _mul_allowAllocation_MAT_out(4e78c3c576663480). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# x, constMATVUcxx . . $ constMATVU# y); |
| 397 | inline void mul_allowAllocation_MAT_outcxx . . $ mul_allowAllocation_MAT_out(4e78c3c576663480). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# x, constMATVUcxx . . $ constMATVU# y) { |
| 398 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.nrow == x.nrow); |
| 399 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == y.ncol); |
| 400 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (x.ncol == y.nrow); |
| 401 | _mul_allowAllocation_MAT_outcxx . . $ _mul_allowAllocation_MAT_out(4e78c3c576663480). (target, x, y); |
| 402 | } |
| 403 | inline autoMATcxx . . $ autoMAT# mul_allowAllocation_MATcxx . . $ mul_allowAllocation_MAT(341c1d932d99e4e3). (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 404 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., y.ncolcxx . . $ constmatrixview#ncol.); |
| 405 | mul_allowAllocation_MAT_outcxx . . $ mul_allowAllocation_MAT_out(4e78c3c576663480). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), x, y); |
| 406 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 407 | } |
| 408 | /* |
| 409 | Rough matrix multiplication, using an in-cache inner loop if that is faster. |
| 410 | */ |
| 411 | extern void _mul_fast_MAT_outcxx . . $ _mul_fast_MAT_out(d00f56e4262f6880). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) noexcept; |
| 412 | inline void mul_fast_MAT_outcxx . . $ mul_fast_MAT_out(9e368e0da0f1874a). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 413 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.nrow == x.nrow); |
| 414 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == y.ncol); |
| 415 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (x.ncol == y.nrow); |
| 416 | _mul_fast_MAT_outcxx . . $ _mul_fast_MAT_out(d00f56e4262f6880). (target, x, y); |
| 417 | } |
| 418 | inline autoMATcxx . . $ autoMAT# mul_fast_MATcxx . . $ mul_fast_MAT(341c1d932d99e4e3). (constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 419 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., y.ncolcxx . . $ constmatrixview#ncol.); |
| 420 | mul_fast_MAT_outcxx . . $ mul_fast_MAT_out(9e368e0da0f1874a). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), x, y); |
| 421 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 422 | } |
| 423 | void MATmul_forceMetal_cxx . . $ MATmul_forceMetal_(9e368e0da0f1874a). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y); |
| 424 | void MATmul_forceOpenCL_cxx . . $ MATmul_forceOpenCL_(9e368e0da0f1874a). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x, constMATVUcxx . . $ constMATVU# const& y); |
| 425 | |
| 426 | inline void neg_MAT_outcxx . . $ neg_MAT_out(a7d93ba40fe22fe0). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x) { |
| 427 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.nrow == x.nrow); |
| 428 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.ncol == x.ncol); |
| 429 | for (integercxx . . $ integer# irow = 1; irow <= x.nrowcxx . . $ constmatrixview#nrow.; irow ++) |
| 430 | for (integercxx . . $ integer# icol = 1; icol <= x.ncolcxx . . $ constmatrixview#ncol.; icol ++) |
| 431 | target [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = - x [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).irow] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).icol]; |
| 432 | } |
| 433 | inline void neg_MAT_inoutcxx . . $ neg_MAT_inout(5dd9f6ea610bc98c). (MATVUcxx . . $ MATVU# const& x) noexcept { |
| 434 | for (integercxx . . $ integer# irow = 1; irow <= x.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 435 | for (integercxx . . $ integer# icol = 1; icol <= x.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 436 | x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = - x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol]; |
| 437 | } |
| 438 | inline autoMATcxx . . $ autoMAT# neg_MATcxx . . $ neg_MAT(a392b09ce3fc3972). (constMATVUcxx . . $ constMATVU# const& x) { |
| 439 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.nrowcxx . . $ constmatrixview#nrow., x.ncolcxx . . $ constmatrixview#ncol.); |
| 440 | neg_MAT_outcxx . . $ neg_MAT_out(a7d93ba40fe22fe0). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), x); |
| 441 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 442 | } |
| 443 | |
| 444 | void outer_MAT_outcxx . . $ outer_MAT_out(2869a0b58d3aa0f4). (MATVUcxx . . $ MATVU# const& target, constVECVUcxx . . $ constVECVU# const& x, constVECVUcxx . . $ constVECVU# const& y); |
| 445 | extern autoMATcxx . . $ autoMAT# outer_MATcxx . . $ outer_MAT(aaaa557e9be1882f). (constVECVUcxx . . $ constVECVU# const& x, constVECVUcxx . . $ constVECVU# const& y); |
| 446 | |
| 447 | extern autoMATcxx . . $ autoMAT# peaks_MATcxx . . $ peaks_MAT(b652fed2c7f40ff3). (constVECVUcxx . . $ constVECVU# const& x, bool includeEdges, int interpolate, bool sortByHeight); |
| 448 | |
| 449 | void power_MAT_outcxx . . $ power_MAT_out(ff53fc23fd1cc703). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& mat, double power); |
| 450 | inline autoMATcxx . . $ autoMAT# power_MATcxx . . $ power_MAT(d05068067bdbbf5a). (constMATVUcxx . . $ constMATVU# const& mat, double power) { |
| 451 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (mat.nrowcxx . . $ constmatrixview#nrow., mat.ncolcxx . . $ constmatrixview#ncol.); |
| 452 | power_MAT_outcxx . . $ power_MAT_out(ff53fc23fd1cc703). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), mat, power); |
| 453 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 454 | } |
| 455 | |
| 456 | inline void randomGauss_MAT_outcxx . . $ randomGauss_MAT_out(2fdf026ca2b4c21). (MATVUcxx . . $ MATVU# const& target, double mu, double sigma) { |
| 457 | for (integercxx . . $ integer# irow = 1; irow <= target.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 458 | for (integercxx . . $ integer# icol = 1; icol <= target.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 459 | target [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = NUMrandomGausscxx . . $ NUMrandomGauss(d8e7e0733fa41c87). (mu, sigma); |
| 460 | } |
| 461 | inline autoMATcxx . . $ autoMAT# randomGauss_MATcxx . . $ randomGauss_MAT(58e174d0e2ab475a). (integercxx . . $ integer# nrow, integercxx . . $ integer# ncol, double mu, double sigma) { |
| 462 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (nrow, ncol); |
| 463 | randomGauss_MAT_outcxx . . $ randomGauss_MAT_out(2fdf026ca2b4c21). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), mu, sigma); |
| 464 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 465 | } |
| 466 | inline autoMATcxx . . $ autoMAT# randomGauss_MATcxx . . $ randomGauss_MAT(ae29e6cd23d9e0a1). (constMATVUcxx . . $ constMATVU# const& model, double mu, double sigma) { |
| 467 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (model.nrowcxx . . $ constmatrixview#nrow., model.ncolcxx . . $ constmatrixview#ncol.); |
| 468 | randomGauss_MAT_outcxx . . $ randomGauss_MAT_out(2fdf026ca2b4c21). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), mu, sigma); |
| 469 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 470 | } |
| 471 | |
| 472 | inline void randomUniform_MAT_outcxx . . $ randomUniform_MAT_out(2fdf026ca2b4c21). (MATVUcxx . . $ MATVU# const& target, double lowest, double highest) { |
| 473 | for (integercxx . . $ integer# irow = 1; irow <= target.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 474 | for (integercxx . . $ integer# icol = 1; icol <= target.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 475 | target [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = NUMrandomUniformcxx . . $ NUMrandomUniform(d8e7e0733fa41c87). (lowest, highest); |
| 476 | } |
| 477 | inline autoMATcxx . . $ autoMAT# randomUniform_MATcxx . . $ randomUniform_MAT(58e174d0e2ab475a). (integercxx . . $ integer# nrow, integercxx . . $ integer# ncol, double lowest, double highest) { |
| 478 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (nrow, ncol); |
| 479 | randomUniform_MAT_outcxx . . $ randomUniform_MAT_out(2fdf026ca2b4c21). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), lowest, highest); |
| 480 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 481 | } |
| 482 | inline autoMATcxx . . $ autoMAT# randomUniform_MATcxx . . $ randomUniform_MAT(ae29e6cd23d9e0a1). (constMATVUcxx . . $ constMATVU# const& model, double lowest, double highest) { |
| 483 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (model.nrowcxx . . $ constmatrixview#nrow., model.ncolcxx . . $ constmatrixview#ncol.); |
| 484 | randomUniform_MAT_outcxx . . $ randomUniform_MAT_out(2fdf026ca2b4c21). (result.allcxx . . $ automatrix#all(2114117ba8ed4224).(), lowest, highest); |
| 485 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 486 | } |
| 487 | |
| 488 | inline void sin_MAT_inoutcxx . . $ sin_MAT_inout(5dd9f6ea610bc98c). (MATVUcxx . . $ MATVU# const& mat) noexcept { |
| 489 | for (integercxx . . $ integer# irow = 1; irow <= mat.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 490 | for (integercxx . . $ integer# icol = 1; icol <= mat.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 491 | mat [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = sincxx . . $ sin(fee4f1d22bc8e617). (mat [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol]); |
| 492 | } |
| 493 | |
| 494 | autoMATcxx . . $ autoMAT# splitByLinesAndWhitespace_MATcxx . . $ splitByLinesAndWhitespace_MAT(2b142147f85942aa). (conststring32cxx . . $ conststring32# string); |
| 495 | |
| 496 | inline void subtractReversed_MAT_inoutcxx . . $ subtractReversed_MAT_inout(50b469ae42a42f64). (MATVUcxx . . $ MATVU# const& x, double number) noexcept { |
| 497 | for (integercxx . . $ integer# irow = 1; irow <= x.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 498 | for (integercxx . . $ integer# icol = 1; icol <= x.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 499 | x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = number - x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol]; |
| 500 | } |
| 501 | inline void subtractReversed_MAT_inoutcxx . . $ subtractReversed_MAT_inout(a7d93ba40fe22fe0). (MATVUcxx . . $ MATVU# const& x, constMATVUcxx . . $ constMATVU# const& y) { |
| 502 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (y.nrow == x.nrow && y.ncol == x.ncol); |
| 503 | for (integercxx . . $ integer# irow = 1; irow <= x.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 504 | for (integercxx . . $ integer# icol = 1; icol <= x.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 505 | x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = y [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).irow] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).icol] - x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol]; |
| 506 | } |
| 507 | |
| 508 | inline void transpose_mustBeSquare_MAT_inoutcxx . . $ transpose_mustBeSquare_MAT_inout(a810c3355071c044). (MATVUcxx . . $ MATVU# const& x) { |
| 509 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (x.nrow == x.ncol); |
| 510 | integercxx . . $ integer# n = x.nrowcxx . . $ matrixview#nrow.; |
| 511 | for (integercxx . . $ integer# i = 1; i < n; i ++) |
| 512 | for (integercxx . . $ integer# j = i + 1; j <= n; j ++) |
| 513 | stdcxx . . $ std/::swapcxx . . $ std/swap(c75b8fd57d7c2e06). (x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).i] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).j], x [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).j] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).i]); |
| 514 | } |
| 515 | inline void transpose_MAT_outcxx . . $ transpose_MAT_out(a7d93ba40fe22fe0). (MATVUcxx . . $ MATVU# const& target, constMATVUcxx . . $ constMATVU# const& x) { |
| 516 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (x.nrow == target.ncol && x.ncol == target.nrow); |
| 517 | for (integercxx . . $ integer# irow = 1; irow <= target.nrowcxx . . $ matrixview#nrow.; irow ++) |
| 518 | for (integercxx . . $ integer# icol = 1; icol <= target.ncolcxx . . $ matrixview#ncol.; icol ++) |
| 519 | target [cxx . . $ matrixview#`operator[]`(a8b9553e85c2b1fc).irow] [cxx . . $ vectorview#`operator[]`(8a4599b8835d1ce1).icol] = x [cxx . . $ constmatrixview#`operator[]`(7a6174ed67b49158).icol] [cxx . . $ constvectorview#`operator[]`(e616e229aa94bfcf).irow]; |
| 520 | } |
| 521 | inline autoMATcxx . . $ autoMAT# transpose_MATcxx . . $ transpose_MAT(a392b09ce3fc3972). (constMATVUcxx . . $ constMATVU# const& x) { |
| 522 | autoMATcxx . . $ autoMAT# result = raw_MATcxx . . $ raw_MAT(3d09731056d2b97d). (x.ncolcxx . . $ constmatrixview#ncol., x.nrowcxx . . $ constmatrixview#nrow.); |
| 523 | transpose_MAT_outcxx . . $ transpose_MAT_out(a7d93ba40fe22fe0). (resultcxx . . $ matrixview#matrixview(eed9513d24570b3d)..getcxx . . $ automatrix#get(b2b81450b5bdda66).(), x); |
| 524 | return resultcxx . . $ automatrix#automatrix(a69681c49ef9c9eb).; |
| 525 | } |
| 526 | |
| 527 | /* End of file MAT.h */ |