コード例 #1
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
CDatedData::CDatedData(const CDatedData &right, const TIndex &selectedDim) : 
date(right.date)
{
	if ( selectedDim.Size() <= 0 )
		data.CopyContent(right.data); 
	else 
	{
		TIndex validDim; 
                for (int i=0; i<selectedDim.Size(); i++)
                {
                        if (selectedDim[i] >=0 && selectedDim[i] < right.DataDimension())
                                validDim += selectedDim[i];
                }
                data = right.data.SubVector(validDim);
	}
}
コード例 #2
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
CDatedDataSeries::CDatedDataSeries(const TDenseMatrix &date_data_matrix, const TIndex &selectedTime, const TIndex &selectedDim)
{
	if (selectedTime.Size() <= 0)
	{
		for (int i=0; i<date_data_matrix.rows; i++)
			this->push_back(CDatedData(date_data_matrix.RowVector(i),selectedDim)); 
	}
	else 
	{
		for (int i=0; i<selectedTime.Size(); i++)
		{
			if (selectedTime[i] >= 0 && selectedTime[i] < date_data_matrix.rows)
				this->push_back(CDatedData(date_data_matrix.RowVector(selectedTime[i]), selectedDim)); 
		}
	}	
}
コード例 #3
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
CDatedDataSeries::CDatedDataSeries(const CDatedDataSeries &right, const TIndex &selectedTime, const TIndex &selectedDim)
{
	if (selectedTime.Size() <= 0)
	{
		for (int i=0; i<right.ObservationLength(); i++)
			this->push_back(CDatedData(right[i],selectedDim));
	}
	else 
	{
		for (int i=0; i<selectedTime.Size(); i++)
		{
			if (selectedTime[i] >=0 && selectedTime[i] < (int)(right.size()) )
				this->push_back(CDatedData(right[selectedTime[i]],selectedDim)); 
		}
	}
}
コード例 #4
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
CDatedData::CDatedData(const CDate &_date, const TDenseVector &_data, const TIndex &selectedDim) : 
date(_date)
{
	if (selectedDim.Size() <= 0)
		data.CopyContent(_data); 
	else 
	{
		TIndex validDim; 
		for (int i=0; i<selectedDim.Size(); i++)
		{
			if (selectedDim[i] >=0 && selectedDim[i] < _data.Dimension())
				validDim += selectedDim[i]; 
		}
		data = _data.SubVector(validDim); 
	}
}
コード例 #5
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
CDatedDataSeries::CDatedDataSeries(const std::vector<CDate> &date_series, const TDenseMatrix &data_matrix, const TIndex &selectedTime, const TIndex &selectedDim)
{
	int N = (int)date_series.size() <= data_matrix.rows ? (int)date_series.size() : data_matrix.rows; 
	if (selectedTime.Size() <= 0)
	{
		for (int i=0; i<N; i++)
			this->push_back(CDatedData(date_series[i],data_matrix.RowVector(i,selectedDim))); 
	}
	else 
	{
		for (int i=0; i<selectedTime.Size(); i++)
		{
			if (selectedTime[i] >= 0 && selectedTime[i] < N)
				this->push_back(CDatedData(date_series[selectedTime[i]],data_matrix.RowVector(selectedTime[i],selectedDim) )); 	
		}
	}
}
コード例 #6
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
CDatedDataSeries::CDatedDataSeries(const std::vector<CDate> &date_series, const std::vector<TDenseVector> &data_series, const TIndex &selectedTime, const TIndex &selectedDim)
{
	int N = (int)(date_series.size() <= data_series.size() ? date_series.size() : data_series.size()); 
	if (selectedTime.Size() <= 0)
	{
		for (int i=0; i<N; i++)
			this->push_back(CDatedData(date_series[i],data_series[i],selectedDim)); 
	}
	else 
	{
		for (int i=0; i<selectedTime.Size(); i++)
		{
			if (selectedTime[i] >= 0 && selectedTime[i] < N)
				this->push_back(CDatedData(date_series[selectedTime[i]], data_series[selectedTime[i]], selectedDim)); 
		}
	}
}
コード例 #7
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
std::vector<CDate> CDatedDataSeries::GetDateSeries(const TIndex &selectedTime) const
{
	std::vector<CDate> date_series; 
	if (selectedTime.Size() <= 0)
	{
		for (int i=0; i<ObservationLength(); i++)
			date_series.push_back(this->operator[](i).GetDate()); 
	}
	else 
	{
		for (int i=0; i<selectedTime.Size(); i++)
		{
			if (selectedTime[i] >= 0 || selectedTime[i] < ObservationLength())
				date_series.push_back(this->operator[](selectedTime[i]).GetDate()); 
		}
	}
	return date_series; 
}
コード例 #8
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
std::vector<TDenseVector> CDatedDataSeries::GetDataSeries_Vector(const TIndex &selectedTime, const TIndex &selectedDim) const
{
	std::vector<TDenseVector> data_series;
	if (selectedTime.Size() <= 0)
	{
		for (int i=0; i<ObservationLength(); i++)
			data_series.push_back(this->operator[](i).GetData(selectedDim)); 
	}
	else 
	{
		for (int i=0; i<selectedTime.Size(); i++)
		{
			if (selectedTime[i] >= 0 &&  selectedTime[i] < ObservationLength())
				data_series.push_back(this->operator[](selectedTime[i]).GetData(selectedDim)); 
		}
	}
	return data_series; 
}
コード例 #9
0
ファイル: CDatedData.cpp プロジェクト: parb220/DKW
CDatedData::CDatedData(const TDenseVector &date_data, const TIndex &selectedDim) :
date(date_data)
{
	if (date_data.Dimension() > 3) // there are data besides date	
	{
		if (selectedDim.Size() <= 0)
			data = date_data.SubVector(3,date_data.Dimension()-1); 
		else 
		{
			TIndex validDim; 
			for (int i=0; i<selectedDim.Size(); i++)
			{
				if (selectedDim[i] >= 3 && selectedDim[i] < date_data.Dimension())
					validDim += selectedDim[i]; 
			}
			data = date_data.SubVector(validDim); 
		}
	}
}