예제 #1
0
파일: api.cpp 프로젝트: blasern/dplyr
DataFrameJoinVisitors::DataFrameJoinVisitors(const DataFrame& left_, const DataFrame& right_, const SymbolVector& names_left, const SymbolVector& names_right, bool warn_, bool na_match) :
  left(left_), right(right_),
  visitor_names_left(names_left),
  visitor_names_right(names_right),
  visitors(names_left.size()),
  warn(warn_)
{
  IntegerVector indices_left  = names_left.match_in_table(RCPP_GET_NAMES(left));
  IntegerVector indices_right = names_right.match_in_table(RCPP_GET_NAMES(right));

  const int nvisitors = indices_left.size();
  if (indices_right.size() != nvisitors) {
    stop("Different size of join column index vectors");
  }

  for (int i = 0; i < nvisitors; i++) {
    const SymbolString& name_left  = names_left[i];
    const SymbolString& name_right = names_right[i];

    if (indices_left[i] == NA_INTEGER) {
      stop("'%s' column not found in lhs, cannot join", name_left.get_utf8_cstring());
    }
    if (indices_right[i] == NA_INTEGER) {
      stop("'%s' column not found in rhs, cannot join", name_right.get_utf8_cstring());
    }

    visitors[i] =
      join_visitor(
        Column(left[indices_left[i] - 1], name_left),
        Column(right[indices_right[i] - 1], name_right),
        warn, na_match
      );
  }
}
예제 #2
0
void VfkStream::Open(const VectorMap<int, String>& fns)
{
	Close();
	charset = CHARSET_ISO8859_2;
	file_groups <<= fns;
	streams.SetCount(file_groups.GetCount());
	for(int i = 0; i < streams.GetCount(); i++)
		if(!streams[i].Open(file_groups[i]))
			throw Exc(NFormat("cannot open file '%s'", file_groups[i]));
	indexfilename = GetTempFileName("vfk");
	if(!indexfile.Open(indexfilename, FileStream::CREATE))
		throw Exc(NFormat("cannot create indexfile '%s'", indexfilename));
	String hdrname = "X_HEADER";
	Table& hdr = tables.Add(hdrname);
	hdr.name = hdr.rawname = hdrname;
	hdr.header = true;
	hdr.row_count = 0;
	ASSERT(hdr.columns.GetCount() == HDR_ID);
	hdr.AddColumn(Column("ID", STRING_V, 30));
	ASSERT(hdr.columns.GetCount() == HDR_ORD);
	hdr.AddColumn(Column("ORD", INT_V));
	ASSERT(hdr.columns.GetCount() == HDR_STR);
	hdr.AddColumn(Column("STR", STRING_V, 1000));
	ASSERT(hdr.columns.GetCount() == HDR_NUM);
	hdr.AddColumn(Column("NUM", DOUBLE_V));
	ASSERT(hdr.columns.GetCount() == HDR_DTM);
	hdr.AddColumn(Column("DTM", TIME_V));
	ASSERT(hdr.columns.GetCount() == HDR_COUNT);
	Scan();
}
예제 #3
0
파일: Matrix.cpp 프로젝트: eyeq/Matrix
Matrix Matrix::Cofactor() const {
	Matrix m(Row(), Column());
	for (int i = 0; i < Row(); i++) {
		for (int j = 0; j < Column(); j++) {
			m(i, j) = Cofactor(i, j);
		}
	}
	return m;
}
예제 #4
0
파일: Matrix.cpp 프로젝트: eyeq/Matrix
Matrix Matrix::Transposed() const {
	Matrix m(Column(), Row());
	for (int i = 0; i < Row(); i++) {
		for (int j = 0; j < Column(); j++) {
			m(j, i) = (*this)(i, j);
		}
	}
	return m;
}
예제 #5
0
WidgetBindings::WidgetBindings(QWidget *parent) :
    WidgetQmfObject(parent)
{
    this->setSectionName(QString("Bindings"));
    summaryColumns.append(Column("msgMatched", "matched", Qt::AlignRight, "N", modeMessages, true));
    summaryColumns.append(Column("msgMatched", "matched / sec", Qt::AlignRight, "N", modeMessageRate, true));

    setRelatedText("Related bindings");
}
예제 #6
0
파일: Matrix.cpp 프로젝트: eyeq/Matrix
Matrix Matrix::MinorRemove(int row, int column) const {
	Matrix m(Row() - 1, Column() - 1);
	for (int i = 0; i < Row() - 1; i++) {
		for (int j = 0; j < Column() - 1; j++) {
			m(i, j) = (*this)(i < row ? i : i+1, j < column ? j : j+1);
		}
	}
	return m;
}
예제 #7
0
파일: tileatlas.cpp 프로젝트: Tikilou/mkxp
static ColumnList calcSrcCols(int tilesetH)
{
	ColumnList cols;

	cols << Column(0, 0, tilesetH);
	cols << Column(tsLaneW, 0, tilesetH);

	return cols;
}
예제 #8
0
파일: tileatlas.cpp 프로젝트: Lobomon/mkxp
static ColumnVec calcSrcCols(int tilesetH)
{
	ColumnVec cols;
	cols.reserve(2);

	cols.push_back(Column(0, 0, tilesetH));
	cols.push_back(Column(tsLaneW, 0, tilesetH));

	return cols;
}
void
RotationMatrix2<T>::Fixup( )
{
    Vector2<T> v0 = Column( 0 );
    Vector2<T> v1 = Column( 1 );
    v0.Normalize( );
    v1 -= (v0 * v1) * v0;
    v1.Normalize( );
    m_matrix.Set( v0, v1 );
}
예제 #10
0
void
RotationMatrix3<T>::Fixup( )
{
    Vector3<T> v0 = Column( 0 );
    Vector3<T> v1 = Column( 1 );
    Vector3<T> v2 = Column( 2 );
    v0.Normalize( );
    v1 -= (v0 * v1) * v0;
    v1.Normalize( );
    v2 -= (v0 * v2) * v0  +  (v1 * v2) * v2;
    v2.Normalize( );
    m_matrix.Set( v0, v1, v2 );
}
예제 #11
0
파일: NdbInfo.cpp 프로젝트: carrotli/ansql
bool NdbInfo::load_hardcoded_tables(void)
{
  {
    Table tabs("tables", 0);
    if (!tabs.addColumn(Column("table_id", 0, Column::Number)) ||
        !tabs.addColumn(Column("table_name", 1, Column::String)) ||
        !tabs.addColumn(Column("comment", 2, Column::String)))
      return false;

    BaseString hash_key = mysql_table_name(tabs.getName());
    if (!m_tables.insert(hash_key.c_str(), tabs))
      return false;
    if (!m_tables.search(hash_key.c_str(), &m_tables_table))
      return false;
  }

  {
    Table cols("columns", 1);
    if (!cols.addColumn(Column("table_id", 0, Column::Number)) ||
        !cols.addColumn(Column("column_id", 1, Column::Number)) ||
        !cols.addColumn(Column("column_name", 2, Column::String)) ||
        !cols.addColumn(Column("column_type", 3, Column::Number)) ||
        !cols.addColumn(Column("comment", 4, Column::String)))
      return false;

    BaseString hash_key = mysql_table_name(cols.getName());
    if (!m_tables.insert(hash_key.c_str(), cols))
      return false;
    if (!m_tables.search(hash_key.c_str(), &m_columns_table))
      return false;
  }

  return true;
}
예제 #12
0
Message ParserMixin::severityMessage(const ParseContextSPtr& context,
                                     const Message::Severity& severity,
                                     const char* message,
                                     const Line& line,
                                     const Column& column)
{
    TokenizerPtr& tokenizer = context->tokenizer;

    Line theLine = line;
    if (theLine == Line(-1))
    {
        theLine = tokenizer->current()
                ? tokenizer->current()->line()
                : tokenizer->line();
    }

    Column theColumn = column;
    if (theColumn == Column(-1))
    {
        theColumn = tokenizer->current()
                  ? tokenizer->current()->beginColumn()
                  : tokenizer->column();
    }

    return Message(severity, message, context->mSourceId, theLine, theColumn);
}
예제 #13
0
TDbCell* RDbRow::Column(TInt aColIx) const
//
// aCol is now zero-based
// Return a pointer to column aCol in the buffer
// Return 0 if the column is past the end
//
	{
	TInt ix=Column();
	TDbCell* pC;
	if (aColIx<ix)
		{
		ix=0;
		pC=iFirst;
		}
	else
		pC=iCell;
	TDbCell* last=iLast;
	for (;;)
		{
		if (pC>=last)
			break;
		if (ix>=aColIx)
			break;
		pC=pC->Next();
		++ix;
		}
	CONST_CAST(RDbRow*,this)->SetCache(pC,ix);
	return pC<last?pC:0;
	}
예제 #14
0
EditableDenseThreeDimensionalModel::Column
EditableDenseThreeDimensionalModel::getColumn(size_t index) const
{
    QReadLocker locker(&m_lock);
    if (index >= m_data.size()) return Column();
    return expandAndRetrieve(index);
}
예제 #15
0
파일: Creators.hpp 프로젝트: kvahed/codeare
/**
 * @brief    MATLAB-like meshgrid. x and y vectors must be specified z may be specified optionally.
 *
 * @param x  X-Vector
 * @param y  Y-Vector
 * @param z  Z-Vector (default: unused)
 * @return   Mesh grid O (Ny x Nx x Nz x 3) (if z specified) else O (Ny x Nx x 2)<br/>
 */
template <class T> inline static Matrix<T>
meshgrid (const Vector<T>& x, const Vector<T>& y, const Vector<T>& z = Vector<T>(1)) {

	size_t nx = numel(x);
	size_t ny = numel(y);
	size_t nz = numel(z);

	assert (nx > 1);
	assert (ny > 1);

	// Column vectors
	assert (size(x,0) == nx); 
	assert (size(y,0) == ny);
	assert (size(z,0) == nz);

	Matrix<T> res (ny, nx, (nz > 1) ? nz : 2, (nz > 1) ? 3 : 1);
	
	for (size_t i = 0; i < ny * nz; i++) 
		Row    (res, i          , x);
	for (size_t i = 0; i < nx * nz; i++) 
		Column (res, i + nx * nz, y);
	if (nz > 1)
		for (size_t i = 0; i < nz; i++)
			Slice  (res, i +  2 * nz, z[i]);
	
	return res;	

}
예제 #16
0
void Parser::atom() {
    if (tokens[look].type == REGEX_) {
        atoms.push_back(Atom(REG, 0, 0, tokens[look].value, Column()));
        match(REGEX_);
    } else {
        match(LESSTHAN);
        if (tokens[look].type == TOKEN) {
            match(TOKEN);
        } else {
            column();
            cols[col[1]] = col[0];
            atoms.push_back(Atom(COLUMN, 0, 0, col[1], Column()));
        }
        match(GREATETHAN);
    }
}
예제 #17
0
void VDUIListViewW32::AddColumn(const wchar_t *name, int width, int affinity) {
	VDASSERT(affinity >= 0);
	VDASSERT(width >= 0);

	if (VDIsWindowsNT()) {
		LVCOLUMNW lvcw={0};

		lvcw.mask		= LVCF_TEXT | LVCF_WIDTH;
		lvcw.pszText	= (LPWSTR)name;
		lvcw.cx			= width;

		SendMessageW(mhwnd, LVM_INSERTCOLUMNW, mColumns.size(), (LPARAM)&lvcw);
	} else {
		LVCOLUMNA lvca={0};
		VDStringA nameA(VDTextWToA(name));

		lvca.mask		= LVCF_TEXT | LVCF_WIDTH;
		lvca.pszText	= (LPSTR)nameA.c_str();
		lvca.cx			= width;

		SendMessageA(mhwnd, LVM_INSERTCOLUMNA, mColumns.size(), (LPARAM)&lvca);
	}

	mColumns.push_back(Column());
	Column& col = mColumns.back();

	col.mWidth		= width;
	col.mAffinity	= affinity;

	mTotalWidth		+= width;
	mTotalAffinity	+= affinity;

	OnResize();
}
예제 #18
0
EXPORT_C TAny* RDbRow::SetColumnWidthL(TDbColNo aColNo,TInt aWidth)
// set the width for column aCol to Width
// add extra NULL columns to buffer as required
// return pointer to data for that column
	{
	__ASSERT(aColNo>0);
	TDbCell* pC=Column(--aColNo);
	if (pC==0)
		{		// add extra NULL columns to buffer
		if (aWidth==0)
			return 0;	// setting to NULL, don't bother padding
		TInt cFill=(aColNo-iColumn)*sizeof(TInt);
		ExtendL(cFill+TDbCell::Size(aWidth));
		pC=iCell;
		Mem::FillZ(pC,cFill);
		pC=PtrAdd(pC,cFill);		// set cache
		SetCache(pC,aColNo);
		}
	else
		{
		TInt adjust=TDbCell::Size(aWidth)-pC->Size();	// how much to add
		if (adjust!=0)
			{
			ExtendL(adjust);
			pC=iCell;		// may have moved in extension
			TDbCell* pNext=pC->Next();
			TDbCell* pAdjust=PtrAdd(pNext,adjust);
			Mem::Move(pAdjust,pNext,Diff(pAdjust,iLast));
			}
		}
	pC->SetLength(aWidth);
	return pC->Data();
	}
예제 #19
0
/**
 * Write the error out to the stream.
 *
 * @param out -- The output stream to write the set to.
 */
void Error_::Write_(Printer& out) const
{
    out << "(error \"" 
        << this->id << "\"";

    if (0 != Row())
    {
        out << " " << Row();
    }

    if (0 != Column())
    {
        out << " " << Column();
    }
       
    out << ")";
}
예제 #20
0
파일: AQL.cpp 프로젝트: blacider/compiler
Column View::getColumn(string id) {
    for (int i = 0; i < columns.size(); i++) {
        if (columns[i].name == id) {
            return columns[i];
        }
    }
    return Column("");
}
예제 #21
0
// Return a copy of the column data specified by its index starting at 0
// (use the Column copy-constructor)
Column Statement::getColumn(const int aIndex)
{
    checkRow();
    checkIndex(aIndex);

    // Share the Statement Object handle with the new Column created
    return Column(mStmtPtr, aIndex);
}
예제 #22
0
// Return a copy of the column data specified by its column name starting at 0
// (use the Column copy-constructor)
Column  Statement::getColumn(const char* apName)
{
    checkRow();
    const int index = getColumnIndex(apName);

    // Share the Statement Object handle with the new Column created
    return Column(mStmtPtr, index);
}
예제 #23
0
파일: person.cpp 프로젝트: szchkt/leaklog
 PersonColumns() {
     columns << Column("uuid", "UUID PRIMARY KEY");
     columns << Column("customer_uuid", "UUID");
     columns << Column("name", "TEXT");
     columns << Column("mail", "TEXT");
     columns << Column("phone", "TEXT");
     columns << Column("hidden", "INTEGER NOT NULL DEFAULT 0");
     columns << Column("date_updated", "TEXT");
     columns << Column("updated_by", "TEXT");
 }
예제 #24
0
 CompressorColumns() {
     columns << Column("uuid", "UUID PRIMARY KEY");
     columns << Column("circuit_uuid", "UUID");
     columns << Column("name", "TEXT");
     columns << Column("manufacturer", "TEXT");
     columns << Column("type", "TEXT");
     columns << Column("sn", "TEXT");
     columns << Column("date_updated", "TEXT");
     columns << Column("updated_by", "TEXT");
 }
예제 #25
0
size_t CColumnSet::AllocSize() const
{
	size_t nSize = 0;

	for (size_t i = 0; i < Count(); ++i)
		nSize += Column(i).AllocSize();

	return nSize;
}
예제 #26
0
WidgetSessions::WidgetSessions(QWidget *parent) :
    WidgetQmfObject(parent)
{
    this->setSectionName(QString("Sessions"));
    summaryColumns.append(Column("unackedMessages", "unAcked", Qt::AlignRight, "N", modeMessages, true));
    summaryColumns.append(Column("TxnCount", "transactions", Qt::AlignRight, "N", modeMessages, true, QColor(Qt::green)));
    summaryColumns.append(Column("TxnStarts", "starts", Qt::AlignRight, "N", modeMessages));
    summaryColumns.append(Column("TxnCommits", "commits", Qt::AlignRight, "N", modeMessages));
    summaryColumns.append(Column("TxnRejects", "rejects", Qt::AlignRight, "N", modeMessages));

    summaryColumns.append(Column("unackedMessages", "unAcked", Qt::AlignRight, "N", modeMessageRate, true));
    summaryColumns.append(Column("TxnCount", "transactions", Qt::AlignRight, "N", modeMessageRate, true, QColor(Qt::green)));
    summaryColumns.append(Column("TxnStarts", "starts", Qt::AlignRight, "N", modeMessageRate));
    summaryColumns.append(Column("TxnCommits", "commits", Qt::AlignRight, "N", modeMessageRate));
    summaryColumns.append(Column("TxnRejects", "rejects", Qt::AlignRight, "N", modeMessageRate));

    setRelatedText("Related sessions");
}
예제 #27
0
void PrintComputersMove (MOVE computersMove, STRING computersName)
{
	int position = Unhasher_Index(computersMove);
	int direction = Unhasher_Direction(computersMove);

	printf ("%s moves the piece %c%d %s\n", computersName, \
	        Column(position)+ROW_START, BOARD_ROWS-Row (position), \
	        directions[direction]);
}
예제 #28
0
파일: SEM.hpp 프로젝트: nomissretep/codeare
/**
 * @brief Right hand side operator E (i.e. forward transform) 
 *
 * @param  in      Image
 * @param  sm      Sensitivities
 * @param  nx      Sizes & co.
 * @param  fts     FT operators
 * @return         K-space 
 */
template <class T> inline static Matrix< std::complex<T> >
E (const Matrix< std::complex<T> >& in, const Matrix< std::complex<T> >& sm,
   const std::vector<size_t>& nx, const std::vector<NFFT<T> >& fts) {
	Matrix< std::complex<T> > out (nx[2],nx[1]);
#pragma omp parallel for default (shared)
    for (int j = 0; j < nx[1]; j++)
        Column (out, j, fts[omp_get_thread_num()] * (resize(((nx[0] == 2) ? Slice (sm, j) : Volume (sm, j)),size(in)) * in));
    return out;
}
예제 #29
0
파일: SEM.hpp 프로젝트: nomissretep/codeare
/**
 * @brief Left hand side operator (i.e. inverse transform) 
 *
 * @param  in      K-space
 * @param  sm      Sensitivities 
 * @param  nx      Sizes & co.
 * @param  fts     FT operators
 * @return         Image
 */
template <class T> inline static Matrix< std::complex<T> >
EH (const Matrix< std::complex<T> >& in, const Matrix< std::complex<T> >& sm,
    const std::vector<size_t>& nx, const std::vector<NFFT<T> >& fts) {
	Matrix< std::complex<T> > out = zeros< std::complex<T> > (size(sm));
#pragma omp parallel for default (shared)
	for (int j = 0; j < nx[1]; j++)
        Slice (out, j, fts[omp_get_thread_num()] ->* Column (in,j) * conj(Slice (sm, j)));
 	return sum (out, nx[0]);
}
예제 #30
0
/**
 * @param index Индекс столбца (начиная с 0).
 * @return Столбец с индексом <code>index</code>.
 * @throw OutOfRange Номер столбца за пределами допустимых значений.
 */
inline
Query::Column
Query::Columns::operator[]( const std::size_t index ) const
{
    if ( size() <= index ) {
        OutOfRange const ex("Query::Columns index out of range");
        MSLIBS_SQLITE_THROW( ex );
    }
    return Column( stmtptr_ , index );
}