C ++ MTL library example (finishing by Robinkin from Devonit)

xiaoxiao2021-03-06  43

// Targe COPY and transposition / / - * - C - * - //// $ copyright $ / // / ====================== ============================================================================================================================================================================================================= ===

#include using namespace std;

#include #include #include #include

/ * Transpose Matrix a Into Matrix B Using MTL :: Copy.

Sample Output

3X3 [[1, 4, 7], [2, 5, 8], [3, 6, 9]] 3X3 [[1, 2, 3], [4, 5, 6], [7, 8, 9 ] * /

Using namespace MTL;

Typedef Matrix , Dense <>, Column_major> :: Type Matrix

/ * An external matrix - uses memory from some "outside" source, and just makes that memory look like an MTL Matrix * / typedef matrix , dense , column_major> :: type EMatrix;

INTMAIN () {Int i; const Int n = 3; Double DA [] = {1, 2, 3, 4, 5, 6, 7, 8, 9};

Ematrix A (DA, N, N); Matrix B (n, n);

Print_all_matrix (a);

// copy the color (i = 0; i

Print_all_matrix (b);

Return 0;}

转载请注明原文地址:https://www.9cbs.com/read-53797.html

New Post(0)