Matrix Manipulation

Matrix Manipulation

i would like to know if there are any defined functions for matrices, if not, then how can we implement those functionalities using what types and defined operations. For example, how can we do matrix multiplication??thanks,Ameen

publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hello Ameen, thanks for your question.

Working with a2D dense containerin conjunction with an ArBB function should be quite sufficient.

dense matrix;

You simply create the dense containers, feed them into an ArBB function, and then define the operations that you would like on those dense containers.Thereare a variety ofthings you can do withthe matrix dense container above. You can read about them in the User's Guide orsimplyplace periodafter "matrix." like so to see a list in VisualStudio that will pop up next to the dense container name.

Here are two interesting ArBB functions involving 2D dense containers. You can extrapolate how you would do it with two matrices.

/// Matrix-vector product performing row-wise scalar products.

void matvec_product(const dense& matrix, const dense& vector, dense& result)

{

_for (usize i = 0, i != vector.length(), ++i) {

f32 sdot_result;

scalar_product(matrix.row(i), vector, sdot_result);

result[i] = sdot_result;

} _end_for;

}

/// Matrix-vector product performing row-wise vector products followed a reduction.

void matvec_product_fast(const dense& matrix, const dense& vector, dense& result)

{

result = add_reduce(matrix * repeat_row(vector, matrix.num_rows()));

}

One important thing to note when you are picking algorithms-ArBB is not made to compete with fixed function libraries which are optimized to achieve the peak performance of the underlying architecture. ArBB plays well when it comes to customized algorithms (to stay in the math domain) which are not provided by any of the fixed function libraries (e.g. MKL). Moreover, I guess there are samples given in the Intel ArBB installation implementing such a multiplication (I am not sure if it is part of the distribution).

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya