40template<
typename ElementType>
117 jassert (
row < rows && column < columns);
124 jassert (
row < rows && column < columns);
148 std::for_each (begin(), end(), [
scalar] (ElementType&
x) {
x *=
scalar; });
213 const ElementType* begin() const noexcept {
return &data.
getReference (0); }
214 const ElementType* end() const noexcept {
return begin() + data.
size(); }
221 data.
resize (
static_cast<int> (columns * rows));
222 dataAcceleration.
resize (
static_cast<int> (rows));
224 for (
size_t i = 0; i < rows; ++i)
225 dataAcceleration.
setUnchecked (
static_cast<int> (i), i * columns);
228 template <
typename BinaryOperation>
229 Matrix& apply (
const Matrix& other, BinaryOperation binaryOp)
231 jassert (rows == other.rows && columns == other.columns);
235 for (
auto src : other)
237 *dst = binaryOp (*dst, src);
245 Array<ElementType> data;
246 Array<size_t> dataAcceleration;
248 size_t rows, columns;
251 JUCE_LEAK_DETECTOR (Matrix)
void setUnchecked(int indexToChange, ParameterType newValue)
int size() const noexcept
ElementType * begin() noexcept
ElementType * end() noexcept
ElementType * getRawDataPointer() noexcept
void resize(int targetNumItems)
ElementType & getReference(int index) noexcept
Matrix operator-(const Matrix &other) const
Matrix & swapRows(size_t rowOne, size_t rowTwo) noexcept
Matrix & hadarmard(const Matrix &other) noexcept
size_t getNumRows() const noexcept
Matrix(Matrix &&) noexcept=default
static Matrix hadarmard(const Matrix &a, const Matrix &b)
static bool compare(const Matrix &a, const Matrix &b, ElementType tolerance=0) noexcept
Matrix(const Matrix &)=default
bool isOneColumnVector() const noexcept
bool isVector() const noexcept
bool isNullMatrix() const noexcept
Array< size_t > getSize() const noexcept
Matrix & swapColumns(size_t columnOne, size_t columnTwo) noexcept
Matrix(size_t numRows, size_t numColumns)
static Matrix hankel(const Matrix &vector, size_t size, size_t offset=0)
Matrix operator*(ElementType scalar) const
ElementType operator()(size_t row, size_t column) const noexcept
const ElementType * getRawDataPointer() const noexcept
Matrix & operator-=(const Matrix &other) noexcept
Matrix operator+(const Matrix &other) const
static Matrix identity(size_t size)
bool solve(Matrix &b) const noexcept
static Matrix toeplitz(const Matrix &vector, size_t size)
Matrix(size_t numRows, size_t numColumns, const ElementType *dataPointer)
ElementType * getRawDataPointer() noexcept
size_t getNumColumns() const noexcept
bool isSquare() const noexcept
Matrix & operator*=(ElementType scalar) noexcept
bool isOneRowVector() const noexcept
Matrix & operator+=(const Matrix &other) noexcept