Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2b44543d authored by Nicolas Bellot's avatar Nicolas Bellot Committed by hhakim
Browse files

fichier inutile

parent 9e9a4fd2
Branches
Tags
No related merge requests found
/****************************************************************************/
/* Description: */
/* For more information on the FAuST Project, please visit the website */
/* of the project : <http://faust.gforge.inria.fr> */
/* */
/* License: */
/* Copyright (2016): Nicolas Bellot, Adrien Leman, Thomas Gautrais, */
/* Luc Le Magoarou, Remi Gribonval */
/* INRIA Rennes, FRANCE */
/* http://www.inria.fr/ */
/* */
/* The FAuST Toolbox is distributed under the terms of the GNU Affero */
/* General Public License. */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU Affero General Public License as */
/* published by the Free Software Foundation. */
/* */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
/* See the GNU Affero General Public License for more details. */
/* */
/* You should have received a copy of the GNU Affero General Public */
/* License along with this program. */
/* If not, see <http://www.gnu.org/licenses/>. */
/* */
/* Contacts: */
/* Nicolas Bellot : nicolas.bellot@inria.fr */
/* Adrien Leman : adrien.leman@inria.fr */
/* Thomas Gautrais : thomas.gautrais@inria.fr */
/* Luc Le Magoarou : luc.le-magoarou@inria.fr */
/* Remi Gribonval : remi.gribonval@inria.fr */
/* */
/* References: */
/* [1] Le Magoarou L. and Gribonval R., "Flexible multi-layer sparse */
/* approximations of matrices and applications", Journal of Selected */
/* Topics in Signal Processing, 2016. */
/* <https://hal.archives-ouvertes.fr/hal-01167948v1> */
/****************************************************************************/
#include "faust_core.h"
#include "faust_params.h"
#include "faust_init_from_matio_params.h"
#include "hierarchical_fact.h"
#include "faust_vec.h"
#include "faust_timer.h"
#include <iostream>
using namespace std;
typedef FFPP FPP;
/** \brief Evaluate the time difference using faust or classical-dense matrix, <br>
in a context of the multiplication between an matrix and a vector <br>
* \param[in] Entry Matrix is contained in a file .mat
* \param[out] Output data is placed in a file .dat
*/
int main()
{
// si true : MEG_fact
// si false : demo_dico_learning_compared
bool testMEG = true;
// init from params
faust_params<FPP> params;
if (testMEG)
init_params_from_matiofile(params, "@FAUST_DATA_MAT_DIR@/config_MEG.mat", "params");
else
init_params_from_matiofile(params, "@FAUST_DATA_MAT_DIR@/config_compared_hierarchical_fact.mat", "params");
//cout << "update_way=" << params.isUpdateWayR2L << endl;
/*vector<faust_spmat<FPP> > facts;
faust_core<FPP> faust(params);
faust.get_facts(facts);
(facts[0]) *=
char filename[100];
for (int i=0 ; i<facts.size() ; i++)
{
if (testMEG)
sprintf(filename, "facts_MEG%d.dat", i+1);
else
sprintf(filename, "facts_hier_fact%d.dat", i+1);
facts[i].print_file(filename);
}*/
// init from vector of faust_spmat
vector<faust_spmat<FPP> > facts;
if (testMEG)
facts.resize(6);
else
facts.resize(4);
char filename[100];
for (int i=0 ; i<facts.size() ; i++)
{
if (testMEG)
sprintf(filename, "@FAUST_DATA_MAT_DIR@/facts_MEG%d.txt", i);
else
sprintf(filename, "@FAUST_DATA_MAT_DIR@/learning_compared_fact%d.txt", i);
facts[i].init_from_file(filename);
}
faust_core<FPP> faust(facts, (FFPP)1.0);
faust_vec<FPP> vec_in(facts[facts.size()-1].getNbCol());
for (int i=0 ; i<vec_in.size() ; i++ )
vec_in[i] = i*0.015 ;
faust_vec<FPP> vec_out_faust, vec_out_mat;
faust_mat<FPP> full(params.data);
faust_timer t1;
t1.start();
vec_out_faust = faust * vec_in;
t1.stop();
cout << "temps multiplication faust-vector = " << t1.get_time() << "s." << endl;
faust_timer t2;
t2.start();
vec_in.multiplyLeft(full);
t2.stop();
cout << "temps multiplication matrix-vector = " << t2.get_time() << "s." << endl;
vec_out_mat = vec_in;
if (testMEG)
{
vec_out_faust.print_file("@FAUST_BIN_TEST_OUTPUT_DIR@/vec_out_MEG_faust.dat");
vec_out_mat.print_file("@FAUST_BIN_TEST_OUTPUT_DIR@/vec_out_MEG_mat.dat");
}
else
{
vec_out_faust.print_file("@FAUST_BIN_TEST_OUTPUT_DIR@/vec_out_hier_fact_faust.dat");
vec_out_mat.print_file("@FAUST_BIN_TEST_OUTPUT_DIR@/vec_out_hier_fact_mat.dat");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment