本文整理汇总了C++中cols函数的典型用法代码示例。如果您正苦于以下问题:C++ cols函数的具体用法?C++ cols怎么用?C++ cols使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cols函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: createRawTable
std::shared_ptr<AbstractTable> createRawTable() {
metadata_vec_t cols({ *ColumnMetadata::metadataFromString("INTEGER", "col1"),
*ColumnMetadata::metadataFromString("STRING", "col2"),
*ColumnMetadata::metadataFromString("FLOAT", "col3") });
auto main = std::make_shared<RawTable>(cols);
for (size_t i=0; i < 100; ++i) {
hyrise::storage::rawtable::RowHelper rh(cols);
rh.set<hyrise_int_t>(0, i);
rh.set<hyrise_string_t>(1, "MeinNameIstSlimShady" + std::to_string(i));
rh.set<hyrise_float_t>(2, 1.1*i);
unsigned char *data = rh.build();
main->appendRow(data);
free(data);
}
return main;
}
开发者ID:cfrahnow,项目名称:hyrise,代码行数:17,代码来源:ops_select.cpp
示例2: rows
//below fills the table with objects:
void WidgetTable::SetSize(int newrows, int newcols, WidgetTable * mytable)
{
rows(newrows);
cols(newcols);
begin(); // start adding widgets to group
{
for (int r = 0; r<newrows; r++)
{
for (int c = 0; c<newcols; c++)
{
int X, Y, W, H;
find_cell(CONTEXT_TABLE, r, c, X, Y, W, H);
char s[40];
//below decides what is put into table:
//r is row and c is col
if (c != 0 && c != 1 && c != 2 && c != 3) //this used to be ( c & 1) -bitwise comparison
{
// Create the input widgets
//sprintf(s, "%d.%d", r, c);
Fl_Input *in = new Fl_Input(X, Y, W, H);
//in->value(s);
}
else
{
// Create the light buttons
sprintf(s, "%d/%d ", r, c);
My_fl_button *butt = new My_fl_button(X, Y, W, H, strdup(s));
//Fl_Light_Button *butt = new Fl_Light_Button(X, Y, W, H, strdup(s));
butt->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE);
butt->callback(button_cb, (void*)mytable);
//butt->value(((r + c * 2) & 4) ? 1 : 0); //this sets the light on or off for Fl_Light_Button
if (c == 0) butt->label("B LMT");
if (c == 1) butt->label("B STP");
if (c == 2) butt->label("S LMT");
if (c == 3) butt->label("S STP");
butt->x_pos = c;
butt->y_pos = r;
}
}
}
}
end();
}
开发者ID:pytton,项目名称:fluidUI.new,代码行数:46,代码来源:UserInterface.cpp
示例3: isValidSudoku2
bool isValidSudoku2(vector<vector<char> > &board) {//极其巧妙的方法,慢慢消化
// Start typing your C/C++ solution below
// DO NOT write int main() function
vector<vector<bool> > rows(9, vector<bool>(9, false));
vector<vector<bool> > cols(9, vector<bool>(9, false));
vector<vector<bool> > blocks(9, vector<bool>(9, false));
for (int i = 0; i < 9; ++i) {
for (int j = 0; j < 9; ++j) {
if (board[i][j] == '.') continue;
int c = board[i][j] - '1';
if (rows[i][c] || cols[j][c] || blocks[i - i % 3 + j / 3][c])
return false;
rows[i][c] = cols[j][c] = blocks[i - i % 3 + j / 3][c] = true;
}
}
return true;
}
开发者ID:alexchao2012,项目名称:Leetcode,代码行数:18,代码来源:回朔-Valid+Sudoku.cpp
示例4: atRightEdge
bool CatalogView::atRightEdge(int current)
{
if (col(current) >= cols() - 1)
{
return true;
}
++current;
if (current >= visibleSubItems().size())
{
return true;
}
if (visibleSubItems().at(current)->data())
{
return false;
}
return true;
}
开发者ID:peter-x,项目名称:booxsdk,代码行数:18,代码来源:catalog_view.cpp
示例5: bch2bps
int /* entry point */
bch2bps(projUV a, projUV b, projUV **c, int nu, int nv) {
projUV **d;
int i;
if (nu < 1 || nv < 1 || !(d = (projUV **)vector2(nu, nv, sizeof(projUV))))
return 0;
/* do rows to power series */
for (i = 0; i < nu; ++i) {
rows(c[i], d[i], nv);
rowshft(a.v, b.v, d[i], nv);
}
/* do columns to power series */
cols(d, c, nu, nv);
colshft(a.u, b.u, c, nu, nv);
freev2((void **) d, nu);
return 1;
}
开发者ID:fb,项目名称:jasper-xcsoar,代码行数:18,代码来源:bch2bps.c
示例6: sqlite_callback
//+-------------------------------------------------------------------------------
//|
//| NAME:
//| sqlite_callback()
//|
//| PARAMETERS:
//| data (I) - The output data structure where query data returned from
//| the SQLite database will be written.
//| argc (I) - The number of rows returned from the database.
//| argv (I) - The actual contents of the rows returned from the database.
//| azColName (I) - The list of column names returned from the database.
//|
//| DESCRIPTION:
//| This is a callback method used by the query function to parse the results
//| of the query and store them in a resultset object.
//|
//| RETURNS:
//| 0 for now because this is what sqlite3_exec() requires.
//|
//+-------------------------------------------------------------------------------
int sqlite_callback(void* data, int argc, char **argv, char **azColName)
{
int i;
sqllite_resultset_t* rs = (sqllite_resultset_t*)data;
//QVector<sqllite_col_t> cols(argc);
sqllite_col_t col;
QVector<sqllite_col_t> cols(10);
for(i=0; i<argc; i++)
{
col.value = argv[i] ? argv[i] : "NULL";
col.name = azColName[i] ? azColName[i] : "NULL";
cols[i] = col;
}
rs->rows.append(cols);
return 0;
}
开发者ID:bradfordelliott,项目名称:shorte,代码行数:38,代码来源:settingsmanager.cpp
示例7: maxrowsum_Norm
float FloatMatrix::maxrowsum_Norm()
{
float res = 0.0;
float max = res;
for(unsigned long int i = 0; i< rows();i++)
{
res = 0.0;
for(unsigned long int j = 0; j<cols();j++)
{
res+=fabs((*this)(i,j));
}
if(res>max)
{
max = res;
}
}
return max;
}
开发者ID:mejwaller,项目名称:numanal,代码行数:18,代码来源:Matrix1.cpp
示例8: cols
void CrsMatrixWrapper<ST>::add(const std::vector<LO>& rowIdx,
const std::vector<ST>& array)
{
const size_t emSize = rowIdx.size();
std::vector<LO> cols(emSize);
std::vector<ST> vals(emSize);
for (size_t i = 0; i < emSize; i++) {
const LO row = rowIdx[i];
if (row <= maxLocalRow) {
for (int j = 0; j < emSize; j++) {
const LO col = rowIdx[j];
cols[j] = col;
const size_t srcIdx = j * emSize + i;
vals[j] = array[srcIdx];
}
mat.sumIntoLocalValues(row, cols, vals);
}
}
}
开发者ID:svn2github,项目名称:Escript,代码行数:19,代码来源:CrsMatrixWrapper.cpp
示例9: copy_matrix
/// Copy matrix from builtin backend.
static boost::shared_ptr<matrix>
copy_matrix(boost::shared_ptr< typename builtin<real>::matrix > A, const params&)
{
const typename builtin<real>::matrix &a = *A;
BOOST_AUTO(Aptr, a.ptr_data());
BOOST_AUTO(Acol, a.col_data());
BOOST_AUTO(Aval, a.val_data());
return boost::shared_ptr<matrix>(
new matrix(
rows(*A), cols(*A), nonzeros(*A),
const_cast<index_type*>(Aptr),
const_cast<index_type*>(Acol),
const_cast<value_type*>(Aval)
),
hold_host(A)
);
}
开发者ID:HongLi15,项目名称:amgcl,代码行数:20,代码来源:eigen.hpp
示例10: cols
void Matrix::deleteSelectedColumns()
{
QVarLengthArray<int> cols(1);
int n=0;
for (int i=0; i<numCols(); i++)
{
if (isColumnSelected(i, true))
{
n++;
cols.resize(n);
cols[n-1]= i;
}
}
// columns need to be removed from right to left
for(int i=cols.count()-1; i>=0; i--)
d_table->removeColumn(cols[i]);
emit modifiedWindow(this);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:19,代码来源:Matrix.cpp
示例11: space_ini
Space * space_ini()
{
int i;
Space *s;
s = (Space *) malloc(sizeof(Space));
if (!s)
return NULL;
sId(s) = -1;
sDesc(s) = NULL;
lDesc(s) = NULL;
light(s) = FALSE;
isLocked(s) = FALSE;
map(s) = NULL;
rows(s) = -1;
cols(s) = -1;
numdoors(s) = -1;
doors(s) = NULL;
return s;
}
开发者ID:RodrigoDePool,项目名称:ProyProg,代码行数:19,代码来源:space.c
示例12: join
/**
Reference implementation with negation:
T1 = join(T, T) by group_cols
T2 = { (t1,t2) in T1 | t1[col] > t2[col] }
T3 = { t1 | (t1,t2) in T2 }
T4 = T \ T3
The point of this reference implementation is to show
that the minimum requires negation (set difference).
This is relevant for fixed point computations.
*/
virtual table_base * reference_implementation(const table_base & t) {
relation_manager & manager = t.get_manager();
scoped_ptr<table_join_fn> join_fn = manager.mk_join_fn(t, t, m_group_by_cols, m_group_by_cols);
scoped_rel<table_base> join_table = (*join_fn)(t, t);
table_base::iterator join_table_it = join_table->begin();
table_base::iterator join_table_end = join_table->end();
table_fact row;
table_element i, j;
for (; join_table_it != join_table_end; ++join_table_it) {
join_table_it->get_fact(row);
i = row[m_col];
j = row[t.num_columns() + m_col];
if (i > j) {
continue;
}
join_table->remove_fact(row);
}
unsigned_vector cols(t.num_columns());
for (unsigned k = 0; k < cols.size(); ++k) {
cols[k] = cols.size() + k;
SASSERT(cols[k] < join_table->num_columns());
}
scoped_ptr<table_transformer_fn> project_fn = manager.mk_project_fn(*join_table, cols);
scoped_rel<table_base> gt_table = (*project_fn)(*join_table);
for (unsigned k = 0; k < cols.size(); ++k) {
cols[k] = k;
SASSERT(cols[k] < t.num_columns());
SASSERT(cols[k] < gt_table->num_columns());
}
table_base * result = t.clone();
scoped_ptr<table_intersection_filter_fn> diff_fn = manager.mk_filter_by_negation_fn(*result, *gt_table, cols, cols);
(*diff_fn)(*result, *gt_table);
return result;
}
开发者ID:killbug2004,项目名称:Snippets,代码行数:55,代码来源:dl_base.cpp
示例13: adjust
void Box<DATA>::include
(
const DATA& ar_DataVector
)
{
// enlarge bbox if necessary
adjust(max(rows(),ar_DataVector.rows()),max(cols(),ar_DataVector.cols()));
typename DATA::value_type value;
for (int r=0;r<ar_DataVector.rows();++r)
{
for (int c=0;c<ar_DataVector.cols();++c)
{
value = ar_DataVector(r,c);
if (lowerBound(r,c) > value) { lowerBound(r,c) = value; }
if (upperBound(r,c) < value) { upperBound(r,c) = value; }
} // for c
} // for r
}
开发者ID:liuyepku,项目名称:TemporalPattern,代码行数:19,代码来源:Box.cpp
示例14: WrongSize2D
void Matrix<T>::submatrix(int sr, int sc, Matrix<T> &a)
{
int rwz,coz,i,j;
if ( this->rows() % a.rows() != 0 || this->cols() % a.cols() != 0 || this->rows() < a.rows() || this->cols() < a.cols() )
{
#ifdef USE_EXCEPTION
throw WrongSize2D(this->rows(),this->cols(),a.rows(),a.cols()) ;
#else
Error error("Matrix<T>::submatrix");
error << "Matrix and submatrix incommensurate" ;
error.fatal() ;
#endif
}
if ( sr >= this->rows()/a.rows() || sr < 0 || sc >= this->cols()/a.cols() || sc < 0 )
{
#ifdef USE_EXCEPTION
throw OutOfBound2D(sr,sc,0,this->rows()/a.rows()-1,0,this->cols()/a.cols()-1) ;
#else
Error error("Matrix<T>::submatrix");
error << "Submatrix location out of bounds.\nrowblock " << sr << ", " << rows()/a.rows() << " colblock " << sc << ", " << a.cols() << endl ;
error.fatal() ;
#endif
}
rwz = sr*a.rows();
coz = sc*a.cols();
#ifdef COLUMN_ORDER
for ( i = a.rows()-1; i >= 0; --i )
for(j=a.cols()-1;j>=0;--j)
this->elem(i+rwz,j+coz) = a(i,j) ;
#else
T *ptr, *aptr ;
aptr = a.m - 1;
for ( i = a.rows()-1; i >= 0; --i )
{
ptr = &m[(i+rwz)*cols()+coz]-1 ;
for ( j = a.cols(); j > 0; --j)
*(++ptr) = *(++aptr) ;
}
#endif
}
开发者ID:mikanradojevic,项目名称:sdkpub,代码行数:43,代码来源:matrix.cpp
示例15: space_ini
Space * space_ini(){
int i;
Space *s;
s = (Space *) malloc (sizeof(Space));
if(!s)
return NULL;
sId(s) = -1;
for(i = 0; i < 8; i++)
neighbour(s)[i] = -1;
sDesc(s) = NULL;
lDesc(s) = NULL;
light(s) = FALSE;
isLocked(s) = FALSE;
map(s) = NULL;
rows(s) = -1;
cols(s) = -1;
return s;
}
开发者ID:RodrigoDePool,项目名称:ProyProg,代码行数:19,代码来源:space.c
示例16: ullmann
bool ullmann(const Graph& g1, const Graph& g2,
VertexLabeling& vertex_labeling, EdgeLabeling& edge_labeling, BackInsertionSequence& F) {
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
typedef ::boost::numeric::ublas::matrix<bool> matrix_t;
size_t rows(num_vertices(g1));
size_t cols(num_vertices(g2));
matrix_t M(rows,cols);
// initialize the matrix:
for (int i=0; i<rows; ++i)
for (int j=0; j<cols; ++j)
if(vertex_labeling(i,j)) M(i,j)=1;
size_t i(0);
try {
detail::backtrack(g1,g2,i,M,F,rows,cols,edge_labeling);
} catch(ullmann_throw) {
return true;
}
return false;
}
开发者ID:alvatar,项目名称:snippets,代码行数:19,代码来源:boost_ullmann.hpp
示例17: isValidSudoku
bool isValidSudoku(vector<vector<char>> &board) {
vector<vector<bool>> rows(9, vector<bool>(9, false));
vector<vector<bool>> cols(9, vector<bool>(9, false));
vector<vector<bool>> cells(9, vector<bool>(9, false));
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
if (board[i][j] != '.') {
int x = board[i][j] - '1';
if (rows[i][x] || cols[j][x] || cells[(j/3)*3+i/3][x]) {
return false;
}
rows[i][x] = true;
cols[j][x] = true;
cells[(j/3)*3+i/3][x] = true;
}
}
}
return true;
}
开发者ID:Amywyc,项目名称:leetcode-1,代码行数:20,代码来源:ValidSudoku.cpp
示例18: main
int main(){
long long n, m; scanf("%lld %lld\n", &n, &m);
std::vector<bool> rows(n + 1, 0);
std::vector<bool> cols(n + 1, 0);
long long takenRows(0), takenCols(0);
long long safe(n * n);
while(m--){
long long r, c; scanf("%lld %lld\n", &r, &c);
if(!rows[r]){rows[r] = 1; ++takenRows; safe -= (n - takenCols);}
if(!cols[c]){cols[c] = 1; ++takenCols; safe -= (n - takenRows);}
printf("%lld ", safe);
}
puts("");
return 0;
}
开发者ID:DionysiosB,项目名称:CodeForces,代码行数:20,代码来源:701B-CellsNotUnderAttack.cpp
示例19: make_frame
void make_frame() const {
at(-1, -1) = 0;
track(-1, -1) = STOP;
for (int row = 0; row < rows(); row++) {
if (local()) {
at(row, -1) = 0;
} else {
at(row, -1) = (row + 1) * gap_penalty();
}
track(row, -1) = ROW_INC;
}
for (int col = 0; col < cols(); col++) {
if (local()) {
at(-1, col) = 0;
} else {
at(-1, col) = (col + 1) * gap_penalty();
}
track(-1, col) = COL_INC;
}
}
开发者ID:npge,项目名称:npge,代码行数:20,代码来源:GeneralAligner.hpp
示例20: row_scroll_position
// Table resized: recalc internal data
// Call this whenever the window is resized.
// Recalculates the scrollbar sizes.
// Makes no assumptions about any pre-initialized data.
//
void Fl_Table::table_resized()
{
table_h = row_scroll_position(rows());
table_w = col_scroll_position(cols());
recalc_dimensions();
// Recalc scrollbar sizes
// Clamp scrollbar value() after a resize.
// Resize scrollbars to enforce a constant trough width after a window resize.
//
{
float vscrolltab = ( table_h == 0 || tih > table_h ) ? 1 : (float)tih / table_h;
float hscrolltab = ( table_w == 0 || tiw > table_w ) ? 1 : (float)tiw / table_w;
vscrollbar->bounds(0, table_h-tih);
vscrollbar->precision(10);
vscrollbar->slider_size(vscrolltab);
vscrollbar->resize(wix+wiw-SCROLLBAR_SIZE, wiy,
SCROLLBAR_SIZE,
wih - ((hscrollbar->visible())?SCROLLBAR_SIZE:0));
vscrollbar->Fl_Valuator::value(vscrollbar->clamp(vscrollbar->value()));
hscrollbar->bounds(0, table_w-tiw);
hscrollbar->precision(10);
hscrollbar->slider_size(hscrolltab);
hscrollbar->resize(wix, wiy+wih-SCROLLBAR_SIZE,
wiw - ((vscrollbar->visible())?SCROLLBAR_SIZE:0),
SCROLLBAR_SIZE);
hscrollbar->Fl_Valuator::value(hscrollbar->clamp(hscrollbar->value()));
}
// Tell FLTK child widgets were resized
Fl_Group::init_sizes();
// Recalc top/bot/left/right
table_scrolled();
// DO *NOT* REDRAW -- LEAVE THIS UP TO THE CALLER
// redraw();
}
开发者ID:benschneider,项目名称:Spyview,代码行数:46,代码来源:Fl_Table.C
注:本文中的cols函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论