29 std::fill(
mData.get(),
mData.get() + len, 0.0);
39 std::fill(
mData.get(),
mData.get() + len, 0.0);
44 wxASSERT(
Len() == other.
Len());
75 for(
unsigned i = 0; i <
Len(); i++)
85 for(
unsigned i = 0; i <
mRows; i++) {
87 for(
unsigned j = 0; j <
mCols; j++) {
89 (*this)[i][j] = data[i][j];
112 for (
unsigned i = 0; i <
mRows; i++) {
130 for(
unsigned i = 0; i < N; i++)
137 wxASSERT(left.
Len() == right.
Len());
139 for(
unsigned i = 0; i < left.
Len(); i++)
140 v[i] = left[i] + right[i];
146 wxASSERT(left.
Len() == right.
Len());
148 for(
unsigned i = 0; i < left.
Len(); i++)
149 v[i] = left[i] - right[i];
155 wxASSERT(left.
Len() == right.
Len());
157 for(
unsigned i = 0; i < left.
Len(); i++)
158 v[i] = left[i] * right[i];
165 for(
unsigned i = 0; i < left.
Len(); i++)
166 v[i] = left[i] * right;
173 for(
unsigned i = 0; i < len; i++)
174 v[i] = other[start+i];
181 for(
unsigned i = 0; i < left.
Len(); i++)
183 for(
unsigned i = 0; i < right.
Len(); i++)
184 v[i + left.
Len()] = right[i];
190 wxASSERT(left.
Len() == right.
Rows());
192 for(
unsigned i = 0; i < right.
Cols(); i++) {
194 for(
unsigned j = 0; j < right.
Rows(); j++)
195 v[i] += left[j] * right[j][i];
202 wxASSERT(left.
Cols() == right.
Len());
204 for(
unsigned i = 0; i < left.
Rows(); i++) {
206 for(
unsigned j = 0; j < left.
Cols(); j++)
207 v[i] += left[i][j] * right[j];
214 wxASSERT(left.
Rows() == right.
Rows());
215 wxASSERT(left.
Cols() == right.
Cols());
217 for(
unsigned i = 0; i < left.
Rows(); i++)
218 for(
unsigned j = 0; j < left.
Cols(); j++)
219 M[i][j] = left[i][j] + right[i][j];
226 for(
unsigned i = 0; i < left.
Rows(); i++)
227 for(
unsigned j = 0; j < left.
Cols(); j++)
228 M[i][j] = left[i][j] * right;
234 wxASSERT(left.
Rows() == right.
Rows());
235 wxASSERT(left.
Cols() == right.
Cols());
237 for(
unsigned i = 0; i < left.
Rows(); i++)
238 for(
unsigned j = 0; j < left.
Cols(); j++)
239 M[i][j] = left[i][j] * right[i][j];
245 wxASSERT(left.
Cols() == right.
Rows());
247 for(
unsigned i = 0; i < left.
Rows(); i++)
248 for(
unsigned j = 0; j < right.
Cols(); j++) {
250 for(
unsigned k = 0; k < left.
Cols(); k++)
251 M[i][j] += left[i][k] * right[k][j];
257 unsigned startRow,
unsigned numRows,
258 unsigned startCol,
unsigned numCols)
260 Matrix M(numRows, numCols);
261 for(
unsigned i = 0; i < numRows; i++)
262 for(
unsigned j = 0; j < numCols; j++)
263 M[i][j] = input[startRow+i][startCol+j];
269 wxASSERT(left.
Rows() == right.
Rows());
271 for(
unsigned i = 0; i < left.
Rows(); i++) {
272 for(
unsigned j = 0; j < left.
Cols(); j++)
273 M[i][j] = left[i][j];
274 for(
unsigned j = 0; j < right.
Cols(); j++)
275 M[i][j+left.
Cols()] = right[i][j];
283 for(
unsigned i = 0; i < other.
Rows(); i++)
284 for(
unsigned j = 0; j < other.
Cols(); j++)
285 M[j][i] = other[i][j];
295 wxASSERT(input.
Rows() == input.
Cols());
296 auto N = input.
Rows();
302 for(
unsigned i = 0; i < N; i++) {
306 unsigned int argmax = 0;
308 for(
unsigned j = i; j < N; j++)
309 if (fabs(M[j][i]) > absmax) {
310 absmax = fabs(M[j][i]);
325 double factor = 1.0 / M[i][i];
326 M[i] = M[i] * factor;
327 Minv[i] = Minv[i] * factor;
330 for(
unsigned j = 0; j < N; j++) {
333 if (fabs(M[j][i]) > 0) {
336 for(
unsigned k = 0; k < N; k++) {
337 M[j][k] -= (M[i][k] * factor);
338 Minv[j][k] -= (Minv[i][k] * factor);
Matrix IdentityMatrix(unsigned N)
Vector VectorConcatenate(const Vector &left, const Vector &right)
Vector operator-(const Vector &left, const Vector &right)
Matrix MatrixSubset(const Matrix &input, unsigned startRow, unsigned numRows, unsigned startCol, unsigned numCols)
Matrix TransposeMatrix(const Matrix &other)
Vector operator+(const Vector &left, const Vector &right)
bool InvertMatrix(const Matrix &input, Matrix &Minv)
Matrix MatrixConcatenateCols(const Matrix &left, const Matrix &right)
Vector operator*(const Vector &left, const Vector &right)
Vector VectorSubset(const Vector &other, unsigned start, unsigned len)
Matrix ScalarMultiply(const Matrix &left, const Matrix &right)
Matrix MatrixMultiply(const Matrix &left, const Matrix &right)
General routine to interpolate (or even extrapolate small amounts) audio when a few of the samples ar...
void reinit(Integral count, bool initialize=false)
Holds a matrix of doubles and supports arithmetic, subsetting, and matrix inversion....
Matrix(const Matrix ©From)
Matrix & operator=(const Matrix &other)
ArrayOf< Vector > mRowVec
void SwapRows(unsigned i, unsigned j)
void CopyFrom(const Matrix &other)
Holds a matrix of doubles and supports arithmetic operations, including Vector-Matrix operations....
void Reinit(unsigned len)
Vector & operator=(const Vector &other)
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
void copy(const T *src, T *dst, int32_t n)