GPUMLib  0.2.2
GPU Machine Learning Library
utils.h
1 /*
2  Ricardo Quintas is an MSc Student at the University of Coimbra, Portugal
3  Copyright (C) 2009, 2010 Ricardo Quintas
4 
5  This file is part of GPUMLib.
6 
7  GPUMLib is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
22 
23 #ifndef RBF_utils_h
24 #define RBF_utils_h
25 
26 #include "../common/CudaDefinitions.h"
27 #include "../memory/HostMatrix.h"
28 #include "../memory/DeviceMatrix.h"
29 #include "rbfkernels.h"
30 
31 #include <iostream>
32 #include <string>
33 #include <fstream>
34 
35 #include <cula.h>
36 #include <cublas.h>
37 #include <cuda.h>
38 
39 #define imin(X, Y) ((X) < (Y) ? (X) : (Y))
40 /*Utilities for matrix operations*/
41 
42 void checkStatus(culaStatus status);
43 
44 using namespace GPUMLib;
45 
46 namespace UTILS{
47 
48  void writeM(std::string desc, HostMatrix<float> Input);
49 
50  void writeM(std::string desc, DeviceMatrix<float> Mat);
51 
52  void printM(std::string desc, HostMatrix<float> Input, bool Order, int Rows);
53  void printM(std::string desc, HostMatrix<float> Mat, int Rows);
54  void printM(std::string desc, HostMatrix<float> Mat);
55  void printM(std::string desc, HostMatrix<float> Mat, bool Order);
56  void printM(std::string desc, DeviceMatrix<float> Mat, bool Order);
57  void printM(std::string desc, DeviceMatrix<float> Mat, int Rows);
58 
59  void printA(std::string desc, HostArray<float> Array);
60  void printA(std::string desc, HostArray<float> Array, int Length);
61  void printA(std::string desc, DeviceArray<int> Array);
62  void printA(std::string desc, HostArray<int> Array);
63 
64  DeviceMatrix<float> pseudoinverse(DeviceMatrix<float> &Input);
65 
66 };
67 
68 #endif
69 
70