Blog Archive

Friday, April 6, 2018

Linux Commando: Using sed to extract lines in a text file

Linux Commando: Using sed to extract lines in a text file:

Reference:

https://linuxcommando.blogspot.com/2008/03/using-sed-to-extract-lines-in-text-file.html



Using sed to extract lines in a text file

If you write bash scripts a lot, you are bound to run into a situation where you want to extract some lines from a file. Yesterday, I needed to extract the first line of a file, say named somefile.txt.
$ cat somefile.txt
Line 1
Line 2
Line 3
Line 4


This specific task can be easily done with this:
$ head -1 somefile.txt
Line 1


For a more complicated task, like extract the second to third lines of a file. head is inadequate.

So, let's try extracting lines using sed: the stream editor.

My first attempt uses the p sed command (for print):
$ sed 1p somefile.txt
Line 1
Line 1
Line 2
Line 3
Line 4


Note that it prints the whole file, with the first line printed twice. Why? The default output behavior is to print every line of the input file stream. The explicit 1p command just tells it to print the first line .... again.

To fix it, you need to suppress the default output (using -n), making explicit prints the only way to print to default output.
$ sed -n 1p somefile.txt
Line 1


Alternatively, you can tell sed to delete all but the first line.

$ sed '1!d' somefile.txt
Line 1


'1!d' means if a line is not(!) the first line, delete.

Note that the single quotes are necessary. Otherwise, the !d will bring back the last command you executed that starts with the letter d.


To extract a range of lines, say lines 2 to 4, you can execute either of the following:
  • $ sed -n 2,4p somefile.txt
  • $ sed '2,4!d' somefile.txt
Note that the comma specifies a range (from the line before the comma to the line after). What if the lines you want to extract are not in sequence, say lines 1 to 2, and line 4?
$ sed -n -e 1,2p -e 4p somefile.txt
Line 1
Line 2
Line 4
If you know some different ways to extract lines in a file, please share with us by filling out a comment. P.S. Related articles from this blog:


'via Blog this'

Thursday, April 5, 2018

2018年阿里巴巴的员工工资待遇与级别介绍

2018年阿里巴巴的员工工资待遇与级别介绍

 
reference: 


先看个例子,或许你也曾像他一样纠结BAT的offer:

最近刚通过阿里面试,但基本薪酬也是不升反小降。级别只有P6+,连P7都没有,非常郁闷,打算拒绝算了。小本工作9年了,这算不算loser ?

奇了怪了,阿里系的P6和P7的范围到底是多少?

不过反过来说,阿里系面试还真是有点深度的,通过不易,但拿到这个级别总感觉是否自已混的太一般了。

郁闷。

这样的纠结实在太常见了,都是工作好几年的老程序员了,好不容易动心跳个槽,猎头开始保证得好好的,怎么拿到offer的薪酬却不尽如人意?是自己能力不够,还是被HR/猎头忽悠?

专心做技术的大都是心思单纯之人,却最容易吃亏,知己知彼方可百战不殆,看看对方的级别和待遇,谋定而后动,才能跳得更远,走得更稳。

1、阿里内部的常见级别和定义

P序列=技术岗  M序列=管理岗   (注:样本有限,以下全部数据仅供参考!)
2018年阿里巴巴的员工工资待遇与级别介绍


  • 阿里的非管理岗分为10级;
  • 其中P6、P7、P8需求量最大,也是阿里占比最大的级别。

前面例子中那位郁闷的同学拿到了P6+的offer,正处于最庞大但又最尴尬的级别中段,至于为什么差一点儿没拿到P7,难道是HR在省招聘费?

2017.1更新

P7是分水岭,P6晋升到P7有一定难度;P7再往上走更难;
关于薪酬,阿里的薪酬现金部分,和百度相比变化不大,现金部分与行业相比没优势;
关于股票期权,上市前,P6给期权(P6-2000,P7-3000);上市后,P6几乎不给了,P7的股票也降了;

2、阿里的级别对应薪资

2018年阿里巴巴的员工工资待遇与级别介绍
2018年阿里巴巴的员工工资待遇与级别介绍

  • 阿里薪资结构:一般是12+1+3=16薪
  • 年底的奖金为0-6个月薪资,90%人可拿到3个月
  • 除了薪水,股票也是重要的收入之一,阿里的股票分年限行权,一般4年拿完

说到股票,顺便普及下常识。股票是公司用来奖励员工忠诚度的,所以阿里分年限行权,要离职套现得准备好充足的现金。因为当月薪水和归属股票是一起算作当月个人收入的,所以归属时通常要缴纳高达45%的个税,然后得到的可能还是限制性股票,还不能马上卖呢。等到可以出售的时候,还得缴纳20%股票增值部分的个人所得税。

同时,你必须先缴税,才能归属,缴税还必须用现金,不能sell to cover!So,拿的越多,先拿出的cash就越多,这里面的流动性风险你自己权衡吧。

2016.3.28更新:
3、阿里的员工福利

380套公寓,6折卖员工

前不久,各大媒体报道称,阿里巴巴集团创始人马云与绿城集团董事长宋卫平达成合作协议,绿城集团将在杭州阿里总部附近新建380套阿里员工专享公寓。阿里巴巴内部把这些公寓亲切的称为“亲橙里”。这是继2011年阿里巴巴集团向员工推出30亿元“ihome”无息置业贷款计划后。阿里巴巴集团给员工献上的最新福利。

据了解,目前同样地段的房子目前售价在16000元/平米,而阿里的福利房均价为10200元/平米,相当于市场价的6折。且新房距离阿里的新园区仅有步行5分钟的距离。能买到这样房子的员工要不要这么幸福?

马云表示:“有些东西我们跟其他公司不一样,我反对有大巴车班车上下班,为什么,不是买不起。员工如果没有车,那去挤地铁、去挤公交车、去骑自行车,保证自己上班不迟到,所有的公司、所有的优秀员工都经历过这一点。我告诉大家,即使有班车,迟到的人会更多,放下工作的人会有更多,我们不是在乎加班这点工作,我们在乎的是你是否在乎你的工作,如果你在乎、热爱你的工作,你会早起。”


结语

各个公司头衔名字都不一样,级别的数目也不一样;有些扁平,有些很多level慢慢升;有些薪水范围严格跟级别挂钩,有些薪水和级别并没有绝对对应的关系。无论你是向往BAT还是身居其中,把握每年的评级机会/跳槽机会,建立一条上升的职业曲线更为重要。因为,没有变化是一件很可怕的事情。


Friday, March 23, 2018

异常声音检测之kaldi DNN 训练

[转]异常声音检测之kaldi DNN 训练

http://www.cnblogs.com/welen/p/7567418.html



[转]异常声音检测之kaldi DNN 训练

转自:http://blog.csdn.net/huchad/article/details/52092796
使用kaldi的DNN做音频分类,异常声音检测。
HMM/GMM -》 HMM/DNN

基本上沿用语音识别的思路,有两点注意一下即可。
1. 在训HMM/GMM时,训到monophone即可,使用monophone的HMM与alignment训DNN
2.语言模型的准备,手动构造一个一元的简单模型即可
DNN的主要训练步骤如下:
#Step 1. Pre-train DBN
steps/nnet/pretrain_dbn.sh
 --cmvn-opts "--norm-means=true --norm-vars=true" // 均值方差归一化
--delta-opts "--delta-order=2"// 差分特征
--splice 5  拼接帧数
--nn_depth 3 // 隐含层的个数
--hid-dim 256// 隐层节点数
--rbm-iter 8 // 迭代次数
$train $dir

# Step2:Train the DNN optimizing per-frame cross-entropy
steps/nnet/train.sh 
--feature-transform $feature_transform 
--dbn $dbn  // step1 所得到的dbn
--hid-layers 0  // 表示使用dbn的隐层
--learn-rate 0.008 // 学习率
    ${train}_tr90 ${train}_cv10 data/lang $ali $ali $dir

# step3: generate lattices and alignments for sMBR:
  steps/nnet/align.sh --nj 20 --cmd "$train_cmd"   $train data/lang $srcdir ${srcdir}_ali 
  steps/nnet/make_denlats.sh --nj 20 --cmd "$decode_cmd" --config conf/decode_dnn.config --acwt $acwt \
    $train data/lang $srcdir ${srcdir}_denlats 

#step4:Re-train the DNN by  iterations of sMBR
steps/nnet/train_mpe.sh 
--cmd "$cuda_cmd" --num-iters 6 --acwt $acwt --do-smbr true \
    $train data/lang $srcdir ${srcdir}_ali ${srcdir}_denlats $dir
'via Blog this'

Monday, March 19, 2018

Will Trump abolish the H1B visa?



Sunitha Ganeshan Ray
The Office of the President of the US is one of the most powerful offices in the world. There are many things President Trump can do, by the powers vested in him by us, the people of the United States. Abolishing the H1B visa is a long-winded legislative process, which the President can initiate, technically speaking, but largely has an unpredictable outcome. However in the short term, the President can make it very restrictive for H1B workers through Executive Orders for renewals and benefits. What will be the impact of such actions? Unfortunately everything in life cannot be statistically modeled or simulated, but there are some common-sense fait-accompli consequences of a drastic action like abolishing H1B:
  1. The US economy has grown highest from 1950s till 1990s and has become a global superpower because of technology and innovation. Immigration of highly skilled workers has contributed largely to the US economy (US has been the most preferred destination for tech workers - principle: excellence breeds excellence). Tech startups and companies in the US have become worldwide successes, and that in turn attracts brighter minds to immigrate here. They have not only contributed through employment but they have founded companies that have enhanced the livelihood of millions. Cases in point: Elon Musk, Sergey Brin, Shahid Khan, Steve Chen, Jawed Karim, Vinod Khosla, etc. Protectionist laws will only turn away future great minds from creating new products, innovations and technology breakthroughs that is key to pushing the country forward.
  2. H1B visa holders constitute approximately 1 million workers (less than 0.3% of our population), who, research has pointed out, contribute positively to our GDP, pay into our tax system, medicare / medicaid, and create highly educated future generation (Gen 0 or 1). The economic impact of abolishing will be extreme: there are few highly skilled American tech workers, and they will now come at a premium (all things remaining constant, that there is no provision made to enhance tech skills for the masses). Small businesses and corporates surviving on thin margins will cease to be profitable and will have to go out of business. Or they will have to move corporate HQs abroad or outsource. If this decision of abolition of H1B was a corporate decision, the statistical comparison of an upside / downside to this extreme action makes it unworthy of any consideration. I daresay there’re bigger problems we face today.
  3. While there are many benefits of H1B visa for the US economy, the H1B system certainly does need reform to ensure higher levels of productivity and reduce misuse. Some are detailed below;
    1. Vet credentials and achievements of highly skilled workers, and the gaps that they fill, before granting H1Bs in the first place, so we know the best and brightest are coming to the US.
    2. Immigration: Today the US allows many different routes for immigration such as family, investment, diversity and highly skilled workers (H1B). H1B visas are “dual-intent” visas: the holders can apply for Permanent Residence. If highly skilled tech workers is what is targeted, why restrict country-wise? Let all nationalities compete evenly on the basis of SKILLS. Why not make it a level playing field? While we want the best and the ‘cream of the crop’ let the toughest and brightest get in.
    3. Minimum wage: I do believe in free markets. However, in the interest of fewer applications to process on the already overloaded USCIS, adding a minimum threshold of $100,000 or like can ensure senior and skilled workers are prioritized for hiring.
    4. Grant EADs to I-140s, making job-mobility easier so the onus is on the companies to hire the best talent, pay them market rates and look towards increasing overall productivity. If mobility of workforce is ensured, then companies will naturally hire more qualified Americans (benefit: less paperwork). This will also stop companies from holding H1B workers hostage by paying them cheaper due to non-mobility, and the exploitation by consulting and outsourcing companies. What happened to the Republican principles of free enterprise and less-Government anyway?
    5. US Masters candidates: Why not? I agree there are plenty of universities around the world that are excellent. If we are going to hire skilled workers from everywhere, why can’t Masters degree holders from the US get an extra brownie point? Atleast US universities will benefit, and it will contribute to the GDP.
    6. Create ongoing training program for American citizens so they can keep skills up-to-date to compete on a global platform. Perhaps Fed and State Governments can have a skills-upgradation program for unemployed workers, or perhaps some of our spending can be directed towards coal-workers and blue-collar workers who have lost their jobs due to automation, to go to community colleges to train to become technicians and laboratory workers, etc. - you get the idea. How about some positive reinforcement to move forward the American economy?
Most actions can always be reversed, such as immigration rules, industrial waste dumping policies or financial safety provisions. However some repercussions may be permanent and may have lasting impact: such as the reversal of the US from a global superpower into a has-been economy. Good reason to get fully into details and analyze all angles before a severe action like H1B abolition.

kaldi中的Vector和Matrix

Link:

http://blog.csdn.net/u013677156/article/details/79202271



kaldi中的Vector和Matrix
    Vector和Matrix是kaldi中最常用的数据类型之一。语音数据,提取的特征,计算的结果,都保存在Vector或者Matrix之中。按照字面意思,Vector是“向量”,它只有一行数据,是一维的。Matrix是“矩阵”,它有行与列两个维度。kaldi中的Vector和Matrix,可以做许多数学上的操作。比如点加或点乘(每个元素都加上一个数,或者乘以一个数),比如矩阵之间的乘法和矩阵的奇异分解等。kaldi中Vector和Matrix还可以做一些特殊操作,比如对每个元素取对数,对所有元素做softmax等。
一、首先介绍下Vector。
    在matrix/kaldi-vector.h中,定义了三个类:VectorBase、Vector和SubVector。其中,VectorBase是基类(父类),Vector和SubVector是派生类(子类)。VectorBase中的成员函数已经可以完成一个向量类的所有操作了,Vector类只是做了封装,定义了多种形式的构造函数,增加了resize操作等。
    VectorBase类中的数据成员十分简单,就两个成员。一个指针data_指向存放数据的内存,一个整数dim_指示元素的个数。
VectorBase中的函数成员比较多,但基本可以分为两类。一类是基本的、简单的操作。例如SetZero函数,用以设置全部数据为0;例如max函数,返回向量中的最大值。另一类是偏应用的函数或操作。比如,ApplySoftMax函数,提供softmax操作;比如Norm函数,计算范数。

    下面的代码,有利于理解VectorBase的各种性质。注意,为了方面阅读和理解,对源代码做了修改。
  1. template<typename Real>  
  2. class VectorBase {  
  3.   // *******数据成员,data_表示内存地址,dim_表示元素个数*******  
  4.   Real* data_;  
  5.   MatrixIndexT dim_;  
  6.   explicit VectorBase(): data_(NULL), dim_(0) { }  
  7.     
  8.   // **************第一类,比较基础和简单的函数*******************  
  9.   // set类函数,设置全部值为0、特定值或者某种分布的随机值  
  10.   void SetZero();  
  11.   void Set(Real f);  
  12.   void SetRandn();  
  13.   void SetRandUniform();  
  14.   
  15.   // 返回元素个数dim_,返回元素地址data_,返回占用内存大小,重载()操作等  
  16.   inline MatrixIndexT Dim() const { return dim_; }  
  17.   inline Real* Data() { return data_; }  
  18.   inline MatrixIndexT SizeInBytes() const { return (dim_*sizeof(Real)); }  
  19.   inline Real operator() (MatrixIndexT i) const { return *(data_ + i);  }  
  20.   inline Real & operator() (MatrixIndexT i) {   return *(data_ + i);  }  
  21.   Real Max() const;  
  22.   Real Min() const;  
  23.   Real Sum() const;  
  24.   Real SumLog() const;  
  25.     
  26.   // 拷贝向量或者矩阵(全部或者局部,例如一行)的内容,来作为data_  
  27.   void CopyFromVec(const VectorBase<Real> &v);  
  28.   void CopyFromPacked(const PackedMatrix<Real> &M);  
  29.   void CopyRowsFromMat(const MatrixBase<Real> &M);  
  30.   void CopyColsFromMat(const MatrixBase<Real> &M);  
  31.   void CopyRowFromMat(const MatrixBase<Real> &M, MatrixIndexT row);  
  32.   void CopyDiagFromMat(const MatrixBase<Real> &M);  
  33.     
  34.   // **************第二类,偏应用的操作和函数*******************  
  35.   void Add(Real c);      /// data_[i] += c;  
  36.   void Scale(Real c);    /// data_[i] *= c; cblas_Xscal(dim_, c, data_, 1);  
  37.   void ApplyLog();       /// data_[i] = Log(data_[i])  
  38.   void ApplyExp();       /// data_[i] = Exp(data_[i])  
  39.   void ApplyAbs();       /// data_[i] = abs(data_[i])  
  40.   void InvertElements(); /// data_[i] = 1 / data_[i]  
  41.   void ApplyPow(Real power);  // 求指数  
  42.   Real Norm(Real p) const;    // 求p阶范数  
  43.   void MulElements(const VectorBase<Real> &v); //data_[i] *= v.data_[i];  
  44.   void DivElements(const VectorBase<Real> &v); //data_[i] /= v.data_[i];  
  45.   
  46.   //各种形式的矩阵操作,一般调用BLAS,例如 AddVec: *this = *this + alpha * rv   
  47.   void AddVec(const Real alpha, const VectorBase<Real> &v);  
  48.   void AddVec2(const Real alpha, const VectorBase<Real> &v); // rv^2  
  49.   void AddMatVec(...);  //  this <-- beta*this + alpha*M*v.  
  50.   void AddSpVec(...)    //  this <-- beta*this + alpha*M*v.  
  51.   void AddTpVec(...)    //  this <-- beta*this + alpha*M*v.  
  52.   void AddVecVec(...);  //  this <-- alpha * v .* r + beta*this .  
  53.   void AddVecDivVec(...);// this <---- alpha*v/r + beta*this  
  54.   void MulTp(...);      //  *this <-- *this *M  
  55.     
  56.   //使用softmax: \f$ x(i) = exp(x(i)) / \sum_i exp(x(i)) \f$  
  57.   Real ApplySoftMax(){  
  58.     Real max = this->Max(), sum = 0.0;  
  59.     for (MatrixIndexT i = 0; i < dim_; i++)  
  60.       sum += (data_[i] = Exp(data_[i] - max));  
  61.     this->Scale(1.0 / sum);  
  62.     return max + Log(sum);  
  63.   }  
  64.   void Tanh(const VectorBase<Real> &src);  
  65.   void Sigmoid(const VectorBase<Real> &src);  
  66. }; // class VectorBase  
  67.   
  68.   
  69. template<typename Real>  
  70. class Vector: public VectorBase<Real> {  
  71.  public:  
  72.   // 各种构造函数和赋值操作。  
  73.   Vector(): VectorBase<Real>() {}  
  74.   explicit Vector(const MatrixIndexT s, MatrixResizeType resize_type)  
  75.       : VectorBase<Real>() {  Resize(s, resize_type);  }  
  76.   Vector(const Vector<Real> &v) : VectorBase<Real>()  {   
  77.     Resize(v.Dim(), kUndefined);  
  78.     this->CopyFromVec(v);  }  
  79.   explicit Vector(const VectorBase<Real> &v) : VectorBase<Real>() {  
  80.     Resize(v.Dim(), kUndefined);  
  81.     this->CopyFromVec(v);  }  
  82.   Vector<Real> &operator = (const Vector<Real> &other) {  
  83.     Resize(other.Dim(), kUndefined);  
  84.     this->CopyFromVec(other);  
  85.     return *this; }  
  86.   
  87.   // 新增的Swap、Resize和RemoveElement操作  
  88.   void Swap(Vector<Real> *other);  
  89.   void Resize(MatrixIndexT length, MatrixResizeType resize_type = kSetZero);  
  90.   void RemoveElement(MatrixIndexT i);  
  91.   
  92.  private:  
  93.   void Init(const MatrixIndexT dim);  
  94.   void Destroy();  
  95. };  
  96.   
  97. template<typename Real>  
  98. class SubVector : public VectorBase<Real> {  
  99.  public:  
  100.   //SubVector不分配内存,它使用其他VectorBase的数据,可以看作是“引用”。  
  101.   // 下面是各种版本的构造函数。  
  102.   SubVector(const VectorBase<Real> &t, const MatrixIndexT origin,  
  103.             const MatrixIndexT length) : VectorBase<Real>() {  
  104.      VectorBase<Real>::data_ = const_cast<Real*> (t.Data()+origin);  
  105.     VectorBase<Real>::dim_   = length;  
  106.   }  
  107.   SubVector(const PackedMatrix<Real> &M) {  
  108.     VectorBase<Real>::data_ = const_cast<Real*> (M.Data());  
  109.     VectorBase<Real>::dim_   = (M.NumRows()*(M.NumRows()+1))/2;  
  110.   }  
  111.   SubVector(const SubVector &other) : VectorBase<Real> () {// Copy constructor  
  112.     VectorBase<Real>::data_ = other.data_;  
  113.     VectorBase<Real>::dim_ = other.dim_;  
  114.   }  
  115.   SubVector(Real *data, MatrixIndexT length) : VectorBase<Real> () {  
  116.     VectorBase<Real>::data_ = data;  
  117.     VectorBase<Real>::dim_   = length;  
  118.   }  
  119.   SubVector(const MatrixBase<Real> &matrix, MatrixIndexT row) {  
  120.     VectorBase<Real>::data_ = const_cast<Real*>(matrix.RowData(row));  
  121.     VectorBase<Real>::dim_   = matrix.NumCols();  
  122.   }  
  123.   ~SubVector() {}  ///< Destructor (does nothing; no pointers are owned here).  
  124.   
  125.  private:  
  126.   /// Disallow assignment operator.  
  127.   SubVector & operator = (const SubVector &other) {}  
  128. };  

 通过上面的代码,我们可以看出,Vector对VectorBase并未做太多的扩展,它们的功能基本一样。SubVector可以看作一种“引用”,它自身并不分配内存保存数据,而是指向了其他的对象中的数据。


二、简单介绍下Matrix。
    跟Vector类似,在在matrix/kaldi-matrix.h中,定义了三个类:MatrixBase、Matrix和SubMatrix。MatrixBase是基类,另外两个是派生类。MatrixBase已经实现了非常多的方法。Matrix只是在基类的基础上,加了少数几个函数,比如Swap和RemoveRow等,这点跟Vector与VectorBase的关系一样。
    MatrixBase中,数据成员并不多,大部分也容易理解。比如,整数num_rows_和num_cols_表示矩阵的行数和列数,指针data_指向保存数据的内存地址。这里有另外一个整型变量stride_需要注意。stride_保存的是正真的一行的个数。这里的意思是,一个矩阵,一行可能可以存放许多数据(stride_个),但可以不放满,只放num_cols_个。这时,一部分空间是浪费的。当然,一般部分情况下,num_cols_和stride_是一致的。
    在矩阵上面的操作要比向量上的操作多,所以Matrix中的成员函数比Vector中的多很多。
  1. template<typename Real>  
  2. class MatrixBase {  
  3.   //***************数据成员********************  
  4.   Real*   data_;             // data memory area  
  5.   MatrixIndexT  num_cols_;   // < Number of columns  
  6.   MatrixIndexT  num_rows_;   // < Number of rows  
  7.   MatrixIndexT  stride_;     // True number of columns   
  8.     
  9.   // 基本操作函数  
  10.   inline MatrixIndexT NumRows() const { return num_rows_; }  
  11.   inline MatrixIndexT NumCols() const { return num_cols_; }  
  12.   inline MatrixIndexT Stride() const {  return stride_; }  
  13.   inline Real* Data() const { return data_;  }  
  14.   inline Real* RowData(MatrixIndexT i) { return data_ + i * stride_;  }  
  15.   inline Real&  operator() ( r,  c) {return *(data_ + r * stride_ + c);  }  
  16.   size_t SizeInBytes() const {return num_rows_ * stride_ * sizeof(Real);}  
  17.   Real &Index (MatrixIndexT r, MatrixIndexT c) {  return (*this)(r, c); }  
  18.   
  19.   // set、max、min等函数,省略若干  
  20.   void SetZero();  
  21.   void Set(Real);  
  22.   Real Sum() const;  
  23.   Real Max() const;  
  24.   Real Min() const;  
  25.   bool IsZero(Real cutoff = 1.0e-05) const;  
  26.   
  27.   //Copy、SubVector、SubMatrix类函数,很多版本  
  28.   void CopyFromMat(const CompressedMatrix &M);  
  29.   void CopyRowsFromVec(const VectorBase<Real> &v);  
  30.   void CopyDiagFromVec(const VectorBase<Real> &v);  
  31.   inline SubVector<Real> Row(MatrixIndexT i);  
  32.   inline SubMatrix<Real> Range(...);  
  33.   
  34.   // 一些加减乘除操作,其他应用操作  
  35.   void MulElements(const MatrixBase<Real> &A);  
  36.   void DivElements(const MatrixBase<Real> &A);  
  37.   void Scale(Real alpha);  
  38.   void Max(const MatrixBase<Real> &A);  
  39.   void Min(const MatrixBase<Real> &A);  
  40.   void MulColsVec(const VectorBase<Real> &scale);  
  41.   void MulRowsVec(const VectorBase<Real> &scale);  
  42.   void Add(const Real alpha);  
  43.   void ApplyFloor(Real floor_val);  
  44.   void ApplyCeiling(Real ceiling_val);  
  45.   void ApplyLog();  
  46.   void ApplyExp();  
  47.   Real ApplySoftMax();  
  48.   void Sigmoid(const MatrixBase<Real> &src);  
  49.   
  50.   // 求正定矩阵、求逆;转置;特征分解;奇异值分解;矩阵运算  
  51.   Real LogDet(Real *det_sign = NULL) const;  
  52.   void Invert(Real *log_det = NULL, Real *det_sign = NULL,  
  53.               bool inverse_needed = true);  
  54.   void Transpose();  
  55.   void Eig(MatrixBase<Real> *P,  
  56.            VectorBase<Real> *eigs_real,  
  57.            VectorBase<Real> *eigs_imag) const;  
  58.   void Svd(VectorBase<Real> *s, MatrixBase<Real> *U,  
  59.            MatrixBase<Real> *Vt) const;  
  60.   void AddVecVec(...) //*this += alpha * a * b^T  
  61.   void AddMat(...) //*this += alpha * M  
  62.   void AddMatMatMat(...) //this <-- beta*this + alpha*A*B*C.  
  63.   void AddTpTp(...) //this <-- beta*this + alpha*A*B.  
  64. };  


'via Blog this'