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 */
20 
21 #ifndef RAN_utils_h
22 #define RAN_utils_h
23 
24 #include "../common/CudaDefinitions.h"
25 #include "../memory/HostMatrix.h"
26 
27 
28 #include "../memory/DeviceMatrix.h"
29 #include "rankernels.h"
30 #include <cula.h>
31 #include <cublas.h>
32 #include <cuda.h>
33 
34 #include <iostream>
35 #include <string>
36 #include <fstream>
37 
38 #define imin(X, Y) ((X) < (Y) ? (X) : (Y))
39 /*Utilities for matrix operations*/
40 
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  void writeM(std::string desc, DeviceMatrix<float> Mat);
50  void printM(std::string desc, DeviceMatrix<float> Mat, bool Order);
51  void printA(std::string desc, DeviceArray<float> Array);
52  DeviceMatrix<float> pseudoinverse(DeviceMatrix<float> &Input);
53  void pseudoinverse2(DeviceMatrix<float> &Input);
54 
55 
56  void printM(std::string desc, HostMatrix<float> Input, bool Order, int Rows);
57  void printM(std::string desc, HostMatrix<float> Mat, int Rows);
58  void printM(std::string desc, HostMatrix<float> Mat);
59  void printM(std::string desc, HostMatrix<float> Mat, bool Order);
60  void printM(std::string desc, DeviceMatrix<float> Mat, bool Order);
61  void printM(std::string desc, DeviceMatrix<float> Mat, int Rows);
62 
63 
64  void printA(std::string desc, HostArray<float> Array);
65  void printA(std::string desc, HostArray<float> Array, int Length);
66 
67 };
68 
69 #endif