Vital
Loading...
Searching...
No Matches
matrix.h
Go to the documentation of this file.
1#pragma once
2
3#include "common.h"
4
5namespace vital {
6
19 struct matrix {
21
25 matrix() { }
26
36 row0(r0), row1(r1), row2(r2), row3(r3) { }
37
47
57 row0 = poly_float::mulAdd(row0, other.row0 - row0, t);
58 row1 = poly_float::mulAdd(row1, other.row1 - row1, t);
59 row2 = poly_float::mulAdd(row2, other.row2 - row2, t);
60 row3 = poly_float::mulAdd(row3, other.row3 - row3, t);
61 }
62
72 row0 = poly_float::mulAdd(row0, other.row0 - row0, t[0]);
73 row1 = poly_float::mulAdd(row1, other.row1 - row1, t[1]);
74 row2 = poly_float::mulAdd(row2, other.row2 - row2, t[2]);
75 row3 = poly_float::mulAdd(row3, other.row3 - row3, t[3]);
76 }
77
84 return row0 + row1 + row2 + row3;
85 }
86
94 poly_float row01 = poly_float::mulAdd(row0 * other.row0, row1, other.row1);
95 poly_float row012 = poly_float::mulAdd(row01, row2, other.row2);
96 return poly_float::mulAdd(row012, row3, other.row3);
97 }
98 };
99} // namespace vital
#define force_inline
Definition common.h:23
Contains classes and functions used within the Vital synthesizer framework.
A structure representing a 4x1 matrix of poly_float rows.
Definition matrix.h:19
force_inline poly_float multiplyAndSumRows(const matrix &other)
Multiplies and sums corresponding rows of this matrix with another matrix.
Definition matrix.h:93
force_inline void interpolateColumns(const matrix &other, poly_float t)
Linearly interpolates each column of the matrix towards another matrix.
Definition matrix.h:56
poly_float row2
Definition matrix.h:20
poly_float row0
Definition matrix.h:20
force_inline void transpose()
Transposes the matrix in-place.
Definition matrix.h:44
force_inline poly_float sumRows()
Sums all the rows together.
Definition matrix.h:83
force_inline void interpolateRows(const matrix &other, poly_float t)
Performs row-wise interpolation, using a separate interpolation factor from each row of t.
Definition matrix.h:71
matrix()
Default constructor leaves rows uninitialized.
Definition matrix.h:25
matrix(poly_float r0, poly_float r1, poly_float r2, poly_float r3)
Constructs a matrix with specified rows.
Definition matrix.h:35
poly_float row3
The four rows of the matrix as poly_float values.
Definition matrix.h:20
poly_float row1
Definition matrix.h:20
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600
static force_inline void vector_call transpose(simd_type &row0, simd_type &row1, simd_type &row2, simd_type &row3)
Performs an in-place 4x4 transpose of four SSE/NEON registers containing float data.
Definition poly_values.h:1048
simd_type value
The underlying SIMD register for float.
Definition poly_values.h:1112
static force_inline simd_type vector_call mulAdd(simd_type one, simd_type two, simd_type three)
Fused multiply-add operation: one = one + (two * three).
Definition poly_values.h:779