59 std::cout <<
"MATRIX/VECTOR OPERATIONS EXAMPLE\n" << std::endl;
63 std::cout <<
"Sum = " << x <<
"\n\n";
65 gpmp::Matrix<int> mat(3, 4);
68 std::tuple<Matrix<double>, Matrix<double>> matrices =
69 std::make_tuple(Matrix<double>(5, 3), Matrix<double>(6, 4));
71 std::get<0>(matrices).print_mtx();
72 std::get<1>(matrices).print_mtx();
74 std::cout <<
"PRINT CSV AS MATRIX \n";
78 std::cout <<
"Creating 2x2 matrix of random negative floats\n";
79 auto matrix_neg = gpmp::mtx<double>::randn(2, 2);
80 matrix_neg.print_shape();
81 matrix_neg.print_mtx();
84 std::cout <<
"Creating 2x2 matrix of random positive floats\n";
85 auto matrix_pos = gpmp::mtx<double>::rand(2, 2);
86 matrix_pos.print_shape();
87 matrix_pos.print_mtx();
89 std::cout <<
"Transpose the MATRIX \n";
90 (matrix_pos.transpose()).print_mtx();
92 std::cout <<
"Multiply each element of the matrix by a number"
94 std::cout <<
"By 2\n";
95 (matrix_pos.scalar_mult(2.f)).print_mtx();
96 std::cout <<
"By 3\n";
97 (matrix_pos.scalar_mult(3.f)).print_mtx();
100 std::cout <<
"Multiply each element of the matrix by itself"
102 (matrix_pos.hadamard(matrix_pos)).print_mtx();
105 std::cout <<
"Creating 3x5 matrix of 0's"
107 auto matrix_zero = gpmp::Matrix<double>(3, 5);
108 matrix_zero.print_shape();
109 matrix_zero.print_mtx();
113 std::cout <<
"Creating 8x9 matrix of 0's"
115 auto matrix_zero_2 = gpmp::mtx<int>::zeros(8, 9);
116 matrix_zero_2.print_shape();
117 matrix_zero_2.print_mtx();
120 std::cout <<
"Creating 8x9 matrix of 1's"
122 auto matrix_one = gpmp::mtx<int>::ones(8, 9);
123 matrix_one.print_shape();
124 matrix_one.print_mtx();