Tapkee
random_projection.hpp
Go to the documentation of this file.
00001 /* This software is distributed under BSD 3-clause license (see LICENSE file).
00002  *
00003  * Copyright (c) 2012-2013 Sergey Lisitsyn
00004  */
00005 
00006 #ifndef TAPKEE_RandomProjection_H_
00007 #define TAPKEE_RandomProjection_H_
00008 
00009 /* Tapkee includes */
00010 #include <tapkee/defines.hpp>
00011 #include <tapkee/utils/time.hpp>
00012 /* End of Tapkee includes */
00013 
00014 namespace tapkee
00015 {
00016 namespace tapkee_internal
00017 {
00018 
00019 DenseMatrix gaussian_projection_matrix(IndexType target_dimension, IndexType current_dimension)
00020 {
00021     DenseMatrix projection_matrix(target_dimension,current_dimension);
00022 
00023     for (IndexType i=0; i<target_dimension; ++i)
00024     {
00025         for (IndexType j=0; j<current_dimension; ++j)
00026         {
00027             projection_matrix(i,j) = tapkee::gaussian_random()/sqrt(target_dimension);
00028         }
00029     }
00030 
00031     return projection_matrix;
00032 }
00033 
00034 }
00035 }
00036 
00037 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines