コード例 #1
0
ファイル: exercise_1.cpp プロジェクト: cvejoski/CUDALab
void print_2D_view(tensor<T, M>& a) {
	for (unsigned int i = 0; i<a.shape(0); i++){
		for (unsigned int j = 0; j<a.shape(1); j++)
			cout<<a(i, j)<<" ";
		cout<<endl;
	}
}
コード例 #2
0
ファイル: exercise_1.cpp プロジェクト: cvejoski/CUDALab
void print_3D_view(tensor<T, M>& a) {
	for (unsigned int k = 0; k<a.shape(0); k++) {
		cout<<"dimension 0: "<<k<<endl;
		for (unsigned int i = 0; i<a.shape(1); i++){
			for (unsigned int j = 0; j<a.shape(2); j++)
				cout<<a(k, i, j)<<" ";
			cout<<endl;
		}
	}
}
コード例 #3
0
ファイル: exercise_1.cpp プロジェクト: cvejoski/CUDALab
void rand_init(tensor<T, M>& a){
	for (unsigned int i=0; i<a.shape(0);i++)
		a[i] = drand48();
}