示例#1
0
文件: Enet.cpp 项目: RandomFeng/ADMM
inline void write_beta_matrix(SpMat &betas, int col, double beta0, SpVec &coef)
{
    betas.insert(0, col) = beta0;

    for(SpVec::InnerIterator iter(coef); iter; ++iter)
    {
        betas.insert(iter.index() + 1, col) = iter.value();
    }
}
示例#2
0
inline void write_beta_matrix(SpMat &betas, int col, double beta0, SpVec &coef, bool startatzero)
{
    
    int add = 0;
    if (!startatzero)
    {
        add = 1;
        betas.insert(0, col) = beta0;
    }
    for(SpVec::InnerIterator iter(coef); iter; ++iter)
    {
        betas.insert(iter.index() + add, col) = iter.value();
    }
}