📄 vector_test.cpp
字号:
/******************************************************************************* authors : Peter Pipenbacher filename : ghmm++/examples/vector_test.cpp $Id: vector_test.cpp,v 1.1 2002/04/03 11:16:24 pipenb Exp $ Copyright (C) 1998-2001, ZAIK/ZPR, Universit鋞 zu K鰈n This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *******************************************************************************/#include "ghmm++/GHMM.h"#ifdef HAVE_NAMESPACESusing namespace std;#endifint main() { /* Important! initialise rng */ GHMM_Toolkit::gsl_rng_init(); GHMM_DoubleVector v(10,1.0); v.print(stdout,"",",","\n"); printf("normalized vector:\n"); v.normalize(); v.print(stdout,"",",","\n"); printf("resize to 5 and normalize vector:\n"); v.resize(5); v.normalize(); v.print(stdout,"",",","\n"); printf("gives all elements the value 2.5:\n"); v.const_values(2.5); v.print(stdout,"",",","\n"); printf("gives all elements random values:\n"); v.random_values(); v.print(stdout,"",",","\n"); GHMM_DoubleMatrix matrix(2,5,0.5); printf("2x5 matrix M:\n"); matrix.print(stdout,"",",","\n"); printf("M x vector:\n"); GHMM_DoubleVector* v2 = matrix.times_vec(&v); v2->print(stdout,"",",","\n"); SAFE_DELETE(v2); #ifdef WIN32 printf("\nPress ENTER\n"); fgetc(stdin);#endif return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -