-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_ndArray.h
More file actions
33 lines (27 loc) · 746 Bytes
/
test_ndArray.h
File metadata and controls
33 lines (27 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __TEST_ND_ARRAY__
#define __TEST_ND_ARRAY__
//================================================
// @file test_ndArray.h
// @author Jonathan Hadida, Oxford DTC
// @contact Jonathan.hadida [at] dtc.ox.ac.uk
//================================================
#include "ndArray.h"
#include <initializer_list>
using namespace nd;
/**
* Print the contents of a 2-dimensional array.
*/
template <typename T>
void print_matrix( const ndArray<T,2>& M )
{
const unsigned nr = M.size(0);
const unsigned nc = M.size(1);
printf( "Printing %u-by-%u matrix:\n", nr, nc );
for ( unsigned r = 0; r < nr; ++r )
{
for ( unsigned c = 0; c < nc; ++c )
std::cout << "\t" << M(r,c);
printf("\n");
} printf("\n");
}
#endif