This is my first post here. My friend told me that I can share my ideas here.
In Clang 14.0, matrix type is added and is still under development. Recently, I’ve tried matrix type and found that current implementation is column-major. Therefore, I have some ideas for developers:
row/column vector type derived from matrix type definition.
For example, as a 8x8 float matrix type is defined
since we have the number of row and the number of columns, it would be great to derived vector types from the matrix definition. And we could define row and column vectors like this way:
float8x8.row_t vrow, vrow2; // the two variables are float vectors with the length of a row.
float8x8.col_t vcol, vcol2; // the two variables are float vectors with the length of a column.
set a row or a column of a matrix
Similar to vector or matrix type, we use brackets to set or get a value of a vector or matrix.
For matrix, we could tried to have some notation to set a row or a column by providing vectors.
… // load data into mat, vrow, vcol …
mat.rows = vrow; // set a row of the matrix
mat.cols = vcol; // set a col of the matrix
vrow2 = mat.rows; // get a row of the matrix
vcol2 = mat.cols; // get a column of the matrix
multiplications - (vec x matrix) or (matrix x vec)
In some transformation applications, the notation is very useful - for example - Direct3D or OpenGL/Vulkan.
If vec is defined as matrix type with 1 column/row, this should already work I think. What doesn’t work at the moment I think is multiplying other vector types (like ext_vector_type with matrix types).