/usr/include/scilab/double.hxx is in scilab-include 6.0.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | /*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* This file was originally licensed under the terms of the CeCILL v2.1,
* and continues to be available under such terms.
* For more information, see the COPYING file which you should have received
* along with this program.
*
*/
// This code is separated in double.hxx
// but will be inlined in arrayof.hxx
//
// If you need additionnal headers, please add it in arrayof.hxx
//#ifndef __ARRAYOF_HXX__
// #error This file must only be include by arrayof.hxx
//#endif
#ifndef __DOUBLE_HXX__
#define __DOUBLE_HXX__
#include "arrayof.hxx"
#include "bool.hxx"
#include "types_transposition.hxx"
namespace types
{
class EXTERN_AST Double : public ArrayOf<double>
{
public :
virtual ~Double();
Double(double _dblReal);
Double(double _dblReal, double _dblImg);
Double(int _iRows, int _iCols, bool _bComplex = false, bool _bZComplex = false);
Double(int _iRows, int _iCols, double **_pdblReal);
Double(int _iRows, int _iCols, double **_pdblReal, double **_pdblImg);
Double(int _iDims, const int* _piDims, bool _bComplex = false, bool _bZComplex = false);
static Double* Empty();
static Double* Identity(int _iRows, int _iCols);
static Double* Identity(int _iDims, const int* _piDims);
static Double* Identity(int _iDims, const int* _piDims, double _dblReal);
static Double* Identity(int _iDims, const int* _piDims, double _dblReal, double _dblImg);
/*data management*/
double* getReal() const;
double getReal(int _iRows, int _iCols);
bool setInt(int* _piReal); //to translate int to double matrix
/*zero or one set filler*/
bool setZeros();
bool setOnes();
/*Config management*/
void whoAmI();
bool isEmpty();
Double* clone();
bool fillFromCol(int _iCols, Double *_poSource);
bool fillFromRow(int _iRows, Double *_poSource);
Double* append(int _iRows, int _iCols, InternalType* _poSource);
//bool append(int _iRows, int _iCols, Double *_poSource);
bool operator==(const InternalType& it);
bool operator!=(const InternalType& it);
bool isDouble()
{
return true;
}
bool isComplex()
{
return (m_pImgData != NULL) || isViewAsZComplex();
}
inline bool isNumericallyComplex(double tolerance = 0)
{
if (isComplex())
{
int listSize = getSize();
double* bImg = getImg();
for (int i = 0; i < listSize; i++)
{
if (abs(bImg[i]) > tolerance)
{
return false;
}
}
}
return true;
}
bool isTrue();
bool neg(InternalType *& out)
{
if (isEmpty())
{
out = this;
return true;
}
return ArrayOf<double>::neg(out);
}
void setViewAsInteger(bool _bViewAsInteger = true)
{
m_bViewAsInteger = _bViewAsInteger;
}
bool isViewAsInteger()
{
return m_bViewAsInteger;
}
void convertToInteger();
void convertFromInteger();
void setViewAsZComplex(bool _bViewAsZComplex = true)
{
m_bViewAsZComplex = _bViewAsZComplex;
}
bool isViewAsZComplex()
{
return m_bViewAsZComplex;
}
void convertToZComplex();
void convertFromZComplex();
/* return type as string ( double, int, cell, list, ... )*/
virtual std::wstring getTypeStr() const
{
return L"constant";
}
/* return type as short string ( s, i, ce, l, ... )*/
virtual std::wstring getShortTypeStr() const
{
return L"s";
}
inline ScilabType getType(void)
{
return ScilabDouble;
}
inline ScilabId getId(void)
{
return isIdentity() ? isComplex() ? IdIdentityComplex : IdIdentity
: isEmpty() ? IdEmpty
: isComplex() ? isScalar() ? IdScalarDoubleComplex
: IdDoubleComplex
: isScalar() ? IdScalarDouble
: IdDouble;
}
inline bool conjugate(InternalType *& out)
{
if (isEmpty() || isIdentity() || !isComplex())
{
out = clone();
return true;
}
if (isScalar())
{
out = new Double(m_pRealData[0], -m_pImgData[0]);
return true;
}
if (m_iDims == 2)
{
Double * pReturn = new Double(getCols(), getRows(), true);
out = pReturn;
Transposition::conjugate(getSize(), m_pRealData, pReturn->m_pRealData, m_pImgData, pReturn->m_pImgData);
return true;
}
return false;
}
virtual bool adjoint(InternalType *& out)
{
if (isEmpty())
{
out = this;
return true;
}
if (isIdentity())
{
out = clone();
return true;
}
if (isScalar())
{
if (isComplex())
{
out = new Double(m_pRealData[0], -m_pImgData[0]);
}
else
{
out = clone();
}
return true;
}
if (m_iDims == 2)
{
Double * pReturn = new Double(getCols(), getRows(), isComplex());
out = pReturn;
if (isComplex())
{
Transposition::adjoint(getRows(), getCols(), m_pRealData, pReturn->m_pRealData, m_pImgData, pReturn->m_pImgData);
}
else
{
Transposition::adjoint(getRows(), getCols(), m_pRealData, pReturn->m_pRealData);
}
return true;
}
return false;
}
virtual bool transpose(InternalType *& out)
{
if (isEmpty())
{
out = this;
return true;
}
if (isIdentity() || isScalar())
{
out = clone();
return true;
}
if (m_iDims == 2)
{
Double * pReturn = new Double(getCols(), getRows(), isComplex());
out = pReturn;
if (isComplex())
{
Transposition::transpose(getRows(), getCols(), m_pRealData, pReturn->m_pRealData, m_pImgData, pReturn->m_pImgData);
}
else
{
Transposition::transpose(getRows(), getCols(), m_pRealData, pReturn->m_pRealData);
}
return true;
}
return false;
}
virtual ast::Exp* getExp(const Location& loc);
virtual Double* set(int _iPos, const double _data)
{
if (_iPos >= m_iSize)
{
return NULL;
}
typedef Double* (Double::*set_t)(int, double);
Double* pIT = checkRef(this, (set_t)&Double::set, _iPos, _data);
if (pIT != this)
{
return pIT;
}
m_pRealData[_iPos] = _data;
return this;
}
virtual Double* set(int _iRows, int _iCols, const double _data)
{
return set(_iCols * getRows() + _iRows, _data);
}
virtual Double* set(double* _pdata)
{
if (m_pRealData == NULL)
{
return NULL;
}
typedef Double* (Double::*set_t)(double*);
Double* pIT = checkRef(this, (set_t)&Double::set, _pdata);
if (pIT != this)
{
return pIT;
}
for (int i = 0; i < m_iSize; i++)
{
m_pRealData[i] = _pdata[i];
}
return this;
}
virtual Double* set(const double* _pdata)
{
if (m_pRealData == NULL)
{
return NULL;
}
typedef Double* (Double::*set_t)(const double*);
Double* pIT = checkRef(this, (set_t)&Double::set, _pdata);
if (pIT != this)
{
return pIT;
}
for (int i = 0; i < m_iSize; i++)
{
m_pRealData[i] = _pdata[i];
}
return this;
}
virtual bool isNativeType() override
{
return true;
}
virtual void fillDefaultValues() override
{
int size = getSize();
memset(m_pRealData, 0x00, sizeof(double) * size);
if (isComplex())
{
memset(m_pImgData, 0x00, sizeof(double) * size);
}
}
private:
virtual bool subMatrixToString(std::wostringstream& ostr, int* _piDims, int _iDims) override;
virtual double getNullValue();
virtual Double* createEmpty(int _iDims, int* _piDims, bool _bComplex = false);
virtual double copyValue(double _dblData);
virtual void deleteAll();
virtual void deleteImg();
virtual double* allocData(int _iSize);
virtual void deleteData(double /*data*/) { }
bool m_bViewAsInteger;
bool m_bViewAsZComplex;
};
}
#ifdef _MSC_VER
template class types::ArrayOf<double>; //Double
#endif
#endif /* !__DOUBLE_HXX__ */
|