Vector容器简介

                                  Vector容器
   STL在C++中称为标准模板库。STL定义了一系列用途广泛的模板类和模板函数,它们可以用来实现许多通用的算法和数据结构。
   标准模板库STL的核心内容是3个基本组件:容器、算法和迭代器。STL将这些组件结合在一起为许多程序设计难题提供实际可行的解决办法。
例:
    list容器是一个线性表容器,它有一个成员函数是sort(),调用这个函数可以将list容器对象中的数据进行排序。
   
 定义一个list对象list1,并加入数据
    4  3  5  2  1
    list1.sort()
    1  2  3  4  5
动态数组vector容器
    动态数值是指可以根据需要改变大小的数组。虽然在C++中数组的大小在编译时是固定的,因为程序在运行时不能改变数组的大小来适应程序需求。然而,vector可以根据需要来分配内存,从而解决这个问题。虽然vector是动态的,你仍然可以使用标准的数组下标运算来访问数组中的元素。

1.创建一个vector对象
 #include<vector>
 using namespace std;
    
    vector<int> v1;
    vector<char> v2;
2.向vector对象中添加数值
 
    v1.push_back(0);
    v1.push_back(1);
    for (i=2; i<=10;i++)   v1.push_back(i);
3.获得vector对象的大小
 
    v1.size()

    for (i=0; i<v1.size();i++)
    cout <<  v1[i] <<  “  ” ;
4.获得vector对象中第一个和最后一个元素;
 
   vector<int>::iterator p = v1.begin();
   vector<int>::iterator p = v1.end();
5.在vector对象中插入元素;

 vector<int>::iterator p = v1.begin();
    p = p+2;
    v1.insert(p, 2 , 100);
6.在vector对象中删除元素;
 
    v1.erase(p, p+3);
7.修改vector对象中的内容;
 
    v1[1] = v1[1] * v1[1]
    v1[2] = v1[2] + 100
8.清除vector对象中的所有内容;
 
    v1.clear()

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MSR Identity Toolbox: A Matlab Toolbox for Speaker Recognition Research Version 1.0 Seyed Omid Sadjadi, Malcolm Slaney, and Larry Heck Microsoft Research, Conversational Systems Research Center (CSRC) s.omid.sadjadi@gmail.com, {mslaney,larry.heck}@microsoft.com This report serves as a user manual for the tools available in the Microsoft Research (MSR) Identity Toolbox. This toolbox contains a collection of Matlab tools and routines that can be used for research and development in speaker recognition. It provides researchers with a test bed for developing new front-end and back-end techniques, allowing replicable evaluation of new advancements. It will also help newcomers in the field by lowering the “barrier to entry”, enabling them to quickly build baseline systems for their experiments. Although the focus of this toolbox is on speaker recognition, it can also be used for other speech related applications such as language, dialect and accent identification. In recent years, the design of robust and effective speaker recognition algorithms has attracted significant research effort from academic and commercial institutions. Speaker recognition has evolved substantially over the past 40 years; from discrete vector quantization (VQ) based systems to adapted Gaussian mixture model (GMM) solutions, and more recently to factor analysis based Eigenvoice (i-vector) frameworks. The Identity Toolbox provides tools that implement both the conventional GMM-UBM and state-of-the-art i-vector based speaker recognition strategies. A speaker recognition system includes two primary components: a front-end and a back-end. The front-end transforms acoustic waveforms into more compact and less redundant representations called acoustic features. Cepstral features are most often used for speaker recognition. It is practical to only retain the high signal-to-noise ratio (SNR) regions of the waveform, therefore there is also a need for a speech activity detector (SAD) in the fr

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值