38 |
using namespace boost; |
using namespace boost; |
39 |
using namespace escript; |
using namespace escript; |
40 |
|
|
|
#if defined DOPROF |
|
|
// |
|
|
// global table of profiling data for all Data objects |
|
|
DataProf dataProfTable; |
|
|
#endif |
|
|
|
|
41 |
Data::Data() |
Data::Data() |
42 |
{ |
{ |
43 |
// |
// |
46 |
shared_ptr<DataAbstract> temp_data(temp); |
shared_ptr<DataAbstract> temp_data(temp); |
47 |
m_data=temp_data; |
m_data=temp_data; |
48 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
49 |
} |
} |
50 |
|
|
51 |
Data::Data(double value, |
Data::Data(double value, |
60 |
DataArray temp(dataPointShape,value); |
DataArray temp(dataPointShape,value); |
61 |
initialise(temp.getView(),what,expanded); |
initialise(temp.getView(),what,expanded); |
62 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
63 |
} |
} |
64 |
|
|
65 |
Data::Data(double value, |
Data::Data(double value, |
71 |
pair<int,int> dataShape=what.getDataShape(); |
pair<int,int> dataShape=what.getDataShape(); |
72 |
initialise(temp.getView(),what,expanded); |
initialise(temp.getView(),what,expanded); |
73 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
74 |
} |
} |
75 |
|
|
76 |
Data::Data(const Data& inData) |
Data::Data(const Data& inData) |
77 |
{ |
{ |
78 |
m_data=inData.m_data; |
m_data=inData.m_data; |
79 |
m_protected=inData.isProtected(); |
m_protected=inData.isProtected(); |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
80 |
} |
} |
81 |
|
|
82 |
Data::Data(const Data& inData, |
Data::Data(const Data& inData, |
88 |
shared_ptr<DataAbstract> temp_data(tmp); |
shared_ptr<DataAbstract> temp_data(tmp); |
89 |
m_data=temp_data; |
m_data=temp_data; |
90 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
91 |
} |
} |
92 |
|
|
93 |
Data::Data(const Data& inData, |
Data::Data(const Data& inData, |
94 |
const FunctionSpace& functionspace) |
const FunctionSpace& functionspace) |
95 |
{ |
{ |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
96 |
if (inData.getFunctionSpace()==functionspace) { |
if (inData.getFunctionSpace()==functionspace) { |
97 |
m_data=inData.m_data; |
m_data=inData.m_data; |
98 |
} else { |
} else { |
|
#if defined DOPROF |
|
|
profData->interpolate++; |
|
|
#endif |
|
99 |
Data tmp(0,inData.getPointDataView().getShape(),functionspace,true); |
Data tmp(0,inData.getPointDataView().getShape(),functionspace,true); |
100 |
// Note: Must use a reference or pointer to a derived object |
// Note: Must use a reference or pointer to a derived object |
101 |
// in order to get polymorphic behaviour. Shouldn't really |
// in order to get polymorphic behaviour. Shouldn't really |
125 |
if (expanded) { |
if (expanded) { |
126 |
expand(); |
expand(); |
127 |
} |
} |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
128 |
} |
} |
129 |
|
|
130 |
Data::Data(const numeric::array& value, |
Data::Data(const numeric::array& value, |
133 |
{ |
{ |
134 |
initialise(value,what,expanded); |
initialise(value,what,expanded); |
135 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
136 |
} |
} |
137 |
|
|
138 |
Data::Data(const DataArrayView& value, |
Data::Data(const DataArrayView& value, |
141 |
{ |
{ |
142 |
initialise(value,what,expanded); |
initialise(value,what,expanded); |
143 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
144 |
} |
} |
145 |
|
|
146 |
Data::Data(const object& value, |
Data::Data(const object& value, |
150 |
numeric::array asNumArray(value); |
numeric::array asNumArray(value); |
151 |
initialise(asNumArray,what,expanded); |
initialise(asNumArray,what,expanded); |
152 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
153 |
} |
} |
154 |
|
|
155 |
Data::Data(const object& value, |
Data::Data(const object& value, |
171 |
initialise(temp.getView(),other.getFunctionSpace(),false); |
initialise(temp.getView(),other.getFunctionSpace(),false); |
172 |
} |
} |
173 |
m_protected=false; |
m_protected=false; |
|
#if defined DOPROF |
|
|
// create entry in global profiling table for this object |
|
|
profData = dataProfTable.newData(); |
|
|
#endif |
|
174 |
} |
} |
175 |
|
|
176 |
Data::~Data() |
Data::~Data() |
370 |
Data |
Data |
371 |
Data::oneOver() const |
Data::oneOver() const |
372 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->where++; |
|
|
#endif |
|
373 |
return escript::unaryOp(*this,bind1st(divides<double>(),1.)); |
return escript::unaryOp(*this,bind1st(divides<double>(),1.)); |
374 |
} |
} |
375 |
|
|
376 |
Data |
Data |
377 |
Data::wherePositive() const |
Data::wherePositive() const |
378 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->where++; |
|
|
#endif |
|
379 |
return escript::unaryOp(*this,bind2nd(greater<double>(),0.0)); |
return escript::unaryOp(*this,bind2nd(greater<double>(),0.0)); |
380 |
} |
} |
381 |
|
|
382 |
Data |
Data |
383 |
Data::whereNegative() const |
Data::whereNegative() const |
384 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->where++; |
|
|
#endif |
|
385 |
return escript::unaryOp(*this,bind2nd(less<double>(),0.0)); |
return escript::unaryOp(*this,bind2nd(less<double>(),0.0)); |
386 |
} |
} |
387 |
|
|
388 |
Data |
Data |
389 |
Data::whereNonNegative() const |
Data::whereNonNegative() const |
390 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->where++; |
|
|
#endif |
|
391 |
return escript::unaryOp(*this,bind2nd(greater_equal<double>(),0.0)); |
return escript::unaryOp(*this,bind2nd(greater_equal<double>(),0.0)); |
392 |
} |
} |
393 |
|
|
394 |
Data |
Data |
395 |
Data::whereNonPositive() const |
Data::whereNonPositive() const |
396 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->where++; |
|
|
#endif |
|
397 |
return escript::unaryOp(*this,bind2nd(less_equal<double>(),0.0)); |
return escript::unaryOp(*this,bind2nd(less_equal<double>(),0.0)); |
398 |
} |
} |
399 |
|
|
400 |
Data |
Data |
401 |
Data::whereZero(double tol) const |
Data::whereZero(double tol) const |
402 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->where++; |
|
|
#endif |
|
403 |
Data dataAbs=abs(); |
Data dataAbs=abs(); |
404 |
return escript::unaryOp(dataAbs,bind2nd(less_equal<double>(),tol)); |
return escript::unaryOp(dataAbs,bind2nd(less_equal<double>(),tol)); |
405 |
} |
} |
407 |
Data |
Data |
408 |
Data::whereNonZero(double tol) const |
Data::whereNonZero(double tol) const |
409 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->where++; |
|
|
#endif |
|
410 |
Data dataAbs=abs(); |
Data dataAbs=abs(); |
411 |
return escript::unaryOp(dataAbs,bind2nd(greater<double>(),tol)); |
return escript::unaryOp(dataAbs,bind2nd(greater<double>(),tol)); |
412 |
} |
} |
414 |
Data |
Data |
415 |
Data::interpolate(const FunctionSpace& functionspace) const |
Data::interpolate(const FunctionSpace& functionspace) const |
416 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->interpolate++; |
|
|
#endif |
|
417 |
return Data(*this,functionspace); |
return Data(*this,functionspace); |
418 |
} |
} |
419 |
|
|
435 |
Data |
Data |
436 |
Data::gradOn(const FunctionSpace& functionspace) const |
Data::gradOn(const FunctionSpace& functionspace) const |
437 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->grad++; |
|
|
#endif |
|
438 |
if (functionspace.getDomain()!=getDomain()) |
if (functionspace.getDomain()!=getDomain()) |
439 |
throw DataException("Error - gradient cannot be calculated on different domains."); |
throw DataException("Error - gradient cannot be calculated on different domains."); |
440 |
DataArrayView::ShapeType grad_shape=getPointDataView().getShape(); |
DataArrayView::ShapeType grad_shape=getPointDataView().getShape(); |
768 |
int rank = getDataPointRank(); |
int rank = getDataPointRank(); |
769 |
DataArrayView::ShapeType shape = getDataPointShape(); |
DataArrayView::ShapeType shape = getDataPointShape(); |
770 |
|
|
|
#if defined DOPROF |
|
|
profData->integrate++; |
|
|
#endif |
|
771 |
|
|
772 |
// |
// |
773 |
// calculate the integral values |
// calculate the integral values |
832 |
Data |
Data |
833 |
Data::sin() const |
Data::sin() const |
834 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
835 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sin); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sin); |
836 |
} |
} |
837 |
|
|
838 |
Data |
Data |
839 |
Data::cos() const |
Data::cos() const |
840 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
841 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::cos); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::cos); |
842 |
} |
} |
843 |
|
|
844 |
Data |
Data |
845 |
Data::tan() const |
Data::tan() const |
846 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
847 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::tan); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::tan); |
848 |
} |
} |
849 |
|
|
850 |
Data |
Data |
851 |
Data::asin() const |
Data::asin() const |
852 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
853 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::asin); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::asin); |
854 |
} |
} |
855 |
|
|
856 |
Data |
Data |
857 |
Data::acos() const |
Data::acos() const |
858 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
859 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::acos); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::acos); |
860 |
} |
} |
861 |
|
|
863 |
Data |
Data |
864 |
Data::atan() const |
Data::atan() const |
865 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
866 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::atan); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::atan); |
867 |
} |
} |
868 |
|
|
869 |
Data |
Data |
870 |
Data::sinh() const |
Data::sinh() const |
871 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
872 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sinh); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sinh); |
873 |
} |
} |
874 |
|
|
875 |
Data |
Data |
876 |
Data::cosh() const |
Data::cosh() const |
877 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
878 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::cosh); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::cosh); |
879 |
} |
} |
880 |
|
|
881 |
Data |
Data |
882 |
Data::tanh() const |
Data::tanh() const |
883 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
884 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::tanh); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::tanh); |
885 |
} |
} |
886 |
|
|
888 |
Data |
Data |
889 |
Data::erf() const |
Data::erf() const |
890 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
891 |
#ifdef _WIN32 |
#ifdef _WIN32 |
892 |
throw DataException("Error - Data:: erf function is not supported on _WIN32 platforms."); |
throw DataException("Error - Data:: erf function is not supported on _WIN32 platforms."); |
893 |
#else |
#else |
898 |
Data |
Data |
899 |
Data::asinh() const |
Data::asinh() const |
900 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
901 |
#ifdef _WIN32 |
#ifdef _WIN32 |
902 |
return escript::unaryOp(*this,escript::asinh_substitute); |
return escript::unaryOp(*this,escript::asinh_substitute); |
903 |
#else |
#else |
908 |
Data |
Data |
909 |
Data::acosh() const |
Data::acosh() const |
910 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
911 |
#ifdef _WIN32 |
#ifdef _WIN32 |
912 |
return escript::unaryOp(*this,escript::acosh_substitute); |
return escript::unaryOp(*this,escript::acosh_substitute); |
913 |
#else |
#else |
918 |
Data |
Data |
919 |
Data::atanh() const |
Data::atanh() const |
920 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
921 |
#ifdef _WIN32 |
#ifdef _WIN32 |
922 |
return escript::unaryOp(*this,escript::atanh_substitute); |
return escript::unaryOp(*this,escript::atanh_substitute); |
923 |
#else |
#else |
928 |
Data |
Data |
929 |
Data::log10() const |
Data::log10() const |
930 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
931 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log10); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log10); |
932 |
} |
} |
933 |
|
|
934 |
Data |
Data |
935 |
Data::log() const |
Data::log() const |
936 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
937 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log); |
938 |
} |
} |
939 |
|
|
940 |
Data |
Data |
941 |
Data::sign() const |
Data::sign() const |
942 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
943 |
return escript::unaryOp(*this,escript::fsign); |
return escript::unaryOp(*this,escript::fsign); |
944 |
} |
} |
945 |
|
|
946 |
Data |
Data |
947 |
Data::abs() const |
Data::abs() const |
948 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
949 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::fabs); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::fabs); |
950 |
} |
} |
951 |
|
|
952 |
Data |
Data |
953 |
Data::neg() const |
Data::neg() const |
954 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
955 |
return escript::unaryOp(*this,negate<double>()); |
return escript::unaryOp(*this,negate<double>()); |
956 |
} |
} |
957 |
|
|
958 |
Data |
Data |
959 |
Data::pos() const |
Data::pos() const |
960 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
961 |
Data result; |
Data result; |
962 |
// perform a deep copy |
// perform a deep copy |
963 |
result.copy(*this); |
result.copy(*this); |
967 |
Data |
Data |
968 |
Data::exp() const |
Data::exp() const |
969 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
970 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::exp); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::exp); |
971 |
} |
} |
972 |
|
|
973 |
Data |
Data |
974 |
Data::sqrt() const |
Data::sqrt() const |
975 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
976 |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sqrt); |
return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sqrt); |
977 |
} |
} |
978 |
|
|
980 |
Data::Lsup() const |
Data::Lsup() const |
981 |
{ |
{ |
982 |
double localValue, globalValue; |
double localValue, globalValue; |
|
#if defined DOPROF |
|
|
profData->reduction1++; |
|
|
#endif |
|
983 |
// |
// |
984 |
// set the initial absolute maximum value to zero |
// set the initial absolute maximum value to zero |
985 |
|
|
997 |
Data::Linf() const |
Data::Linf() const |
998 |
{ |
{ |
999 |
double localValue, globalValue; |
double localValue, globalValue; |
|
#if defined DOPROF |
|
|
profData->reduction1++; |
|
|
#endif |
|
1000 |
// |
// |
1001 |
// set the initial absolute minimum value to max double |
// set the initial absolute minimum value to max double |
1002 |
AbsMin abs_min_func; |
AbsMin abs_min_func; |
1014 |
Data::sup() const |
Data::sup() const |
1015 |
{ |
{ |
1016 |
double localValue, globalValue; |
double localValue, globalValue; |
|
#if defined DOPROF |
|
|
profData->reduction1++; |
|
|
#endif |
|
1017 |
// |
// |
1018 |
// set the initial maximum value to min possible double |
// set the initial maximum value to min possible double |
1019 |
FMax fmax_func; |
FMax fmax_func; |
1030 |
Data::inf() const |
Data::inf() const |
1031 |
{ |
{ |
1032 |
double localValue, globalValue; |
double localValue, globalValue; |
|
#if defined DOPROF |
|
|
profData->reduction1++; |
|
|
#endif |
|
1033 |
// |
// |
1034 |
// set the initial minimum value to max possible double |
// set the initial minimum value to max possible double |
1035 |
FMin fmin_func; |
FMin fmin_func; |
1047 |
Data |
Data |
1048 |
Data::maxval() const |
Data::maxval() const |
1049 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->reduction2++; |
|
|
#endif |
|
1050 |
// |
// |
1051 |
// set the initial maximum value to min possible double |
// set the initial maximum value to min possible double |
1052 |
FMax fmax_func; |
FMax fmax_func; |
1056 |
Data |
Data |
1057 |
Data::minval() const |
Data::minval() const |
1058 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->reduction2++; |
|
|
#endif |
|
1059 |
// |
// |
1060 |
// set the initial minimum value to max possible double |
// set the initial minimum value to max possible double |
1061 |
FMin fmin_func; |
FMin fmin_func; |
1066 |
Data::swapaxes(const int axis0, const int axis1) const |
Data::swapaxes(const int axis0, const int axis1) const |
1067 |
{ |
{ |
1068 |
int axis0_tmp,axis1_tmp; |
int axis0_tmp,axis1_tmp; |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
1069 |
DataArrayView::ShapeType s=getDataPointShape(); |
DataArrayView::ShapeType s=getDataPointShape(); |
1070 |
DataArrayView::ShapeType ev_shape; |
DataArrayView::ShapeType ev_shape; |
1071 |
// Here's the equivalent of python s_out=s[axis_offset:]+s[:axis_offset] |
// Here's the equivalent of python s_out=s[axis_offset:]+s[:axis_offset] |
1109 |
Data |
Data |
1110 |
Data::symmetric() const |
Data::symmetric() const |
1111 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
1112 |
// check input |
// check input |
1113 |
DataArrayView::ShapeType s=getDataPointShape(); |
DataArrayView::ShapeType s=getDataPointShape(); |
1114 |
if (getDataPointRank()==2) { |
if (getDataPointRank()==2) { |
1131 |
Data |
Data |
1132 |
Data::nonsymmetric() const |
Data::nonsymmetric() const |
1133 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
1134 |
// check input |
// check input |
1135 |
DataArrayView::ShapeType s=getDataPointShape(); |
DataArrayView::ShapeType s=getDataPointShape(); |
1136 |
if (getDataPointRank()==2) { |
if (getDataPointRank()==2) { |
1165 |
Data |
Data |
1166 |
Data::trace(int axis_offset) const |
Data::trace(int axis_offset) const |
1167 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
1168 |
DataArrayView::ShapeType s=getDataPointShape(); |
DataArrayView::ShapeType s=getDataPointShape(); |
1169 |
if (getDataPointRank()==2) { |
if (getDataPointRank()==2) { |
1170 |
DataArrayView::ShapeType ev_shape; |
DataArrayView::ShapeType ev_shape; |
1215 |
Data |
Data |
1216 |
Data::transpose(int axis_offset) const |
Data::transpose(int axis_offset) const |
1217 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
1218 |
DataArrayView::ShapeType s=getDataPointShape(); |
DataArrayView::ShapeType s=getDataPointShape(); |
1219 |
DataArrayView::ShapeType ev_shape; |
DataArrayView::ShapeType ev_shape; |
1220 |
// Here's the equivalent of python s_out=s[axis_offset:]+s[:axis_offset] |
// Here's the equivalent of python s_out=s[axis_offset:]+s[:axis_offset] |
1236 |
Data |
Data |
1237 |
Data::eigenvalues() const |
Data::eigenvalues() const |
1238 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
1239 |
// check input |
// check input |
1240 |
DataArrayView::ShapeType s=getDataPointShape(); |
DataArrayView::ShapeType s=getDataPointShape(); |
1241 |
if (getDataPointRank()!=2) |
if (getDataPointRank()!=2) |
1253 |
const boost::python::tuple |
const boost::python::tuple |
1254 |
Data::eigenvalues_and_eigenvectors(const double tol) const |
Data::eigenvalues_and_eigenvectors(const double tol) const |
1255 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->unary++; |
|
|
#endif |
|
1256 |
DataArrayView::ShapeType s=getDataPointShape(); |
DataArrayView::ShapeType s=getDataPointShape(); |
1257 |
if (getDataPointRank()!=2) |
if (getDataPointRank()!=2) |
1258 |
throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for rank 2 object."); |
throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for rank 2 object."); |
1666 |
Data |
Data |
1667 |
Data::getSlice(const DataArrayView::RegionType& region) const |
Data::getSlice(const DataArrayView::RegionType& region) const |
1668 |
{ |
{ |
|
#if defined DOPROF |
|
|
profData->slicing++; |
|
|
#endif |
|
1669 |
return Data(*this,region); |
return Data(*this,region); |
1670 |
} |
} |
1671 |
|
|
1707 |
if (isProtected()) { |
if (isProtected()) { |
1708 |
throw DataException("Error - attempt to update protected Data object."); |
throw DataException("Error - attempt to update protected Data object."); |
1709 |
} |
} |
|
#if defined DOPROF |
|
|
profData->slicing++; |
|
|
#endif |
|
1710 |
Data tempValue(value); |
Data tempValue(value); |
1711 |
typeMatchLeft(tempValue); |
typeMatchLeft(tempValue); |
1712 |
typeMatchRight(tempValue); |
typeMatchRight(tempValue); |
2150 |
// General tensor product: res(SL x SR) = arg_0(SL x SM) * arg_1(SM x SR) |
// General tensor product: res(SL x SR) = arg_0(SL x SM) * arg_1(SM x SR) |
2151 |
// SM is the product of the last axis_offset entries in arg_0.getShape(). |
// SM is the product of the last axis_offset entries in arg_0.getShape(). |
2152 |
|
|
|
#if defined DOPROF |
|
|
// profData->binary++; |
|
|
#endif |
|
2153 |
|
|
2154 |
// Interpolate if necessary and find an appropriate function space |
// Interpolate if necessary and find an appropriate function space |
2155 |
Data arg_0_Z, arg_1_Z; |
Data arg_0_Z, arg_1_Z; |