libidx
/home/rex/ebltrunk/core/libidx/include/blasops.h
00001 /***************************************************************************
00002  *   Copyright (C) 2012 by Yann LeCun and Pierre Sermanet *
00003  *   yann@cs.nyu.edu, pierre.sermanet@gmail.com *
00004  *   All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are met:
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Redistribution under a license not approved by the Open Source
00014  *       Initiative (http://www.opensource.org) must display the
00015  *       following acknowledgement in all advertising material:
00016  *        This product includes software developed at the Courant
00017  *        Institute of Mathematical Sciences (http://cims.nyu.edu).
00018  *     * The names of the authors may not be used to endorse or promote products
00019  *       derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00023  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00024  * DISCLAIMED. IN NO EVENT SHALL ThE AUTHORS BE LIABLE FOR ANY
00025  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00026  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00027  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00028  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  ***************************************************************************/
00032 
00033 #ifndef BLASOPS_H
00034 #define BLASOPS_H
00035 
00036 #include "config.h"
00037 #include "numerics.h"
00038 #include "idx.h"
00039 
00040 #ifdef __CBLAS__
00041 
00042 namespace ebl {
00043 
00044   // idx_copy //////////////////////////////////////////////////////////////////
00045 
00046   template <> EXPORT void idx_copy(const idx<double> &src, idx<double> &dst);
00047   template <> EXPORT void idx_copy(const idx<float> &src, idx<float> &dst);
00048 
00049   // idx_dot ///////////////////////////////////////////////////////////////////
00050 
00052   EXPORT float64 idx_dot(idx<double> &i1, idx<double> &i2);
00053 #if defined(__CBLAS__) || (defined(__IPP__) && defined(__IPP_DOT__))
00054 
00055   EXPORT float64 idx_dot(idx<float32> &i1, idx<float32> &i2);
00056 #endif
00057 
00058   // m2dotm1 ///////////////////////////////////////////////////////////////////
00059 
00061   EXPORT void idx_m2dotm1(idx<double> &a, idx<double> &x, idx<double> &y);
00063   EXPORT void idx_m2dotm1(idx<float> &a, idx<float> &x, idx<float> &y);
00065   EXPORT void idx_m2dotm1acc(idx<double> &a, idx<double> &x, idx<double> &y);
00067   EXPORT void idx_m2dotm1acc(idx<float> &a, idx<float> &x, idx<float> &y);
00068 
00069   // m4dotm2 ///////////////////////////////////////////////////////////////////
00070   
00072   EXPORT void idx_m1extm1(idx<double> &a, idx<double> &x, idx<double> &y);
00074   EXPORT void idx_m1extm1(idx<float> &a, idx<float> &x, idx<float> &y);
00076   EXPORT void idx_m1extm1acc(idx<double> &a, idx<double> &x, idx<double> &y);
00078   EXPORT void idx_m1extm1acc(idx<float> &a, idx<float> &x, idx<float> &y);
00079 
00080   // norm_columns //////////////////////////////////////////////////////////////
00081 
00083   EXPORT void norm_columns(idx<double> &m);
00085   EXPORT void norm_columns(idx<float> &m);
00086   
00087 } // end namespace ebl
00088 
00089 #endif /* __CBLAS__ */
00090 
00091 #endif /* BLASOPS_H */