Ejemplo n.º 1
0
TridiagonalMatrix<T>&
TridiagonalMatrix<T>::operator=(const TridiagonalMatrix<T>& rhs)
{
	if(rhs.size != 0)
	{
		// create an array of the proper size to hold the matrix
		// Also, copy over the data before deleting the old data
		// to ensure that self-assignment works
		T* newData = new T[getArraySize(rhs.size)];

		// set the data to be a copy of rhs
		const T* const arrayEnd = newData + getArraySize(rhs.size);
		for(T* i = newData, *j = rhs.data; i < arrayEnd; ++i, ++j)
		{
			*i = *j;
		}

		delete[] data;
		data = newData;
	}
	else
	{
		delete[] data;
		data = NULL;
	}
	size = rhs.size;

	return *this;
}
Ejemplo n.º 2
0
void cLibsvmSink::fetchConfig()
{
  cDataSink::fetchConfig();
  
  filename = getStr("filename");
  SMILE_DBG(3,"filename = '%s'",filename);

  lag = getInt("lag");
  SMILE_DBG(3,"lag = %i",lag);

  append = getInt("append");
  if (append) { SMILE_DBG(3,"append to file is enabled"); }

  timestamp = getInt("timestamp");
  if (append) { SMILE_DBG(3,"printing timestamp attribute (index 1) enabled"); }

  instanceBase = getStr("instanceBase");
  SMILE_DBG(3,"instanceBase = '%s'",instanceBase);

  instanceName = getStr("instanceName");
  SMILE_DBG(3,"instanceName = '%s'",instanceName);
  
  int i;
  nClasses = getArraySize("class");
  classname = (char**)calloc(1,sizeof(char*)*nClasses);
  for (i=0; i<nClasses; i++) {
    const char *tmp = getStr_f(myvprint("class[%i]",i));
    if (tmp!=NULL) classname[i] = strdup(tmp);
  }

  if (isSet("targetNumAll")) {
    targetNumAll = getInt("targetNumAll");
  }
  if (isSet("targetStrAll")) {
    if (nClasses <=0) COMP_ERR("cannt have 'targetStrAll' option if no class names have been defined using the 'class' option! (inst '%s')",getInstName());
    targetNumAll = getClassIndex(getStr("targetStrAll"));
  }
  nInst = getArraySize("targetNum");
  if (nInst > 0) {
    target = (int *)calloc(1,sizeof(int)*nInst);
    for (i=0; i<nInst; i++) {
      target[i] = getInt_f(myvprint("targetNum[%i]",i));
      if (target[i] < 0) COMP_ERR("invalid class index %i for instance %i (in 'targetNum' option of instance '%s')",target[i],i,getInstName());
    }
  } else {
    nInst = getArraySize("targetStr");
    if (nInst > 0) {
      if (nClasses <=0) COMP_ERR("cannt have 'targetStr' option if no class names have been defined using the 'class' option! (inst '%s')",getInstName());
      target = (int *)calloc(1,sizeof(int)*nInst);
      for (i=0; i<nInst; i++) {
        target[i] = getClassIndex(getStr_f(myvprint("targetStr[%i]",i)));
        if (target[i] < 0) COMP_ERR("invalid class index %i for instance %i (from class '%s' in 'targetStr' option of instance '%s')",target[i],i,getStr_f(myvprint("targetStr[%i]",i)),getInstName());
      }
    } else { nInst = 0; }
  }

}
/* 
    Print declarations
*/
void print_decl(Decl decl, char* proc_id) {

    int slot;
    slot = getStackSlotNum(proc_id, decl->id);

    // Print based on type
    switch (decl->type) {

        case BOOL_TYPE:
            printf("store %d, r0", slot);
            printf("\n");
            break;
        case INT_TYPE:
            printf("store %d, r0", slot);
            printf("\n");
            break;
        case FLOAT_TYPE:
            printf("store %d, r1", slot);
            printf("\n");
            break;
        case INT_ARRAY_TYPE:{
            int i;
            
            for (i = 0; i < getArraySize(proc_id, decl->id); i++){
                printf("store %d, r0", slot);
                printf("\n");
                slot++;
            }
            break;
        }
        case FLOAT_ARRAY_TYPE:{
            int i;

            for (i = 0; i < getArraySize(proc_id, decl->id); i++){
                printf("store %d, r1", slot);
                printf("\n");
                slot++;
            }   
            break;  
        }
        case BOOL_ARRAY_TYPE:{
            int i;

            for (i = 0; i < getArraySize(proc_id, decl->id); i++){
                printf("store %d, r0", slot);
                printf("\n");
                slot++;
            }
            break;
        }
    }
}
Ejemplo n.º 4
0
  bool UlamType::checkArrayCast(UTI typidx)
  {
    if(isScalar() && m_state.isScalar(typidx))
      return true; //not arrays, ok

    bool bOK = true;
    s32 arraysize = getArraySize();
    s32 varraysize = m_state.getArraySize(typidx);
    if(arraysize != varraysize)
      {
	std::ostringstream msg;
	msg << "Casting different Array sizes: ";
	msg << m_state.getUlamTypeNameBriefByIndex(typidx).c_str();
	msg << " TO " ;
	msg << getUlamTypeNameBrief().c_str();
	MSG(m_state.getFullLocationAsString(m_state.m_locOfNextLineText).c_str(), msg.str().c_str(), ERR);
	bOK = false;
      }
    else
      {
	std::ostringstream msg;
	msg << "Casting (nonScalar) Array: ";
	msg << m_state.getUlamTypeNameBriefByIndex(typidx).c_str();
	msg << " TO " ;
	msg << getUlamTypeNameBrief().c_str();
	MSG(m_state.getFullLocationAsString(m_state.m_locOfNextLineText).c_str(), msg.str().c_str(), DEBUG);
      }
    return bOK;
  } //checkArrayCast
Ejemplo n.º 5
0
  const std::string UlamTypePrimitive::getUlamTypeMangledType()
  {
    // e.g. parsing overloaded functions, may not be complete.
    std::ostringstream mangled;
    s32 bitsize = getBitSize();
    s32 arraysize = getArraySize();

    if(isReference()) //includes ALT_ARRAYITEM (t3147)
      mangled << "r";

    if(arraysize > 0)
      mangled << ToLeximitedNumber(arraysize);
    else
      mangled << 10;

    if(bitsize > 0)
      mangled << ToLeximitedNumber(bitsize);
    else
      mangled << 10;

    std::string ecode(UlamTypePrimitive::getUlamTypeEnumCodeChar(getUlamTypeEnum()));
    mangled << ToLeximited(ecode).c_str();

    return mangled.str();
  } //getUlamTypeMangledType
Ejemplo n.º 6
0
  const std::string UlamType::getUlamTypeMangledType()
  {
    // e.g. parsing overloaded functions, may not be complete.
    std::ostringstream mangled;
    s32 bitsize = getBitSize();
    s32 arraysize = getArraySize();

    if(isReference()) //includes ALT_ARRAYITEM (t3147); not isAltRefType (t3114)
      mangled << "r"; //e.g. t3114

    if(arraysize > 0)
      mangled << ToLeximitedNumber(arraysize);
    //    else if(arraysize == 0)
    //  mangled << ToLeximitedNumber(-1); //distinct from scalar
    else
      mangled << 10; //scalar NONARRAYSIZE

    if(bitsize > 0)
      mangled << ToLeximitedNumber(bitsize);
    else
      mangled << 10;

    std::string ecode(UlamType::getUlamTypeEnumCodeChar(getUlamTypeEnum()));
    mangled << ToLeximited(ecode).c_str();

    return mangled.str();
  } //getUlamTypeMangledType
Ejemplo n.º 7
0
		Sampler(const std::vector<TypeReaction>& reactions, const std::vector<ProbTable>& xs_container, bool normalize = true) :
            nreaction(reactions.size()),
            nenergy(getArraySize(*xs_container.begin())),
            reactions(reactions) {

			/* Allocate reaction matrix */
			reaction_matrix = new double[(nreaction - 1) * nenergy];

			/* Sanity check */
			assert(xs_container.size() == reactions.size());

			/* Once we separate the reactions from the cross sections, we need to construct the reaction matrix */
			for(int nerg = 0 ; nerg < nenergy ; ++nerg) {

				/* Check if we have to normalize the probabilities */
				double total_xs = 0.0;
				if(normalize) {
					/* First get the total cross section (of this reactions) at this energy */
					for(int nrea = 0 ; nrea < nreaction ; ++nrea)
						total_xs += getArrayIndex(nerg,xs_container[nrea]);
				}

				/* Exclusive scan, to construct the accumulated probability table at this energy */
				double partial_sum = 0;
				for(int nrea = 0 ; nrea < nreaction - 1; ++nrea) {
					partial_sum += getArrayIndex(nerg,xs_container[nrea]);
					/* Put the value on the reaction matrix */
					if(normalize)
						reaction_matrix[nerg*(nreaction - 1) + nrea] = partial_sum / total_xs;
					else
						reaction_matrix[nerg*(nreaction - 1) + nrea] = partial_sum;
				}

			}
		}
Ejemplo n.º 8
0
inline
Uint32
AttributeDescriptor::getSizeInWords(const Uint32 & desc){
  return ((getArraySize(desc) << getSize(desc)) 
          + AD_SIZE_IN_WORDS_OFFSET) 
                              >> AD_SIZE_IN_WORDS_SHIFT;
}
Ejemplo n.º 9
0
void ObstacleHandler::resetAll()
{
	for(int i = 0; i < getArraySize(); i++)
	{
		arr[i].stopCatch();
		arr[i].setPosition(arr[i].x0, 1, arr[i].z0);
	}
}
Ejemplo n.º 10
0
int main() {
	int n = getArraySize();
	int a[n];
	getElements(a, n);
	bubbleSort(a, n);
	displayArray(a, n);

	return 0;
}
Ejemplo n.º 11
0
  u32 UlamType::getTotalBitSize()
  {
    s32 arraysize = getArraySize();
    arraysize = (arraysize > NONARRAYSIZE ? arraysize : 1);

    s32 bitsize = getBitSize();
    bitsize = (bitsize != UNKNOWNSIZE ? bitsize : 0);
    return bitsize * arraysize; // >= 0
  }
Ejemplo n.º 12
0
int main(void) {
    WSADATA Data;
    SOCKADDR_IN recvSockAddr;
    SOCKET recvSocket;
    int status;
    int numrcv = 0;
    struct hostent * remoteHost;
    char * ip;
    const char * host_name = "pb-homework.appspot.com";
    char buffer[MAXBUFLEN];
    char myArray[50];
    memset(buffer,0,MAXBUFLEN);
 // Initialize Windows Socket DLL
    status = WSAStartup(MAKEWORD(2, 2), &Data);
    if(status != 0)
    {
        printf("ERROR: WSAStartup unsuccessful\r\n");
        return 1;
    }
    // Create socket
     recvSocket = createSocket();
	// Get IP address from host name
	remoteHost = gethostbyname(host_name);
	ip = inet_ntoa(*(struct in_addr *)*remoteHost->h_addr_list);
	printf("IP address is: %s.\n", ip);
    memset(&recvSockAddr, 0, sizeof(recvSockAddr)); // zero the sockaddr_in structure
    recvSockAddr.sin_port=htons(PORT); // specify the port portion of the address
    recvSockAddr.sin_family=AF_INET; // specify the address family as Internet
    recvSockAddr.sin_addr.s_addr= inet_addr(ip); // specify ip address



	// Connect

connectToRemoteServer(recvSocket, recvSockAddr);
	// Send request
sendRequest(recvSocket, host_name);
    strcpy(buffer, receiveResponse(recvSocket));
	//Send request with secret param
	sendSecret(recvSocket, host_name, buffer);

    strcpy(buffer, receiveResponse(recvSocket));

    strcpy(myArray, getString(recvSocket, buffer));

    strcpy(myArray, arraySorting(myArray, getArraySize(myArray)));

	//Send POST-request with sorted array
sendPOST(recvSocket, host_name, myArray);
puts(receiveResponse(recvSocket));
	closesocket(recvSocket);
 WSACleanup();
	getchar();
	return EXIT_SUCCESS;

}
Ejemplo n.º 13
0
TridiagonalMatrix<T>::TridiagonalMatrix(const TridiagonalMatrix<T>& rhs)
	: Matrix<T>(rhs), size(rhs.size)
{
	if(size != 0)
	{
		// create an array of the proper size to hold the matrix
		data = new T[getArraySize(size)];

		// initialize the data to be a copy of rhs
		const T* const arrayEnd = data + getArraySize(size);
		for(T* i = data, *j = rhs.data; i < arrayEnd; ++i, ++j)
		{
			*i = *j;
		}
	}
	else
	{
		data = NULL;
	}
}
Ejemplo n.º 14
0
TridiagonalMatrix<T>::TridiagonalMatrix(size_t numRowsAndCols,
					const T& initialValue)
	: size(numRowsAndCols)
{
	if(size != 0)
	{
		// create an array of the proper size to hold the matrix
                data = new T[getArraySize(size)];

		// initialize the data to the given initial value
		const T* const arrayEnd = data + getArraySize(size);
		for(T* i = data; i < arrayEnd; ++i)
		{
			*i = initialValue;
		}
	}
	else
	{
		data = NULL;
	}
}
Ejemplo n.º 15
0
//-----------------------------------------------------------------------------
// Function: ParameterDelegate::setEditorData()
//-----------------------------------------------------------------------------
void ParameterDelegate::setEditorData(QWidget* editor, QModelIndex const& index) const 
{
    if (index.column() == valueColumn() && valueIsArray(index))
    {
        ArrayView* view = dynamic_cast<ArrayView*>(dynamic_cast<QScrollArea*>(editor)->widget());

        QModelIndex arrayLeftIndex = index.sibling(index.row(), arrayLeftColumn());
        int arrayLeftValue = arrayLeftIndex.data(Qt::ToolTipRole).toInt();

        QModelIndex arrayRightIndex = index.sibling(index.row(), arrayRightColumn());
        int arrayRightValue = arrayRightIndex.data(Qt::ToolTipRole).toInt();

        int arraySize = getArraySize(arrayLeftValue, arrayRightValue);

        int arrayStartIndex = arrayLeftValue;
        if (arrayRightValue < arrayLeftValue)
        {
            arrayStartIndex = arrayRightValue;
        }

        QSharedPointer<IPXactSystemVerilogParser> expressionParser(new IPXactSystemVerilogParser(
            getParameterFinder()));

        QSharedPointer<Choice> selectedChoice = findChoice(index);

        ParameterArrayModel* model = new ParameterArrayModel(arraySize, expressionParser, getParameterFinder(),
            expressionFormatter_, selectedChoice, QColor("LemonChiffon"), arrayStartIndex, view);

        QModelIndex valueIndex = index.sibling(index.row(), valueColumn());
        QString parameterValue = valueIndex.data(Qt::EditRole).toString();
        model->setArrayData(parameterValue);

        QModelIndex typeIndex = index.sibling(index.row(), formatColumn());
        QString parameterType = typeIndex.data(Qt::EditRole).toString();
        model->setParameterType(parameterType);

        view->setItemDelegate(new ArrayDelegate(getNameCompleter(), getParameterFinder(), selectedChoice,
            this->parent()));

        view->setModel(model);
        view->setSortingEnabled(false);
        view->resizeColumnsToContents();

        connect(model, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
        connect(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
            this, SIGNAL(contentChanged()), Qt::UniqueConnection);

        connect(view->itemDelegate(), SIGNAL(increaseReferences(QString)),
            this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
        connect(view->itemDelegate(), SIGNAL(decreaseReferences(QString)),
            this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);
    }
Ejemplo n.º 16
0
		Sampler(const std::vector<TypeReaction>& reactions,const std::vector<ProbTable>& xs_container,const ProbTable& total_xs) :
            nreaction(reactions.size()),
            nenergy(getArraySize(*xs_container.begin())),
            reactions(reactions) {

			/* Allocate reaction matrix */
			reaction_matrix = new double[(nreaction - 1) * nenergy];

			/* Sanity check */
			assert(xs_container.size() == reactions.size());
			assert(getArraySize(total_xs) == nenergy);

			/* Once we separate the reactions from the cross sections, we need to construct the reaction matrix */
			for(int nerg = 0 ; nerg < nenergy ; ++nerg) {
				/* Exclusive scan, to construct the accumulated probability table at this energy */
				double partial_sum = 0.0;
				for(int nrea = 0 ; nrea < nreaction - 1; ++nrea) {
					partial_sum += getArrayIndex(nerg,xs_container[nrea]);
					reaction_matrix[nerg*(nreaction - 1) + nrea] = partial_sum / getArrayIndex(nerg,total_xs);
				}
			}
		}
Ejemplo n.º 17
0
// ----------------------------------------------------------------------------
int DNA::getSize(short type, short name)
{
    const char *pt = m_names[name].c_str();
    size_t namelen = m_names[name].size();

    int ret =0;
    int mult=1;

    if (pt[0] == '*' || pt[1] == '*')
    {
        if (pt[namelen-1] == ']')
            mult = getArraySize(pt);
        ret = m_ptrSize*mult;
    }

    else if (type <= (short)m_lens.size())
    {
        if (pt[namelen-1] == ']')
            mult = getArraySize(pt);
        ret= m_lens[type]*mult;
    }
    return ret;
}
Ejemplo n.º 18
0
	static int getVectorSize( const mwSize *mxSizeArray, mwSize noElements = 2 ) {

		ArraySize arraySize = getArraySize( mxSizeArray, noElements );

		if ( arraySize.empty() ) return 0;

		ArraySize::iterator arsItr = arraySize.begin();
		int max = *arsItr;
		while( ++arsItr != arraySize.end() ) {
			if ( *arsItr > max ) max = *arsItr;
		}

		return max;
	}
Ejemplo n.º 19
0
TridiagonalMatrix<T>
TridiagonalMatrix<T>::operator-() const
{
	TridiagonalMatrix<T> returnValue(*this);

	const T* const dataEnd = 
		returnValue.data + getArraySize(returnValue.size);
	for(T* i = returnValue.data; i < dataEnd; ++i)
	{
                *i = -(*i);
	}

	return returnValue;

}
Ejemplo n.º 20
0
MatLabEngine::ArraySize MatLabEngine::getMxMatrixSize( const std::string &mxVarName, const bool unchecked ) {
	executeCommand( "ans = 0" );
	std::string command = std::string( "size( " ) + mxVarName + " )";
//std::cerr << "getMxLinearSize: \"" << command << "\"" << std::endl;
	executeCommand( command, unchecked );
	mxArray *mxSizeArray;
	if (   (  mxSizeArray = engGetVariable( _ep, "ans" )  )  ==  0   ) {
		throw MatLabUdm::Exception( std::string( "Could not get size of array " ) + mxVarName );
	}

	ArraySize retval = getArraySize( mxSizeArray );
	mxDestroyArray( mxSizeArray );

	return retval;
}
TString TType::getCompleteString() const
{
    TStringStream stream;

    if (qualifier != EvqTemporary && qualifier != EvqGlobal)
        stream << getQualifierString() << " " << getPrecisionString() << " ";
    if (array)
        stream << "array[" << getArraySize() << "] of ";
    if (matrix)
        stream << static_cast<int>(size) << "X" << static_cast<int>(size) << " matrix of ";
    else if (size > 1)
        stream << static_cast<int>(size) << "-component vector of ";

    stream << getBasicString();
    return stream.str();
}
Ejemplo n.º 22
0
int getSize(FieldList p){
	int size = 0;
	if(p->type->kind == Int||p->type->kind == Float)
		size = size + 4;
	else if(p->type->kind == ARRAY){
		size = getArraySize(p);
	}
	else{
		FieldList q = p->brother;
		while(q!=NULL){
			size = size + getSize(q);
			q = q->brother;
		}
	}
	return size;
}
Ejemplo n.º 23
0
TString TType::getCompleteString() const
{
    TStringStream stream;

    if (qualifier != EvqTemporary && qualifier != EvqGlobal)
        stream << getQualifierString() << " ";
    if (precision != EbpUndefined)
        stream << getPrecisionString() << " ";
    if (array)
        stream << "array[" << getArraySize() << "] of ";
    if (isMatrix())
        stream << getCols() << "X" << getRows() << " matrix of ";
    else if (isVector())
        stream << getNominalSize() << "-component vector of ";

    stream << getBasicString();
    return stream.str();
}
Ejemplo n.º 24
0
QualType FFIBindingsUtils::handleMultiDimArrayType(
    ASTContext *Context, QualType ArrayType, std::string &ArrayDeclaration) {
  const ConstantArrayType *CAT = Context->getAsConstantArrayType(ArrayType);
  QualType ElementType = CAT->getElementType();

  std::string TempArrayDeclaration;

  TempArrayDeclaration = getArraySize(CAT);

  ArrayDeclaration += TempArrayDeclaration;
  if (CAT->getElementType()->isArrayType() &&
      !(CAT->getElementType()->getAs<TypedefType>())) {
    ElementType = handleMultiDimArrayType(Context, CAT->getElementType(),
                                          ArrayDeclaration);
  }

  return ElementType;
}
Ejemplo n.º 25
0
TridiagonalMatrix<T>&
TridiagonalMatrix<T>::operator+=(const TridiagonalMatrix<T>& rhs)
{
	if(size != rhs.size)
	{
		throw typename Matrix<T>::
		      IncompatibleMatrixSizes(size, size,
		                              rhs.size, rhs.size);
	}

	const T* const dataEnd = data + getArraySize(size);
	for(T* i = data, *j = rhs.data; i < dataEnd; ++i, ++j)
	{
                *i += *j;
	}

	return *this;
}
Ejemplo n.º 26
0
size_t TType::getObjectSize() const
{
    size_t totalSize;

    if (getBasicType() == EbtStruct)
        totalSize = structure->objectSize();
    else
        totalSize = primarySize * secondarySize;

    if (isArray()) {
        size_t arraySize = getArraySize();
        if (arraySize > INT_MAX / totalSize)
            totalSize = INT_MAX;
        else
            totalSize *= arraySize;
    }

    return totalSize;
}
Ejemplo n.º 27
0
size_t TType::getObjectSize() const
{
    size_t totalSize;

    if (getBasicType() == EbtStruct)
        totalSize = structure->objectSize();
    else
        totalSize = primarySize * secondarySize;

    if (isArray())
    {
        // TODO: getArraySize() returns an int, not a size_t
        size_t currentArraySize = getArraySize();
        if (currentArraySize > INT_MAX / totalSize)
            totalSize = INT_MAX;
        else
            totalSize *= currentArraySize;
    }

    return totalSize;
}
Ejemplo n.º 28
0
	static ArraySize getArraySize( mxArray *mxSizeArray ) {

		double *data = mxGetPr( mxSizeArray );

		ArraySize metaArraySize = getArraySize(  mxGetDimensions( mxSizeArray ), mxGetNumberOfDimensions( mxSizeArray )  );
		int noElements = 1;
		for( ArraySize::iterator arsItr = metaArraySize.begin() ; arsItr != metaArraySize.end() ; ++arsItr ) {
			noElements *= *arsItr;
		}

		ArraySize retval;
		bool hasZero = false;
		for( int ix = 0 ; ix < noElements ; ++ix ) {
			retval.push_back( (int) data[ ix ] );
			if ( retval.back() == 0 ) hasZero = true;
		}

		if ( hasZero ) {
			retval = ArraySize( retval.size(), 0 );
		}

		return retval;
	}
Ejemplo n.º 29
0
		Sampler(const std::map<TypeReaction,ProbTable>& reaction_map) :
            nreaction(reaction_map.size()),
            nenergy(getArraySize(reaction_map.begin()->second)),
            reactions(nreaction) {

			/* Allocate reaction matrix */
			reaction_matrix = new double[(nreaction - 1) * nenergy];

			/* TypeReactions */
			typename std::map<TypeReaction,ProbTable>::const_iterator it_rea = reaction_map.begin();
			int nrea = 0;
			/* Cross sections */
			std::vector<ProbTable> xs_container(nreaction);
			for(; it_rea != reaction_map.end() ; ++it_rea) {
				/* Save the reactions into the reaction container */
				reactions[nrea] = (*it_rea).first;
				/* Save the cross sections */
				xs_container[nrea] = (*it_rea).second;
				/* Count reaction */
				nrea++;
			}

			/* Once we separate the reactions from the cross sections, we need to construct the reaction matrix */
			for(int nerg = 0 ; nerg < nenergy ; ++nerg) {
				/* First get the total cross section (of this reactions) at this energy */
				double total_xs = 0.0;
				for(nrea = 0 ; nrea < nreaction ; ++nrea)
					total_xs += getArrayIndex(nerg,xs_container[nrea]);

				/* Exclusive scan, to construct the accumulated probability table at this energy */
				double partial_sum = 0;
				for(nrea = 0 ; nrea < nreaction - 1; ++nrea) {
					partial_sum += getArrayIndex(nerg,xs_container[nrea]);
					reaction_matrix[nerg*(nreaction - 1) + nrea] = partial_sum / total_xs;
				}
			}
		}
Ejemplo n.º 30
0
////////////////////////////////////////////////////////////////////////////////////////////////////
// arrayToBSTree: Recreates the a tree based on the array of NodeData
// Pre Conditions: Tree and array are properly inialized
// Post Conditions: Tree is returned
////////////////////////////////////////////////////////////////////////////////////////////////////
	void BinTree::arrayToBSTree(NodeData* TreeArray[])
	{
		int high = getArraySize(TreeArray);
		int low = 0;
		root = arrayToBSTreeHelper(TreeArray, low, high, root);
	}