[1]: http://mailinglists.scilab.org
[2]: http://bugzilla.scilab.org
+
Main new features
-----------------
* Newsfeed, providing a continuous feed of news, tips, and general communication from the community and from Scilab Enterprises.
* Licensing change: Scilab is now released under the terms of the GNU General Public License (GPL) v2.0 (but continues to be available under the terms of the CeCILL v2.1).
+
Installation
------------
-----------
* fixed / improved: `members`, `part`, `ode`, `ode_optional_output`, `ode_roots`, `roots`,
- `printf`, `sprintf`, `iconvert`, `stdev`, `xlabel`
-* rewriten: `consolebox`, `double`, `isoview`, `householder`, `or`, `and`, `format`, `typeof`
+ `printf`, `sprintf`, `iconvert`, `stdev`, `xlabel`, `and_op`, `or_op`
+* rewritten: `consolebox`, `double`, `isoview`, `householder`, `or`, `and`, `format`, `typeof`, `brackets`, `setlanguage`, `sleep`, `isinf`
* reorganized:
- `else`, `elseif`, `end`, `try`, `sciargs`, `global`, `halt`, `empty`, `power`
- CACSD and Signal Processing help pages have been sorted up.
- Colormaps and GUI/Menus subsections created
* translations added:
- - (fr): `format`, `typeof`, `isoview`, `ndgrid`, `bench_run`, `consolebox`, `harmean`
+ - (fr): `format`, `typeof`, `isoview`, `ndgrid`, `bench_run`, `consolebox`, `harmean`, `sleep`
- (ru): homepage
* [Bug #14590](http://bugzilla.scilab.org/show_bug.cgi?id=14590) fixed - Help pages in pt_BR directories had a wrong xml:lang="en" tag.
* [Bug #14593](http://bugzilla.scilab.org/show_bug.cgi?id=14593) fixed - Signs are no more drawn in BIGSOM and PRODUCT components.
* [Bug #14602](http://bugzilla.scilab.org/show_bug.cgi?id=14662) fixed - WRITEC_f block didn't work for x86 machines.
+* [Bug #14648](http://bugzilla.scilab.org/show_bug.cgi?id=14648) fixed - `isinf` returned `%F` for complex numbers with both real and imag infinite parts.
* [Bug #14662](http://bugzilla.scilab.org/show_bug.cgi?id=14662) fixed - Matrix of strings concatenation with single quote led to a parser error.
-
+* [Bug #14681](http://bugzilla.scilab.org/show_bug.cgi?id=14681) fixed - Short-circuited AND operation was not possible with double matrices in if and while clauses
### In 6.0.0 beta-2 and earlier:
dnl
dnl Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
dnl Copyright (C) INRIA - 2008 - Sylvestre Ledru
-dnl
+dnl
dnl Copyright (C) 2012 - 2016 - Scilab Enterprises
dnl
dnl This file is hereby licensed under the terms of the GNU GPL v2.0,
AC_MSG_CHECKING([for umfpack_di_solve in $with_umfpack_library])
save_LIBS="$LIBS"
LIBS="$BLAS_LIBS -L$with_umfpack_library -lm $LIBS"
- # We need -lm because sometime (ubuntu 7.10 for example) does not link libamd against lib math
+ # We need -lm because sometimes (ubuntu 7.10 for example) does not link libamd against lib math
AC_CHECK_LIB([umfpack], [umfpack_di_solve],
[UMFPACK_LIB="-L$with_umfpack_library -lumfpack $UMFPACK_LIB"; UMFPACK_OK=yes],
else
save_LIBS="$LIBS"
LIBS="$BLAS_LIBS $LIBS -lm" # libamd* is mandatory to link umfpack
- # We need -lm because sometime (ubuntu 7.10 for example) does not link libamd against lib math
+ # We need -lm because sometimes (ubuntu 7.10 for example) does not link libamd against lib math
AC_CHECK_LIB([amd], [amd_info],
[UMFPACK_LIB="-lamd"],
types::InternalType** out = pGstr->m_pOut;
types::String *pStr = NULL;
+ char* pstStrings;
- char* pstStrings = new char[_iLen];
-
- memset(pstStrings, ' ', _iLen);
if (_pstStrings == NULL)
{
addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocate variable"), "allocSingleString");
return sciErr.iErr;
}
+
+ pstStrings = new char[_iLen];
+ memset(pstStrings, ' ', _iLen);
_pstStrings[0] = pstStrings;
pStr = new types::String(pstStrings);
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
}
// &&
-int IntAndInt(types::InternalType* _pL, types::Bool** _pOut);
-int BoolAndBool(types::Bool* _pL, types::Bool** _pOut);
-int SparseBoolAndSparseBool(types::InternalType* _pL, types::Bool** _pOut);
+template<typename T>
+void isValueFalse(T* _pL, types::Bool** _pOut);
+template<>
+void isValueFalse(types::Double* _pL, types::Bool** _pOut);
+template<>
+void isValueFalse(types::SparseBool* _pL, types::Bool** _pOut);
+template<>
+void isValueFalse(types::Sparse* _pL, types::Bool** _pOut);
#undef DECLARE_AND_PROTO
#endif /* !__TYPES_AND_H__ */
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
}
// ||
-int IntOrInt(types::InternalType* _pL, types::Bool** _pOut);
-int DoubleOrDouble(types::Double* _pI1, types::Bool** _pOut);
-int BoolOrBool(types::Bool* _pI1, types::Bool** _pOut);
-int SparseBoolOrSparseBool(types::InternalType* _pL, types::Bool** _pOut);
+template<typename T>
+void isValueTrue(T* _pL, types::Bool** _pOut);
+template<>
+void isValueTrue(types::Double* _pL, types::Bool** _pOut);
+template<>
+void isValueTrue(types::SparseBool* _pL, types::Bool** _pOut);
+template<>
+void isValueTrue(types::Sparse* _pL, types::Bool** _pOut);
#endif /* __TYPES_OR_H__ */
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
InternalType* GenericShortcutAnd(InternalType* _pL)
{
InternalType* pResult = NULL;
- if (_pL->isBool())
- {
- BoolAndBool(_pL->getAs<Bool>(), (Bool**)&pResult);
- }
-
- if (_pL->isInt())
- {
- IntAndInt(_pL, (Bool**)&pResult);
- }
-
- if (_pL->isSparseBool())
+ switch (_pL->getType())
{
- SparseBoolAndSparseBool(_pL, (Bool**)&pResult);
+ case InternalType::ScilabBool :
+ isValueFalse(_pL->getAs<Bool>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabDouble :
+ isValueFalse(_pL->getAs<Double>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt8 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt8 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt16 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt16 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt32 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt32 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt64 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt64 :
+ isValueFalse(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabSparse :
+ isValueFalse(_pL->getAs<SparseBool>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabSparseBool :
+ isValueFalse(_pL->getAs<SparseBool>(), (Bool**)&pResult);
+ break;
+ default:
+ // will return NULL
+ break;
}
return pResult;
}
-// &
-InternalType* GenericLogicalAnd(InternalType* _pL, InternalType* _pR)
-{
- InternalType *pResult = NULL;
-
- and_function bit_and = pAndfunction[_pL->getId()][_pR->getId()];
- if (bit_and)
- {
- pResult = bit_and(_pL, _pR);
- if (pResult)
- {
- return pResult;
- }
- }
-
- /*
- ** Default case : Return NULL will Call Overloading.
- */
- return NULL;
-}
-
-int BoolAndBool(Bool* _pL, Bool** _pOut)
+template<typename T>
+void isValueFalse(T* _pL, types::Bool** _pOut)
{
for (int i = 0 ; i < _pL->getSize() ; i++)
{
if (_pL->get(i) == 0)
{
- //false && something -> false
- *_pOut = new Bool(0);
- return 0;
+ if ( !_pL->isComplex() || (_pL->getImg(i) == 0) )
+ {
+ *_pOut = new Bool(0); //false && something -> false
+ return;
+ }
}
}
//call non shortcut operation
*_pOut = NULL;
- return 0;
+ return;
}
-template <class K>
-static int IntAndInt(K* _pL, Bool** _pOut)
+template<>
+void isValueFalse(Double* _pL, Bool** _pOut)
{
+ if (_pL->isEmpty())
+ {
+ //call non shorcut operation
+ *_pOut = NULL;
+ return;
+ }
+
for (int i = 0 ; i < _pL->getSize() ; i++)
{
if (_pL->get(i) == 0)
{
- //false && something -> false
- *_pOut = new Bool(0);
- return 0;
+ if ( !_pL->isComplex() || (_pL->getImg(i) == 0) )
+ {
+ *_pOut = new Bool(0); //false && something -> false
+ return;
+ }
}
}
//call non shortcut operation
*_pOut = NULL;
- return 0;
+ return;
}
-int IntAndInt(InternalType* _pL, Bool** _pOut)
+template<>
+void isValueFalse(Sparse* _pL, Bool** _pOut)
{
- switch (_pL->getType())
+ if (_pL->nonZeros() != (size_t)_pL->getSize())
{
- case InternalType::ScilabInt8 :
- {
- return IntAndInt(_pL->getAs<Int8>(), _pOut);
- }
- case InternalType::ScilabUInt8 :
- {
- return IntAndInt(_pL->getAs<UInt8>(), _pOut);
- }
- case InternalType::ScilabInt16 :
- {
- return IntAndInt(_pL->getAs<Int16>(), _pOut);
- }
- case InternalType::ScilabUInt16 :
- {
- return IntAndInt(_pL->getAs<UInt16>(), _pOut);
- }
- case InternalType::ScilabInt32 :
- {
- return IntAndInt(_pL->getAs<Int32>(), _pOut);
- }
- case InternalType::ScilabUInt32 :
- {
- return IntAndInt(_pL->getAs<UInt32>(), _pOut);
- }
- case InternalType::ScilabInt64 :
- {
- return IntAndInt(_pL->getAs<Int64>(), _pOut);
- }
- case InternalType::ScilabUInt64 :
- {
- return IntAndInt(_pL->getAs<UInt64>(), _pOut);
- }
- default:
- {
- return 3;
- }
+ *_pOut = new Bool(0);
+ return;
}
+
+ *_pOut = NULL;
+ return;
}
-int SparseBoolAndSparseBool(InternalType* _pL, Bool** _pOut)
+template<>
+void isValueFalse(SparseBool* _pL, Bool** _pOut)
{
- SparseBool* pL = _pL->getAs<SparseBool>();
- if (pL->nbTrue() != (size_t)pL->getSize())
+ if (_pL->nbTrue() != (size_t)_pL->getSize())
{
*_pOut = new Bool(0);
- return 0;
+ return;
}
*_pOut = NULL;
- return 0;
+ return;
}
+// &
+InternalType* GenericLogicalAnd(InternalType* _pL, InternalType* _pR)
+{
+ InternalType *pResult = NULL;
+
+ and_function bit_and = pAndfunction[_pL->getId()][_pR->getId()];
+ if (bit_and)
+ {
+ pResult = bit_and(_pL, _pR);
+ if (pResult)
+ {
+ return pResult;
+ }
+ }
+
+ /*
+ ** Default case : Return NULL will Call Overloading.
+ */
+ return NULL;
+}
template<class T, class U, class O>
InternalType* and_M_M(T *_pL, U *_pR)
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS
* Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
+ * Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
scilab_fill_or(ScalarUInt64, Int64, int_S_M, UInt64, Int64, UInt64);
scilab_fill_or(ScalarUInt64, UInt64, int_S_M, UInt64, UInt64, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarInt8, int_S_S, UInt64, Int8, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarUInt8, int_S_S, UInt64, UInt8, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarInt16, int_S_S, UInt64, Int16, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarUInt16, int_S_S, UInt64, UInt16, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarInt32, int_S_S, UInt64, Int32, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarUInt32, int_S_S, UInt64, UInt32, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarInt64, int_S_S, UInt64, Int64, UInt64);
- scilab_fill_or(ScalarUInt64, ScalarUInt64, int_S_S, UInt64, UInt64, UInt64);
//boolean sparse
scilab_fill_or(SparseBool, SparseBool, M_M, SparseBool, SparseBool, SparseBool);
InternalType* GenericShortcutOr(InternalType* _pL)
{
InternalType* pResult = NULL;
-
- if (_pL->isBool())
- {
- BoolOrBool(_pL->getAs<Bool>(), (Bool**)&pResult);
- }
-
- if (_pL->isDouble())
- {
- DoubleOrDouble(_pL->getAs<Double>(), (Bool**)&pResult);
- }
-
- if (_pL->isInt())
- {
- IntOrInt(_pL, (Bool**)&pResult);
- }
-
- if (_pL->isSparseBool())
+ switch (_pL->getType())
{
- SparseBoolOrSparseBool(_pL, (Bool**)&pResult);
+ case InternalType::ScilabBool :
+ isValueTrue(_pL->getAs<Bool>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabDouble :
+ isValueTrue(_pL->getAs<Double>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt8 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt8 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt16 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt16 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt32 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt32 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabInt64 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabUInt64 :
+ isValueTrue(_pL->getAs<Int8>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabSparse :
+ isValueTrue(_pL->getAs<SparseBool>(), (Bool**)&pResult);
+ break;
+ case InternalType::ScilabSparseBool :
+ isValueTrue(_pL->getAs<SparseBool>(), (Bool**)&pResult);
+ break;
+ default:
+ // will return NULL
+ break;
}
-
return pResult;
}
-// |
-InternalType* GenericLogicalOr(InternalType* _pL, InternalType* _pR)
-{
- InternalType *pResult = NULL;
-
- or_function bit_or = pOrfunction[_pL->getId()][_pR->getId()];
- if (bit_or)
- {
- pResult = bit_or(_pL, _pR);
- if (pResult)
- {
- return pResult;
- }
- }
-
- /*
- ** Default case : Return NULL will Call Overloading.
- */
- return NULL;
-}
-
-int BoolOrBool(Bool* _pL, Bool** _pOut)
+template<typename T>
+void isValueTrue(T* _pL, types::Bool** _pOut)
{
for (int i = 0 ; i < _pL->getSize() ; i++)
{
{
//call non shortcut opearion
*_pOut = NULL;
- return 0;
+ return;
}
}
+ // All values are different than 0
*_pOut = new Bool(1); //true || something -> true
- return 0;
+ return;
}
-int DoubleOrDouble(Double* _pL, Bool** _pOut)
+template<>
+void isValueTrue(Double* _pL, Bool** _pOut)
{
if (_pL->isEmpty())
{
//call non shorcut operation
*_pOut = NULL;
- return 0;
+ return;
}
for (int i = 0 ; i < _pL->getSize() ; i++)
{
if (_pL->get(i) == 0)
{
- //call non shortcut operation
- *_pOut = NULL;
- return 0;
+ if ( !_pL->isComplex() || (_pL->getImg(i) == 0) )
+ {
+ // Any value is false, call non shortcut operation
+ *_pOut = NULL;
+ return;
+ }
}
}
- *_pOut = new Bool(1); //true || something -> true
- return 0;
+ // All values are True, return True
+ *_pOut = new Bool(1);
+ return;
}
-template <class K>
-static int IntOrInt(K* _pL, Bool** _pOut)
+template<>
+void isValueTrue(Sparse* _pL, Bool** _pOut)
{
- for (int i = 0 ; i < _pL->getSize() ; i++)
+ if (_pL->nonZeros() == (size_t)_pL->getSize())
{
- if (_pL->get(i) == 0)
- {
- //call non shortcut opearion
- *_pOut = NULL;
- return 0;
- }
+ *_pOut = new Bool(1);
+ return;
}
- *_pOut = new Bool(1); //true || something -> true
- return 0;
+ *_pOut = NULL;
+ return;
}
-int IntOrInt(InternalType* _pL, Bool** _pOut)
+template<>
+void isValueTrue(SparseBool* _pL, Bool** _pOut)
{
- switch (_pL->getType())
+ SparseBool* pL = _pL->getAs<SparseBool>();
+ if (pL->nbTrue() == pL->getSize())
{
- case InternalType::ScilabInt8 :
- {
- return IntOrInt(_pL->getAs<Int8>(), _pOut);
- }
- case InternalType::ScilabUInt8 :
- {
- return IntOrInt(_pL->getAs<UInt8>(), _pOut);
- }
- case InternalType::ScilabInt16 :
- {
- return IntOrInt(_pL->getAs<Int16>(), _pOut);
- }
- case InternalType::ScilabUInt16 :
- {
- return IntOrInt(_pL->getAs<UInt16>(), _pOut);
- }
- case InternalType::ScilabInt32 :
- {
- return IntOrInt(_pL->getAs<Int32>(), _pOut);
- }
- case InternalType::ScilabUInt32 :
- {
- return IntOrInt(_pL->getAs<UInt32>(), _pOut);
- }
- case InternalType::ScilabInt64 :
- {
- return IntOrInt(_pL->getAs<Int64>(), _pOut);
- }
- case InternalType::ScilabUInt64 :
- {
- return IntOrInt(_pL->getAs<UInt64>(), _pOut);
- }
- default:
- {
- return 3;
- }
+ *_pOut = new Bool(1);
+ return;
}
+
+ *_pOut = NULL;
+ return;
}
-int SparseBoolOrSparseBool(InternalType* _pL, Bool** _pOut)
+// |
+InternalType* GenericLogicalOr(InternalType* _pL, InternalType* _pR)
{
- SparseBool* pL = _pL->getAs<SparseBool>();
- if (pL->nbTrue() == pL->getSize())
+ InternalType *pResult = NULL;
+
+ or_function bit_or = pOrfunction[_pL->getId()][_pR->getId()];
+ if (bit_or)
{
- *_pOut = new Bool(1);
- return 0;
+ pResult = bit_or(_pL, _pR);
+ if (pResult)
+ {
+ return pResult;
+ }
}
- *_pOut = NULL;
- return 0;
+ /*
+ ** Default case : Return NULL will Call Overloading.
+ */
+ return NULL;
}
template<class T, class U, class O>
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2015 - Scilab Enteprises - Antoine ELIAS
+// Copyright (C) 2016 - Scilab Enteprises - Piere-Aime AGNEL
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
assert_checkerror("a3 + sparse(a2)", msprintf(msg1 + "%s", msprintf(msg2, "%s_a_sp")));
// and
//double & double
-assert_checkerror("a3 & a2", msprintf(msg1 + "%s", msprintf(msg2, "%s_h_s")));
-assert_checkerror("a2 & a3", msprintf(msg1 + "%s", msprintf(msg2, "%s_h_s")));
+// Converted first to boolean before & operation after https://codereview.scilab.org/#/c/18387/
+assert_checkerror("a3 & a2", msprintf(msg1 + "%s", msprintf(msg2, "%b_h_b")));
+assert_checkerror("a2 & a3", msprintf(msg1 + "%s", msprintf(msg2, "%b_h_b")));
//int & int
assert_checkerror("int8(a3) & int8(a2)", msprintf(msg1 + "%s", msprintf(msg2, "%i_h_i")));
assert_checkerror("int8(a2) & int8(a3)", msprintf(msg1 + "%s", msprintf(msg2, "%i_h_i")));
assert_checkerror("a3 * sparse(a2)", msprintf(msg1 + "%s", msprintf(msg2, "%s_m_sp")));
// or
//double | double
-assert_checkerror("a3 | a2", msprintf(msg1 + "%s", msprintf(msg2, "%s_g_s")));
-assert_checkerror("a2 | a3", msprintf(msg1 + "%s", msprintf(msg2, "%s_g_s")));
+// Converted first to boolean before | operation after https://codereview.scilab.org/#/c/18387/
+assert_checkerror("a3 | a2", msprintf(msg1 + "%s", msprintf(msg2, "%b_g_b")));
+assert_checkerror("a2 | a3", msprintf(msg1 + "%s", msprintf(msg2, "%b_g_b")));
//int | int
+// Converted first to boolean before | operation after https://codereview.scilab.org/#/c/18387/
assert_checkerror("int8(a3) | int8(a2)", msprintf(msg1 + "%s", msprintf(msg2, "%i_g_i")));
assert_checkerror("int8(a2) | int8(a3)", msprintf(msg1 + "%s", msprintf(msg2, "%i_g_i")));
//subtraction
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2015 - Scilab Enteprises - Antoine ELIAS
+// Copyright (C) 2016 - Scilab Enteprises - Piere-Aime AGNEL
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// and
//double & double
-assert_checkerror("a3 & a2", msprintf(msg1 + "%s", msprintf(msg2, "%s_h_s")));
-assert_checkerror("a2 & a3", msprintf(msg1 + "%s", msprintf(msg2, "%s_h_s")));
+// Converted first to boolean before & operation after https://codereview.scilab.org/#/c/18387/
+assert_checkerror("a3 & a2", msprintf(msg1 + "%s", msprintf(msg2, "%b_h_b")));
+assert_checkerror("a2 & a3", msprintf(msg1 + "%s", msprintf(msg2, "%b_h_b")));
//int & int
assert_checkerror("int8(a3) & int8(a2)", msprintf(msg1 + "%s", msprintf(msg2, "%i_h_i")));
// or
//double | double
-assert_checkerror("a3 | a2", msprintf(msg1 + "%s", msprintf(msg2, "%s_g_s")));
-assert_checkerror("a2 | a3", msprintf(msg1 + "%s", msprintf(msg2, "%s_g_s")));
+// Converted first to boolean before | operation after https://codereview.scilab.org/#/c/18387/
+assert_checkerror("a3 | a2", msprintf(msg1 + "%s", msprintf(msg2, "%b_g_b")));
+assert_checkerror("a2 | a3", msprintf(msg1 + "%s", msprintf(msg2, "%b_g_b")));
//int | int
+// Converted first to boolean before | operation after https://codereview.scilab.org/#/c/18387/
assert_checkerror("int8(a3) | int8(a2)", msprintf(msg1 + "%s", msprintf(msg2, "%i_g_i")));
assert_checkerror("int8(a2) | int8(a3)", msprintf(msg1 + "%s", msprintf(msg2, "%i_g_i")));
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- Non-regression test for bug 14681 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=14681
+//
+// <-- Short Description -->
+// Short circuited AND operation was not possible with double matrices in if and while clauses
+// Testing if
+global("bar");
+bar = 0;
+function res = foo()
+ warning("foo() should not be executed in this test");
+ global("bar");
+ bar = 1;
+ res = %t;
+endfunction
+andCond = %f;
+orCond = %t;
+if andCond && foo() then; end
+assert_checkequal(bar, 0);
+if andCond & foo() then; end
+assert_checkequal(bar, 0);
+if orCond | foo() then; end
+assert_checkequal(bar, 0);
+if orCond || foo() then; end
+assert_checkequal(bar, 0);
+andCond = 0;
+orCond = 1;
+if andCond && foo() then; end
+assert_checkequal(bar, 0);
+if andCond & foo() then; end
+assert_checkequal(bar, 0);
+if orCond | foo() then; end
+assert_checkequal(bar, 0);
+if orCond || foo() then; end
+assert_checkequal(bar, 0);
+andCond = int8(0);
+orCond = int8(1);
+if andCond && foo() then; end
+assert_checkequal(bar, 0);
+if andCond & foo() then; end
+assert_checkequal(bar, 0);
+if orCond | foo() then; end
+assert_checkequal(bar, 0);
+if orCond || foo() then; end
+assert_checkequal(bar, 0);
+clearglobal("bar");
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+
+// <-- Non-regression test for bug 14681 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=14681
+//
+// <-- Short Description -->
+// Short circuited AND operation was not possible with double matrices in if and while clauses
+
+// Testing if
+global("bar");
+bar = 0;
+function res = foo()
+ warning("foo() should not be executed in this test");
+ global("bar");
+ bar = 1;
+ res = %t;
+endfunction
+
+andCond = %f;
+orCond = %t;
+
+if andCond && foo() then; end
+assert_checkequal(bar, 0);
+if andCond & foo() then; end
+assert_checkequal(bar, 0);
+if orCond | foo() then; end
+assert_checkequal(bar, 0);
+if orCond || foo() then; end
+assert_checkequal(bar, 0);
+
+andCond = 0;
+orCond = 1;
+if andCond && foo() then; end
+assert_checkequal(bar, 0);
+if andCond & foo() then; end
+assert_checkequal(bar, 0);
+if orCond | foo() then; end
+assert_checkequal(bar, 0);
+if orCond || foo() then; end
+assert_checkequal(bar, 0);
+
+andCond = int8(0);
+orCond = int8(1);
+if andCond && foo() then; end
+assert_checkequal(bar, 0);
+if andCond & foo() then; end
+assert_checkequal(bar, 0);
+if orCond | foo() then; end
+assert_checkequal(bar, 0);
+if orCond || foo() then; end
+assert_checkequal(bar, 0);
+
+clearglobal("bar");
if b0 & b234 then bugmes();quit;end
if b0 & b1234 then bugmes();quit;end
//others case returns true and we do not want to test with '=='
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+resAandB = [%f %t; %f %f];
+sp_resAandB = sparse(resAandB);
+assert_checkequal( A & B , resAandB );
+assert_checkequal( A & iB , resAandB );
+assert_checkequal( iA & B , resAandB );
+assert_checkequal( cA & B , resAandB );
+assert_checkequal( A & cB , resAandB );
+assert_checkequal( cA & cB , resAandB );
+assert_checkequal( A & spB , sp_resAandB );
+assert_checkequal( spA & B , sp_resAandB );
+assert_checkequal( A & spbB , sp_resAandB );
+assert_checkequal( spbA & B , sp_resAandB );
+assert_checkequal( spA & spB , sp_resAandB );
+assert_checkequal( spA & spbB , sp_resAandB );
+assert_checkequal( spbA & spB , sp_resAandB );
+assert_checkequal( spbA & spbB , sp_resAandB );
+assert_checkequal( spbA & iB , sp_resAandB );
+assert_checkequal( iA & spbB , sp_resAandB );
+assert_checkequal( spA & iB , sp_resAandB );
+assert_checkequal( iA & spB , sp_resAandB );
+assert_checkequal( cA & spB , sp_resAandB );
+assert_checkequal( spA & cB , sp_resAandB );
+assert_checkequal( cA & spbB , sp_resAandB );
+assert_checkequal( spbA & cB , sp_resAandB );
+resAorB = [%t %t; %t %f];
+sp_resAorB = sparse(resAorB);
+assert_checkequal( A | B , resAorB );
+assert_checkequal( A | iB , resAorB );
+assert_checkequal( iA | B , resAorB );
+assert_checkequal( A | cB , resAorB );
+assert_checkequal( cA | B , resAorB );
+assert_checkequal( cA | cB , resAorB );
+assert_checkequal( A | spB , sp_resAorB );
+assert_checkequal( spA | B , sp_resAorB );
+assert_checkequal( A | spbB , sp_resAorB );
+assert_checkequal( spbA | B , sp_resAorB );
+assert_checkequal( spA | spB , sp_resAorB );
+assert_checkequal( spA | spbB , sp_resAorB );
+assert_checkequal( spbA | spB , sp_resAorB );
+assert_checkequal( spbA | spbB , sp_resAorB );
+assert_checkequal( spbA | iB , sp_resAorB );
+assert_checkequal( iA | spbB , sp_resAorB );
+assert_checkequal( spA | iB , sp_resAorB );
+assert_checkequal( iA | spB , sp_resAorB );
+assert_checkequal( cA | spB , sp_resAorB );
+assert_checkequal( spA | cB , sp_resAorB );
+assert_checkequal( cA | spbB , sp_resAorB );
+assert_checkequal( spbA | cB , sp_resAorB );
+// Integer manipulation
+// Integer representation
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+// Bitwise AND
+resIntAandB = int8([-2, 0; 126, -128]);
+resIntAorB = int8([-1, 1; 127, -127]);
+assert_checkequal( i8_A & i8_B , resIntAandB );
+assert_checkequal( i8_A | i8_B , resIntAorB );
+// Inttype promotion
+// int8 < int16 < int32 < int64
+// uint8 < uint16 < uint32 < uint64
+assert_checkequal( int16(i8_A) & i8_B , int16(resIntAandB) );
+assert_checkequal( int32(i8_A) & i8_B , int32(resIntAandB) );
+assert_checkequal( int64(i8_A) & i8_B , int64(resIntAandB) );
+assert_checkequal( uint16(i8_A) & i8_B , uint16(resIntAandB) );
+assert_checkequal( uint32(i8_A) & i8_B , uint32(resIntAandB) );
+assert_checkequal( uint64(i8_A) & i8_B , uint64(resIntAandB) );
+assert_checkequal( i8_A | int16(i8_B) , int16(resIntAorB) );
+assert_checkequal( i8_A | int32(i8_B) , int32(resIntAorB) );
+assert_checkequal( i8_A | int64(i8_B) , int64(resIntAorB) );
+assert_checkequal( i8_A | uint16(i8_B) , uint16(resIntAorB) );
+assert_checkequal( i8_A | uint32(i8_B) , uint32(resIntAorB) );
+assert_checkequal( i8_A | uint64(i8_B) , uint64(resIntAorB) );
if b0 & b234 then pause; end
if b0 & b1234 then pause; end
//others case returns true and we do not want to test with '=='
+
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+resAandB = [%f %t; %f %f];
+sp_resAandB = sparse(resAandB);
+
+assert_checkequal( A & B , resAandB );
+assert_checkequal( A & iB , resAandB );
+assert_checkequal( iA & B , resAandB );
+assert_checkequal( cA & B , resAandB );
+assert_checkequal( A & cB , resAandB );
+assert_checkequal( cA & cB , resAandB );
+
+assert_checkequal( A & spB , sp_resAandB );
+assert_checkequal( spA & B , sp_resAandB );
+assert_checkequal( A & spbB , sp_resAandB );
+assert_checkequal( spbA & B , sp_resAandB );
+assert_checkequal( spA & spB , sp_resAandB );
+assert_checkequal( spA & spbB , sp_resAandB );
+assert_checkequal( spbA & spB , sp_resAandB );
+assert_checkequal( spbA & spbB , sp_resAandB );
+assert_checkequal( spbA & iB , sp_resAandB );
+assert_checkequal( iA & spbB , sp_resAandB );
+assert_checkequal( spA & iB , sp_resAandB );
+assert_checkequal( iA & spB , sp_resAandB );
+assert_checkequal( cA & spB , sp_resAandB );
+assert_checkequal( spA & cB , sp_resAandB );
+assert_checkequal( cA & spbB , sp_resAandB );
+assert_checkequal( spbA & cB , sp_resAandB );
+
+resAorB = [%t %t; %t %f];
+sp_resAorB = sparse(resAorB);
+
+assert_checkequal( A | B , resAorB );
+assert_checkequal( A | iB , resAorB );
+assert_checkequal( iA | B , resAorB );
+assert_checkequal( A | cB , resAorB );
+assert_checkequal( cA | B , resAorB );
+assert_checkequal( cA | cB , resAorB );
+
+assert_checkequal( A | spB , sp_resAorB );
+assert_checkequal( spA | B , sp_resAorB );
+assert_checkequal( A | spbB , sp_resAorB );
+assert_checkequal( spbA | B , sp_resAorB );
+assert_checkequal( spA | spB , sp_resAorB );
+assert_checkequal( spA | spbB , sp_resAorB );
+assert_checkequal( spbA | spB , sp_resAorB );
+assert_checkequal( spbA | spbB , sp_resAorB );
+assert_checkequal( spbA | iB , sp_resAorB );
+assert_checkequal( iA | spbB , sp_resAorB );
+assert_checkequal( spA | iB , sp_resAorB );
+assert_checkequal( iA | spB , sp_resAorB );
+assert_checkequal( cA | spB , sp_resAorB );
+assert_checkequal( spA | cB , sp_resAorB );
+assert_checkequal( cA | spbB , sp_resAorB );
+assert_checkequal( spbA | cB , sp_resAorB );
+
+// Integer manipulation
+
+// Integer representation
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+// Bitwise AND
+resIntAandB = int8([-2, 0; 126, -128]);
+resIntAorB = int8([-1, 1; 127, -127]);
+
+assert_checkequal( i8_A & i8_B , resIntAandB );
+assert_checkequal( i8_A | i8_B , resIntAorB );
+
+// Inttype promotion
+// int8 < int16 < int32 < int64
+// uint8 < uint16 < uint32 < uint64
+assert_checkequal( int16(i8_A) & i8_B , int16(resIntAandB) );
+assert_checkequal( int32(i8_A) & i8_B , int32(resIntAandB) );
+assert_checkequal( int64(i8_A) & i8_B , int64(resIntAandB) );
+assert_checkequal( uint16(i8_A) & i8_B , uint16(resIntAandB) );
+assert_checkequal( uint32(i8_A) & i8_B , uint32(resIntAandB) );
+assert_checkequal( uint64(i8_A) & i8_B , uint64(resIntAandB) );
+
+assert_checkequal( i8_A | int16(i8_B) , int16(resIntAorB) );
+assert_checkequal( i8_A | int32(i8_B) , int32(resIntAorB) );
+assert_checkequal( i8_A | int64(i8_B) , int64(resIntAorB) );
+assert_checkequal( i8_A | uint16(i8_B) , uint16(resIntAorB) );
+assert_checkequal( i8_A | uint32(i8_B) , uint32(resIntAorB) );
+assert_checkequal( i8_A | uint64(i8_B) , uint64(resIntAorB) );
+
+
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU
- *
+ *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
</refsection>
<refsection>
<title>Examples</title>
- <programlisting role="example"><![CDATA[
+ <programlisting role="example"><![CDATA[
// This example shows how to write a Scilab string in Scilab engine
-// It is the equivalent to A="my Message"; in Scilab interpretor
+// It is the equivalent to A="my Message"; in Scilab interpreter
// See: modules/call_scilab/examples/basicExamples/readwritestring.c
// StartScilab
/*
* Prior to Scilab 5.2
- * C2F(cwritechain)(variableName, &sizeOfMyString , myString, strlen(variableName), sizeOfMyString);
+ * C2F(cwritechain)(variableName, &sizeOfMyString , myString, strlen(variableName), sizeOfMyString);
*/
printf("Display from Scilab of A:\n");
SendScilabJob("disp(A);"); /* Display A */
]]></programlisting>
- <programlisting role="example"><![CDATA[
+ <programlisting role="example"><![CDATA[
/* Load the previously set variable A */
// See: modules/call_scilab/examples/basicExamples/readwritestring.c
strcat(new_line, stringToAddAtTheEnd);
}
- if (stringToAddAtTheEnd)
- {
- FREE(stringToAddAtTheEnd);
- stringToAddAtTheEnd = NULL;
- }
+ FREE(stringToAddAtTheEnd);
+ stringToAddAtTheEnd = NULL;
return new_line;
}
/* bug 4365 */
/*cd SCI/modules/arnoldi/nonreg_tes */
- if (drv)
- {
- FREE(drv);
- drv = NULL;
- }
- if (dir)
- {
- FREE(dir);
- dir = NULL;
- }
- if (name)
- {
- FREE(name);
- name = NULL;
- }
- if (ext)
- {
- FREE(ext);
- ext = NULL;
- }
+ FREE(drv);
+ drv = NULL;
+ FREE(dir);
+ dir = NULL;
+ FREE(name);
+ name = NULL;
+ FREE(ext);
+ ext = NULL;
lengthNewLine = lencurrentline + lenstringToAddAtTheEnd;
new_line = (char*)MALLOC(sizeof(char) * (lengthNewLine + 1));
strcat(new_line, stringToAddAtTheEnd);
}
- if (stringToAddAtTheEnd)
- {
- FREE(stringToAddAtTheEnd);
- stringToAddAtTheEnd = NULL;
- }
+ FREE(stringToAddAtTheEnd);
+ stringToAddAtTheEnd = NULL;
return new_line;
}
- if (drv)
- {
- FREE(drv);
- drv = NULL;
- }
- if (dir)
- {
- FREE(dir);
- dir = NULL;
- }
- if (name)
- {
- FREE(name);
- name = NULL;
- }
- if (ext)
- {
- FREE(ext);
- ext = NULL;
- }
+ FREE(drv);
+ drv = NULL;
+ FREE(dir);
+ dir = NULL;
+ FREE(name);
+ name = NULL;
+ FREE(ext);
+ ext = NULL;
}
}
strcat(new_line, stringToAddAtTheEnd);
}
- if (stringToAddAtTheEnd)
- {
- FREE(stringToAddAtTheEnd);
- stringToAddAtTheEnd = NULL;
- }
+ FREE(stringToAddAtTheEnd);
+ stringToAddAtTheEnd = NULL;
return new_line;
}
}
/**
- * Set the filter to apply to the dictionnary
+ * Set the filter to apply to the dictionary
* @param filterToSet the filter to set
*/
public void setFilter(String filterToSet) {
package org.scilab.modules.completion;
- /**
- * @author Allan CORNET
- * @copyright INRIA 2007
- */
+/**
+ * @author Allan CORNET
+ * @copyright INRIA 2007
+ */
public class Completion {
- /**
- * Constructor
- */
- protected Completion() {
- throw new UnsupportedOperationException();
- }
-
-/**
-* completion function on all types for scilab
-* @param[in] somechars first characters of a word
-* @return an array of chars
-*/
-public static String[] searchAllDictionaries(String somechars) {
- return CompletionJNI.searchAllDictionaries(somechars);
- }
-
-
-/**
-* completion function on Functions for scilab
-* @param[in] somechars first characters of a word
-* @return an array of chars
-*/
-public static String[] searchFunctionsDictionary(String somechars) {
- return CompletionJNI.searchFunctionsDictionary(somechars);
- }
-
-
-/**
-* completion function on command words for scilab
-* @param[in] somechars first characters of a word
-* @return an array of chars
-*/
-public static String[] searchCommandsDictionary(String somechars) {
- return CompletionJNI.searchCommandsDictionary(somechars);
- }
-
-
-/**
-* completion function on Macros in libraries for scilab
-* @param[in] somechars first characters of a word
-* @return an array of chars
-*/
-public static String[] searchMacrosDictionary(String somechars) {
- return CompletionJNI.searchMacrosDictionary(somechars);
- }
-
-
-/**
-* completion function on Variables for scilab
-* @param[in] somechars first characters of a word
-* @return an array of chars
-*/
-public static String[] searchVariablesDictionary(String somechars) {
- return CompletionJNI.searchVariablesDictionary(somechars);
- }
-
-
-/**
-* completion function on files for scilab
-* @param[in] somechars first characters of a word
-* @return an array of chars
-*/
-public static String[] searchFilesDictionary(String somechars) {
- return CompletionJNI.searchFilesDictionary(somechars);
- }
-
-
-/**
-* completion function on files for scilab
-* @param[in] the line before the caret
-* @param[in] the part
-* @return an array of chars
-*/
-public static String[] searchFieldsDictionary(String lineBeforeCaret, String pattern) {
- return CompletionJNI.searchFieldsDictionary(lineBeforeCaret, pattern);
- }
-
-
-/**
-* completion handle graphics properties for scilab
-* @param[in] somechars first characters of a word
-* @return an array of chars
-*/
-public static String[] searchHandleGraphicsPropertiesDictionary(String somechars) {
- return CompletionJNI.searchHandleGraphicsPropertiesDictionary(somechars);
- }
-
-
-/**
-* pre parsing current line to search with completion
-* @param[in] current line
-* @return word to find with completion
-*/
-public static String getPartLevel(String line) {
- return CompletionJNI.getPartLevel(line);
- }
-
-
-/**
-* pre parsing current line to search with completion (file)
-* @param[in] current line
-* @return word to find with completion
-*/
-public static String getFilePartLevel(String line) {
- return CompletionJNI.getFilePartLevel(line);
- }
-
-
-/**
-* Get common part to a array
-* @param[in] string array
-* @param[in] size of string array
-* @return common part
-*/
-public static String getCommonPart(String[] dictionnary, int sizeDictionnary) {
- return CompletionJNI.getCommonPart(dictionnary, sizeDictionnary);
- }
-
-
-/**
-* complete line
-* @param[in] current line (before caret)
-* @param[in] line to add
-* @param[in] type of line to add
-* @param[in] line after caret
-* @return modified line
-*/
-public static String completelineforjava(String currentLine, String stringToAdd, boolean isFile, String postCaretLine) {
- return CompletionJNI.completelineforjava(currentLine, stringToAdd, isFile, postCaretLine);
- }
+ /**
+ * Constructor
+ */
+ protected Completion() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * completion function on all types for scilab
+ * @param[in] somechars first characters of a word
+ * @return an array of chars
+ */
+ public static String[] searchAllDictionaries(String somechars) {
+ return CompletionJNI.searchAllDictionaries(somechars);
+ }
+
+
+ /**
+ * completion function on Functions for scilab
+ * @param[in] somechars first characters of a word
+ * @return an array of chars
+ */
+ public static String[] searchFunctionsDictionary(String somechars) {
+ return CompletionJNI.searchFunctionsDictionary(somechars);
+ }
+
+
+ /**
+ * completion function on command words for scilab
+ * @param[in] somechars first characters of a word
+ * @return an array of chars
+ */
+ public static String[] searchCommandsDictionary(String somechars) {
+ return CompletionJNI.searchCommandsDictionary(somechars);
+ }
+
+
+ /**
+ * completion function on Macros in libraries for scilab
+ * @param[in] somechars first characters of a word
+ * @return an array of chars
+ */
+ public static String[] searchMacrosDictionary(String somechars) {
+ return CompletionJNI.searchMacrosDictionary(somechars);
+ }
+
+
+ /**
+ * completion function on Variables for scilab
+ * @param[in] somechars first characters of a word
+ * @return an array of chars
+ */
+ public static String[] searchVariablesDictionary(String somechars) {
+ return CompletionJNI.searchVariablesDictionary(somechars);
+ }
+
+
+ /**
+ * completion function on files for scilab
+ * @param[in] somechars first characters of a word
+ * @return an array of chars
+ */
+ public static String[] searchFilesDictionary(String somechars) {
+ return CompletionJNI.searchFilesDictionary(somechars);
+ }
+
+
+ /**
+ * completion function on files for scilab
+ * @param[in] the line before the caret
+ * @param[in] the part
+ * @return an array of chars
+ */
+ public static String[] searchFieldsDictionary(String lineBeforeCaret, String pattern) {
+ return CompletionJNI.searchFieldsDictionary(lineBeforeCaret, pattern);
+ }
+
+
+ /**
+ * completion handle graphics properties for scilab
+ * @param[in] somechars first characters of a word
+ * @return an array of chars
+ */
+ public static String[] searchHandleGraphicsPropertiesDictionary(String somechars) {
+ return CompletionJNI.searchHandleGraphicsPropertiesDictionary(somechars);
+ }
+
+
+ /**
+ * pre parsing current line to search with completion
+ * @param[in] current line
+ * @return word to find with completion
+ */
+ public static String getPartLevel(String line) {
+ return CompletionJNI.getPartLevel(line);
+ }
+
+
+ /**
+ * pre parsing current line to search with completion (file)
+ * @param[in] current line
+ * @return word to find with completion
+ */
+ public static String getFilePartLevel(String line) {
+ return CompletionJNI.getFilePartLevel(line);
+ }
+
+
+ /**
+ * Get common part to a array
+ * @param[in] string array
+ * @param[in] size of string array
+ * @return common part
+ */
+ public static String getCommonPart(String[] dictionary, int sizeDictionary) {
+ return CompletionJNI.getCommonPart(dictionary, sizeDictionary);
+ }
+
+
+ /**
+ * complete line
+ * @param[in] current line (before caret)
+ * @param[in] line to add
+ * @param[in] type of line to add
+ * @param[in] line after caret
+ * @return modified line
+ */
+ public static String completelineforjava(String currentLine, String stringToAdd, boolean isFile, String postCaretLine) {
+ return CompletionJNI.completelineforjava(currentLine, stringToAdd, isFile, postCaretLine);
+ }
}
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2007 - INRIA - Allan CORNET
- *
+ *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
*/
/* Completion.i */
/**
- * Windows: swig -java -package org.scilab.modules.completion -outdir ../java/org/scilab/modules/completion/ Completion.i
+ * Windows: swig -java -package org.scilab.modules.completion -outdir ../java/org/scilab/modules/completion/ Completion.i
* Other: Use the option --enable-build-swig to the configure
*/
%module Completion
%pragma(java) jniclassclassmodifiers=%{
/* It is generated code. Disable checkstyle */
//CHECKSTYLE:OFF
- /**
+ /**
* @author Allan CORNET
* @copyright INRIA 2007
*/
/* JavaDoc for Completion class */
%pragma(java) moduleclassmodifiers="
- /**
+ /**
* @author Allan CORNET
* @copyright INRIA 2007
*/
/**
* completion function on all types for scilab
* @param[in] somechars first characters of a word
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchAllDictionaries(char *somechars);
/**
* completion function on Functions for scilab
* @param[in] somechars first characters of a word
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchFunctionsDictionary(char *somechars);
/**
* completion function on command words for scilab
* @param[in] somechars first characters of a word
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchCommandsDictionary(char *somechars);
/**
* completion function on Macros in libraries for scilab
* @param[in] somechars first characters of a word
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchMacrosDictionary(char *somechars);
/**
* completion function on Variables for scilab
* @param[in] somechars first characters of a word
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchVariablesDictionary(char *somechars);
/**
* completion function on files for scilab
* @param[in] somechars first characters of a word
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchFilesDictionary(char *somechars);
* completion function on files for scilab
* @param[in] the line before the caret
* @param[in] the part
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchFieldsDictionary(char *lineBeforeCaret, char *pattern);
/**
* completion handle graphics properties for scilab
* @param[in] somechars first characters of a word
-* @return an array of chars
+* @return an array of chars
*/
public";
char **searchHandleGraphicsPropertiesDictionary(char *somechars);
char *getFilePartLevel(char *line);
/* JavaDoc */
-%javamethodmodifiers getCommonPart(char **dictionnary, int sizeDictionnary) "
+%javamethodmodifiers getCommonPart(char **dictionary, int sizeDictionary) "
/**
* Get common part to a array
* @param[in] string array
* @return common part
*/
public";
-char *getCommonPart(char **dictionnary, int sizeDictionnary);
+char *getCommonPart(char **dictionary, int sizeDictionary);
/* JavaDoc */
%javamethodmodifiers completelineforjava(char *currentLine, char *stringToAdd, BOOL isFile, char *postCaretLine) "
* @param[in] line to add
* @param[in] type of line to add
* @param[in] line after caret
-* @return modified line
+* @return modified line
*/
public";
char *completelineforjava(char *currentLine,char *stringToAdd,BOOL isFile, char *postCaretLine);
char *lineBeforeCaret, char *lineAfterCaret, char *filePattern, char *defaultPattern,
char **wk_buf, unsigned int *cursor, unsigned int *cursor_max);
static int CopyLineAtPrompt(char **wk_buf, char *line, unsigned int *cursor, unsigned int *cursor_max);
-static void separateFilesDirectories(char** dictionnary, int size, char*** files, int* sizeFiles, char*** directories, int* sizeDirectories);
+static void separateFilesDirectories(char** dictionary, int size, char*** files, int* sizeFiles, char*** directories, int* sizeDirectories);
static void TermCompletionOnAll(char *lineBeforeCaret, char *lineAfterCaret, char *defaultPattern, char **wk_buf, unsigned int *cursor,
unsigned int *cursor_max);
char *string4, char *string5);
static void TermCompletionOnFiles(char **dictionaryFiles, int sizedictionaryFiles,
char *lineBeforeCaret, char *lineAfterCaret, char *filePattern, char *defaultPattern);
-static void separateFilesDirectories(char** dictionnary, int size, char*** files, int* sizeFiles, char*** directories, int* sizeDirectories);
+static void separateFilesDirectories(char** dictionary, int size, char*** files, int* sizeFiles, char*** directories, int* sizeDirectories);
static void TermCompletionOnAll(char *lineBeforeCaret, char *lineAfterCaret, char *defaultPattern);
/*--------------------------------------------------------------------------*/
static void TermCompletionOnFiles(char **dictionaryFiles, int sizedictionaryFiles,
public class SciCompletionManager implements CompletionManager {
- protected List<CompletionItem> dictionnary;
+ protected List<CompletionItem> dictionary;
private InputParsingManager inputParsingManager;
/**
public List<CompletionItem> getCompletionItems() {
int compLevel = inputParsingManager.getCompletionLevel();
- // Build dictionnary
- dictionnary = new ArrayList<CompletionItem>();
+ // Build dictionary
+ dictionary = new ArrayList<CompletionItem>();
// Get the completion part used to filter the paths/files dictionary
String fileSearchedPattern = ((SciInputParsingManager) inputParsingManager).getFilePartLevel(compLevel);
- String[] scilabFilesDictionnary = Completion.searchFilesDictionary(fileSearchedPattern);
- //addItemsToDictionnary(Messages.gettext("File or Directory"), scilabFilesDictionnary);
+ String[] scilabFilesDictionary = Completion.searchFilesDictionary(fileSearchedPattern);
+ //addItemsToDictionary(Messages.gettext("File or Directory"), scilabFilesDictionary);
- if (scilabFilesDictionnary != null) {
+ if (scilabFilesDictionary != null) {
ArrayList<String> files = new ArrayList<String>();
ArrayList<String> directories = new ArrayList<String>();
- separateFilesDirectories(scilabFilesDictionnary, files, directories);
- String[] filesDictionnary = files.toArray(new String[files.size()]);
- String[] directoriesDictionnary = directories.toArray(new String[directories.size()]);
+ separateFilesDirectories(scilabFilesDictionary, files, directories);
+ String[] filesDictionary = files.toArray(new String[files.size()]);
+ String[] directoriesDictionary = directories.toArray(new String[directories.size()]);
- addItemsToDictionnary(Messages.gettext("File"), filesDictionnary);
- addItemsToDictionnary(Messages.gettext("Directory"), directoriesDictionnary);
+ addItemsToDictionary(Messages.gettext("File"), filesDictionary);
+ addItemsToDictionary(Messages.gettext("Directory"), directoriesDictionary);
} else {
// Get the completion part used to filter the dictionary
String searchedPattern = inputParsingManager.getPartLevel(compLevel);
String commandLine = inputParsingManager.getCommandLine();
- String[] scilabFieldsDictionnary = Completion.searchFieldsDictionary(commandLine, searchedPattern);
- if (scilabFieldsDictionnary != null) {
- addItemsToDictionnary(Messages.gettext("Field"), scilabFieldsDictionnary);
+ String[] scilabFieldsDictionary = Completion.searchFieldsDictionary(commandLine, searchedPattern);
+ if (scilabFieldsDictionary != null) {
+ addItemsToDictionary(Messages.gettext("Field"), scilabFieldsDictionary);
} else {
- String[] scilabCommandsDictionnary = Completion.searchCommandsDictionary(searchedPattern);
- addItemsToDictionnary(Messages.gettext("Scilab Command"), scilabCommandsDictionnary);
+ String[] scilabCommandsDictionary = Completion.searchCommandsDictionary(searchedPattern);
+ addItemsToDictionary(Messages.gettext("Scilab Command"), scilabCommandsDictionary);
- String[] scilabFunctionsDictionnary = Completion.searchFunctionsDictionary(searchedPattern);
- addItemsToDictionnary(Messages.gettext("Scilab Function"), scilabFunctionsDictionnary);
+ String[] scilabFunctionsDictionary = Completion.searchFunctionsDictionary(searchedPattern);
+ addItemsToDictionary(Messages.gettext("Scilab Function"), scilabFunctionsDictionary);
- String[] scilabHandlesDictionnary = Completion.searchHandleGraphicsPropertiesDictionary(searchedPattern);
- addItemsToDictionnary(Messages.gettext("Graphics handle field"), scilabHandlesDictionnary);
+ String[] scilabHandlesDictionary = Completion.searchHandleGraphicsPropertiesDictionary(searchedPattern);
+ addItemsToDictionary(Messages.gettext("Graphics handle field"), scilabHandlesDictionary);
- String[] scilabMacrosDictionnary = Completion.searchMacrosDictionary(searchedPattern);
- addItemsToDictionnary(Messages.gettext("Scilab Macro"), scilabMacrosDictionnary);
+ String[] scilabMacrosDictionary = Completion.searchMacrosDictionary(searchedPattern);
+ addItemsToDictionary(Messages.gettext("Scilab Macro"), scilabMacrosDictionary);
- String[] scilabVariablesDictionnary = Completion.searchVariablesDictionary(searchedPattern);
- addItemsToDictionnary(Messages.gettext("Scilab Variable"), scilabVariablesDictionnary);
+ String[] scilabVariablesDictionary = Completion.searchVariablesDictionary(searchedPattern);
+ addItemsToDictionary(Messages.gettext("Scilab Variable"), scilabVariablesDictionary);
}
}
- return dictionnary;
+ return dictionary;
}
/**
/**
* Associate an interpreting tool to this completion manager
- * @param interpretor an interpreting tool
+ * @param interpreter an interpreting tool
* @see com.artenum.rosetta.interfaces.core.CompletionManager#setInputParsingManager(com.artenum.rosetta.interfaces.core.InputParsingManager)
*/
@Override
- public void setInterpretor(GenericInterpreter interpretor) {
+ public void setInterpretor(GenericInterpreter interpreter) {
// No need for Scilab implementation
}
/**
- * Add items to current completion dictionnary
+ * Add items to current completion dictionary
* @param type type of the items to add
* @param items all items to add
*/
- public void addItemsToDictionnary(String type, String[] items) {
+ public void addItemsToDictionary(String type, String[] items) {
if (items != null) {
for (int i = 0; i < items.length; i++) {
- dictionnary.add(new CompletionItemImpl(type, items[i] + " (" + type + ")", items[i], Messages.gettext("No help")));
+ dictionary.add(new CompletionItemImpl(type, items[i] + " (" + type + ")", items[i], Messages.gettext("No help")));
}
}
}
/**
* Separate files from directories
- * @param scilabFilesDictionnary the input containing both
- * @param filesDictionnary output: only the files
- * @param directoriesDictionnary output: only the directories
+ * @param scilabFilesDictionary the input containing both
+ * @param filesDictionary output: only the files
+ * @param directoriesDictionary output: only the directories
*/
- public void separateFilesDirectories(String[] scilabFilesDictionnary, ArrayList<String> filesDictionnary, ArrayList<String> directoriesDictionnary) {
+ public void separateFilesDirectories(String[] scilabFilesDictionary, ArrayList<String> filesDictionary, ArrayList<String> directoriesDictionary) {
String fileSep = System.getProperty("file.separator");
- for (String word : scilabFilesDictionnary) {
+ for (String word : scilabFilesDictionary) {
if (word.endsWith(fileSep)) {
- directoriesDictionnary.add(new String(word));
+ directoriesDictionary.add(new String(word));
} else {
- filesDictionnary.add(new String(word));
+ filesDictionary.add(new String(word));
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2016 - Samuel GOUGEON
+ *
+ * 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.
+ *
+ -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="brackets">
<refnamediv>
- <refname>brackets</refname>
- <refpurpose>([,]) left and right brackets</refpurpose>
+ <refname>brackets [,;]</refname>
+ <refpurpose>Concatenation. Recipients of an assignment. Results of a function</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>[a11,a12,...;a21,a22,...;...]
- [s1,s2,...]=func(...)
+ <synopsis>
+ Mh = [m11 m12 m13.. m1N] or [m11, m12, m13,.., m1N]
+ Mv = [m11 ; m21 ; m31..; mN1]
+ M = [m11, m12,...; m21, m22,...;...]
+ [r1, r2,...] = func(...)
+ [r1, r2,.., rN] = (e1, e2, .., eN)
+ [r1, r2,.., rk] = (e1, e2, .., ek,.., eN)
+ [r1, r2,.., rN] = mylist(:)
+ [r1, r2,.., rN] = S.field([i1 i2.. iN])
</synopsis>
</refsynopsisdiv>
- <refsection>
+ <refsection role="parameters">
<title>Arguments</title>
<variablelist>
<varlistentry>
- <term>a11,a12,... </term>
+ <term>m11, m12,... </term>
<listitem>
<para>
- any matrix (real, polynomial, rational, <literal>syslin</literal> list ...) with appropriate dimensions
+ Set of objects to be
+ concatenated (and merged: the former individual containers
+ are removed).
+ The following subsets of types of objects can be mixed
+ in-between, but are mutually exclusive:
+ <itemizedlist>
+ <listitem>Matrices of booleans, reals, complex numbers,
+ polynomials, rationals: The data type of the
+ concatenated result is set by the rules defined below
+ (see the <link linkend="brackets_Types_conversions">
+ <emphasis role="italic">type conversions</emphasis>
+ </link> rules).
+ </listitem>
+ <listitem>Matrices of encoded integers of any
+ <link linkend="inttype">inttype</link>.
+ <warning>
+ Encoded integers of different inttypes can't
+ be concatenated together.
+ </warning>
+ </listitem>
+ <listitem>Arrays of structures with same fields.
+ Fields may be in different orders from an array
+ to other ones.
+ </listitem>
+ <listitem>
+ Typed lists of type <link linkend="syslin">syslin</link>.
+ </listitem>
+ </itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>s1,s2,... </term>
+ <term>M, Mh, Mv</term>
<listitem>
- <para>any possible variable name</para>
+ <para>
+ Matrices with the type of all <varname>m##</varname>
+ (if they all have the same data type)
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>e1, e2,.. </term>
+ <listitem>
+ <para>Input objects (literals like <literal>-1.23</literal>
+ or <literal>"abcd"</literal>, variables, or expressions
+ like <literal>a+%pi</literal>, etc).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>mylist</term>
+ <listitem>
+ <para>a simple list</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>S.field</term>
+ <listitem>
+ <para>
+ Array of Structures with a field named <literal>field</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>i1, i2,.. </term>
+ <listitem>
+ <para>
+ Indices of components selected from <varname>S</varname>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>r1, r2,... </term>
+ <listitem>
+ <para>Output variables</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
- <refsection>
+ <refsection role="description">
<title>Description</title>
- <para>
- Left and right brackets are used to note vector and matrix concatenation.
- These symbols are also used to denote a multiple left-hand-side for a function
- call.
- </para>
- <para>
- Inside concatenation brackets, blank or comma characters mean
- "column concatenation", semicolon and carriage-return mean
- "row concatenation".
- </para>
- <para>
- Note : to avoid confusions it is safer to use commas instead of blank to
- separate columns.
- </para>
- <para>
- Within multiple lhs brackets variable names must be separated by comma.
- </para>
+ <variablelist>
+ <varlistentry>
+ <term>[] on right-hand side: concatenators</term>
+ <listitem>
+ <para>[..] bundle their contents of simple and compatible
+ types into a homogeneous vector, matrix or hypermatrix.
+ </para>
+ <note>An horizontal or a vertical concatenation is a
+ binary iterated operator. It is performed step-by-step
+ from left-to-right, and from top-to-bottom. Thus,
+ <literal>[1 3 5 7]</literal> is performed as
+ <literal>[[[1 3] 5] 7]</literal>.
+ </note>
+ <para>Inside brackets,
+ <itemizedlist>
+ <listitem>spaces (blanks or tabs) or commas are
+ used as columns separators.
+ <note>Using commas instead of spaces is safer.
+ For instance, <literal>[2 1 +%i]</literal>
+ means <literal>[2, 1, %i]</literal>, while
+ <literal>[2 1 + %i]</literal> means
+ <literal>[2, 1+%i]</literal>
+ </note>
+ </listitem>
+ <listitem>semi-colons or carriage-return are used
+ as rows separators. Multiple rows do not need
+ the continuation dots <literal>..</literal>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <refsect3 id="brackets_Types_conversions">
+ <title>Types conversions</title>
+ <para>
+ In some limits, brackets may be applied on a set of
+ data having different but compatible types. In this
+ case, some data are converted into the dominating type
+ available in the set. The main conversion rules are the
+ following:
+ <orderedlist>
+ <listitem>boolean < decimal number < complex
+ </listitem>
+ <listitem>decimal number < polynomial < rational
+ <warning>booleans and polynomials are not compatible.
+ <itemizedlist>
+ <listitem>
+ <literal>[%t 2. %z]</literal> is accepted:
+ <literal>[%t 2.]</literal> is first
+ converted into
+ <literal>[1. 2.]</literal>, and then
+ <literal>[[1. 2.] %z]</literal> is accepted.
+ </listitem>
+ <listitem>
+ <literal>[%z %t 2.]</literal> is
+ rejected and yields an error.
+ Indeed, <literal>[%z %t]</literal>
+ can't be converted first.
+ </listitem>
+ </itemizedlist>
+ </warning>
+ </listitem>
+ <listitem>
+ The result becomes complex-encoded as soon as
+ a complex-encoded component -- value, polynomial,
+ or rational -- is met in the list
+ (even with a null imaginary part)
+ <para>Similarly, the result becomes sparse-encoded
+ as soon as a sparse-encoded component is met
+ and processed.
+ </para>
+ </listitem>
+ <listitem>
+ It is possible to concatenate polynomials or/and
+ rationals having different variable names. Then,
+ the first polynomial or rational met in the list
+ sets the variable name to the concatenation result:
+ <literal>[%z, 1+%s, 1-%i*%s]
+ // => [z, 1+z, 1-iz]
+ </literal>.
+ </listitem>
+ <listitem>
+ Any encoded integer can be concatenated
+ only with integers of the same inttype.
+ Thus, the expressions
+ <literal>[%t int8(2)]</literal>,
+ <literal>[int8(2) uint8(7)]</literal>,
+ <literal>[int8(2) int16(7)]</literal>,
+ <literal>[int8(2) 1.]</literal> will all yield
+ an error.
+ </listitem>
+ <listitem>Text components can be concatenated
+ (in the set meaning, with brackets) only with other
+ text components or with the empty matrix.
+ <literal>[]</literal>.
+ </listitem>
+ </orderedlist>
+ </para>
+ </refsect3>
+ <refsect3 id="brackets_overloading">
+ <title>Overloading</title>
+ <para>
+ <itemizedlist>
+ <listitem>[,]: horizontal concatenation:
+ This operator is binary and automatically
+ iterated from left to right. Its overloading
+ code is <literal>"c"</literal>.
+ </listitem>
+ <listitem>[;]: vertical concatenation:
+ This operator is binary and automatically
+ iterated from top to bottom. Its overloading
+ code is <literal>"f"</literal>.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </refsect3>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>[] on left-hand side of a <literal>"="</literal> assignment</term>
+ <listitem>
+ <para>
+ In this case, brackets are no longer concatenators.
+ They are used as left and right delimiters of a series of
+ variables used as recipients.
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem>Recipients must be variables.
+ Litteral expressions are not accepted.
+ </listitem>
+ <listitem>Variables shall be separated with comas.
+ </listitem>
+ <listitem>In a distributive assignment, there must
+ be at most as many LHS recipients
+ as output sources, not more. If there are less
+ recipients on the left than sources on the right,
+ non-collected data sources are ignored. Examples :
+ <simplelist>
+ <member><literal>[a,b]=(%pi,"Hi", %z)</literal>
+ is OK, but <literal>%z</literal> is ignored.
+ </member>
+ <member><literal>[a,b,c]=(%pi,"Hi")</literal>
+ yields an error because <literal>c</literal>
+ expects some foods.
+ </member>
+ </simplelist>
+ </listitem>
+ <listitem>The same variable may be used several times
+ in the list. Then, multiple assignments overwrite
+ the previous ones, from left to right.
+ Example :
+ <literal>[a,b,a]=(%pi,%z,"Allo")</literal>
+ is equivalent to <literal>a="Allo", b=%z</literal>.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</refsection>
- <refsection>
+ <refsection role="examples">
<title>Examples</title>
<programlisting role="example"><![CDATA[
-[6.9,9.64; sqrt(-1) 0]
-[1 +%i 2 -%i 3]
-[]
-['this is';'a string';'vector']
-s=poly(0,'s');[1/s,2/s]
+// Horizontal concatenations
+a = [ %pi 4 -1 ]
+b1 = grand(3,4,"uin",0,10)
+b2 = grand(3,2,"uin",0,10)
+b = [b1 b2] // they must have the same number of rows
+
+// Vertical concatenations
+a = [-2 ; 10 ; 7]
+
+b1 = grand(2,4,"uin",0,10)
+b2 = grand(3,4,"uin",0,10)
+b = [b1 ; b2] // they must have the same number of columns
+
+// Mixed horizontal and vertical concatenations
+a = [ 3 7 ; 6, 5 ]
+b = [ 1:3 ; 7:3:13]
+c = [ a b ; a b]
+
+d = [ 3 5
+ 1 4
+ ]
+e = [ d d d
+ d d d
+ ]
+// Concatenation of various types of data:
+['this is' ; 'a column' ; 'of texts']
+
+s = poly(0,'s');[1/s,2/s]
[tf2ss(1/s),tf2ss(2/s)]
-[u,s]=schur(rand(3,3))
+[%t %f %f %T %F]
+
+// Heterogeneous concatenations with automatical types conversions
+[%T %pi %f 2]
+[%pi, 2+%i, %F]
+v = [%pi+0*%i, %F, %z, (1-%z)^2 ]; typeof(v), isreal(v)
+v = [10 1/%z], typeof(v)
+
+// Incompatible heterogeneous concatenations => ERRORS
+[%F %z]
+[%F int8(5)]
+[int8(%pi) uint8(%e)]
+[int8(%pi) int16(%e)]
]]></programlisting>
+
+ <para>
+ <emphasis role="bold">Distributive assignments:</emphasis>
+ </para>
+ <programlisting role="example"><![CDATA[
+// Output from a function. Most often, output results are serially optional:
+M = rand(3,3);
+[u, s] = schur(M) // we expect and use both results u and s
+u = schur(M) // we expect and store only the first result u
+
+// Direct RHS list
+[a, b, c] = (%pi, %t, "test")
+[a, b] = (%e, %f, "Hello")
+[a, b, a] = (%pi, %t, "test");
+
+// Explicit RHS list
+L = list(%z, %i, %t, %pi, "Text");
+[a, b, c] = L(:)
+
+// RHS structure
+s(2,3).r = %pi; s(2,1).r = %i; s(2,2) = %e;
+s(2,:).r
+s.r([2 4 6])
+[a, b, c] = s.r([2 4 6])
+
+// Forbidden / Rejected LHS expressions (=> error)
+[m, n, m+n] = myfun(a,b) // Symbolic expressions like "m+n" are forbidden
+[p, 4.5, q] = myfun(a,b) // Literal LHS values or expressions like "4.5" are forbidden
+[r, s+3 ] = myfun(a,b) // Expressions mixing literals and symbols like "s+3" can't be LHS recipients
+]]></programlisting>
+ <screen><![CDATA[--> [a, b, c] = (%pi, %t, "test")
+ c =
+ test
+
+ b =
+ T
+
+ a =
+ 3.1415927
+
+--> [a, b] = (%e, %f, "Hello")
+ b =
+ F
+
+ a =
+ 2.7182818
+
+--> [a, b, a] = (%pi, %t, "test"); a
+ a =
+ 3.1415927
+]]></screen>
</refsection>
<refsection role="see also">
<title>See also</title>
<simplelist type="inline">
<member>
+ <link linkend="empty">empty</link>
+ </member>
+ <member>
<link linkend="parentheses">parentheses</link>
</member>
<member>
+ <link linkend="lstcat">lstcat</link>
+ </member>
+ <member>
<link linkend="comma">comma</link>
</member>
<member>
<link linkend="semicolon">semicolon</link>
</member>
+ <member>
+ <link linkend="overloading">overloading</link>
+ </member>
</simplelist>
</refsection>
+ <refsection role="history">
+ <title>History</title>
+ <revhistory>
+ <revision>
+ <revnumber>6.0</revnumber>
+ <revdescription>
+ Brackets <literal>[..]</literal> and braces
+ <literal>{..}</literal> are no longer equivalent
+ </revdescription>
+ </revision>
+ </revhistory>
+ </refsection>
</refentry>
<?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="brackets">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2016 - Samuel GOUGEON
+ * 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.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+ xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+ xml:lang="fr" xml:id="brackets">
<refnamediv>
- <refname>brackets ([,])</refname>
- <refpurpose>([,]) crochets à droite et à gauche </refpurpose>
+ <refname>brackets [,;]</refname>
+ <refpurpose>Concatenation. Récipients d'une affectation. Résultats d'une function</refpurpose>
</refnamediv>
<refsynopsisdiv>
- <title>Séquence d'appel</title>
- <synopsis>[a11,a12,...;a21,a22,...;...]
- [s1,s2,...]=func(...)
+ <title>Syntaxe</title>
+ <synopsis>
+ Mh = [m11 m12 m13.. m1N] or [m11, m12, m13,.., m1N]
+ Mv = [m11 ; m21 ; m31..; mN1]
+ M = [m11, m12,...; m21, m22,...;...]
+ [r1, r2,...] = func(...)
+ [r1, r2,.., rN] = (e1, e2, .., eN)
+ [r1, r2,.., rk] = (e1, e2, .., ek,.., eN)
+ [r1, r2,.., rN] = mylist(:)
+ [r1, r2,.., rN] = S.field([i1 i2.. iN])
</synopsis>
</refsynopsisdiv>
- <refsection>
- <title>Paramètres</title>
+ <refsection role="parameters">
+ <title>Arguments</title>
<variablelist>
<varlistentry>
- <term>a11,a12,... </term>
+ <term>m11, m12,... </term>
<listitem>
<para>
- toute matrice (réelle, complexe, polynomiale, rationnelle, liste de type <literal>syslin</literal> ...) de dimensions adéquates
+ Ensemble d'objets à concaténer (rassembler) et à fusionner :
+ les conteneurs individuels initiaux des objets sont supprimés.
+ Les types d'objets des familles suivantes peuvent
+ être mélangés entre eux dans une même famille, mais pas
+ entre familles :
+ <itemizedlist>
+ <listitem>
+ Matrices de booléens, nombres décimaux,
+ nombres complexes, polynômes, fractions rationnelles :
+ le type de l'objet résultant est le type de l'élément le
+ plus complexe, des booléens (le moins complexe) aux fractions
+ rationelles à coefficients complexes
+ (voir les règles de
+ <link linkend="brackets_Types_conversions">
+ <emphasis role="italic">transtypages</emphasis></link>).
+ </listitem>
+ <listitem>Matrices d'entiers encodés de type entier
+ <link linkend="inttype">inttype</link> quelconque.
+ <warning>Des entiers de types différents ne peuvent
+ pas être concaténés entre eux.
+ </warning>
+ </listitem>
+ <listitem>Tableaux de structures ayant les mêmes champs.
+ Les champs peuvent être dans des ordres différents
+ d'un tableau à l'autre.
+ </listitem>
+ <listitem>
+ Listes de type <link linkend="syslin">syslin</link>
+ </listitem>
+ </itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term>s1,s2,... </term>
+ <term>M, Mh, Mv</term>
<listitem>
- <para>noms de variables
+ <para>
+ Matrices ayant le type des éléments <varname>m##</varname>
+ (s'ils ont tous le même type).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>e1, e2,.. </term>
+ <listitem>
+ <para>Objets d'entrée (litéraux tels que <literal>-1.23</literal>
+ ou <literal>"abcd"</literal>, variables, ou expressions telles
+ que <literal>a+%pi</literal>)
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>mylist</term>
+ <listitem>
+ <para>Liste simple du type list(..)</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>S.field</term>
+ <listitem>
+ <para>
+ Tableau de structures ayant un champ nommé <literal>field</literal>.
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>i1, i2, ..</term>
+ <listitem>
+ <para>
+ Indices des éléments de <varname>S</varname> sélectionnés.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>r1, r2,... </term>
+ <listitem>
+ <para>Récipients = variables de sortie</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsection>
- <refsection>
+ <refsection role="description">
<title>Description</title>
- <para>
- Les crochets droit et gauche sont utilisés pour effectuer une concaténation de matrices. Ces symboles sont aussi utilisés quand on effectue un appel à une fonction renvoyant plusieurs arguments.
- </para>
- <para>
- A l'intérieur d'une paire de crochets spécifiant une concaténation, un espace ou une virgule signifient une concaténation de colonnes, alors qu'un point-virgule ou un passage à la ligne signifient une concaténation de lignes.
- </para>
- <para>
- Note : pour éviter les confusions il est plus sûr d'utiliser des virgules pour concaténer des colonnes.
- </para>
- <para>
- Pour des crochets entourant une liste d'arguments de sortie d'une fonction,
- les noms de variables doivent être séparés par des virgules.
- </para>
+ <variablelist>
+ <varlistentry>
+ <term>[] (figurant à droite) : crochets concaténateurs</term>
+ <listitem>
+ <para>[..] assemble les objets de types simples et compatibles
+ pour former un vecteur, une matrice ou une hypermatrice
+ homogène.
+ </para>
+ <note>La concaténation horizontale ou verticale de N éléments
+ est un opérateur binaire itératif : la concaténation
+ est réalisée de proche en proche entre 2 élements consécutifs,
+ de la gauche vers la droite, et de haut en bas. Ainsi,
+ <literal>[1 3 5 7]</literal> est effectuée par
+ <literal>[[[1 3] 5] 7]</literal>.
+ </note>
+ <para>Dans les crochets,
+ <itemizedlist>
+ <listitem>les espaces (blancs ou tabulations) ou
+ les virgules servent de séparateurs.
+ <note>Il est préférable d'utiliser des virgules,
+ en particulier lorsque des nombres complexes
+ ou des polynômes sont fournis en expressions
+ litérales. Par exemple, <literal>[2 1 +%i]</literal>
+ sera interprété comme <literal>[2, 1, %i]</literal>,
+ alors que <literal>[2 1 + %i]</literal> sera
+ compris comme <literal>[2, 1+%i]</literal>.
+ </note>
+ </listitem>
+ <listitem>les points-virgules ou les changements de
+ lignes sont utilisés comme séparateurs de lignes.
+ Pour peu que la ligne courante soit complète, le
+ passage à la ligne ne pré-requiert pas les points de
+ poursuite-à-la-ligne <literal>..</literal>.
+ </listitem>
+ </itemizedlist>
+ </para>
+ <refsect3 id="brackets_Types_conversions">
+ <title>Transtypages</title>
+ <para>
+ Avec quelques restrictions, les crochets peuvent être
+ utilisés sur une série de valeurs ayant des types distincts
+ mais compatibles. Des valeurs sont alors converties
+ de proche en proche dans le type de données dominant.
+ Les principales règles de conversion implicite sont
+ les suivantes :
+ <orderedlist>
+ <listitem>booléen < nombre décimal < nombre complexe
+ </listitem>
+ <listitem>décimal < polynôme < fraction rationelle
+ <warning>Les booléens et les polynômes ne sont pas
+ compatibles entre eux :
+ <itemizedlist>
+ <listitem>
+ <literal>[%t 2. %z]</literal> est accepté, car :
+ <literal>[%t 2.]</literal> est d'abord
+ converti en
+ <literal>[1. 2.]</literal>, puis
+ <literal>[[1. 2.] %z]</literal> est
+ accepté.
+ </listitem>
+ <listitem>
+ <literal>[%z %t 2.]</literal> est
+ refusé et produit une erreur.
+ En effet, <literal>[%z %t]</literal>
+ n'est pas permis et bloque la suite.
+ </listitem>
+ </itemizedlist>
+ </warning>
+ </listitem>
+ <listitem>
+ Le résultat est encodé en valeurs complexes (avec
+ parties imaginaires éventuellement nulles) dés qu'un
+ élément -- valeur, polynôme, ou fraction rationnelle --
+ à valeur complexe est rencontré.
+ <para>De même, le résultat est encodé sous forme
+ creuse
+ dés qu'un élément encodé creux est rencontré.
+ </para>
+ </listitem>
+ <listitem>
+ Des polynômes ou des fractions rationnelles
+ de différentes variables peuvent
+ être concaténés entre eux. Le premier polynôme
+ ou fraction rationnelle listé donne alors le
+ nom de sa variable au résultat de la concaténation :
+ <literal>[%z, 1+%s, 1-%i*%s]
+ // => [z, 1+z, 1-iz]
+ </literal>.
+ </listitem>
+ <listitem>
+ Tout entier encodé peut être concaténé uniquement
+ avec d'autres entiers du même type entier
+ (<link linkend="inttype">inttype</link>). Ainsi,
+ les expressions
+ <literal>[%t int8(2)]</literal>,
+ <literal>[int8(2) uint8(7)]</literal>,
+ <literal>[int8(2) int16(7)]</literal>,
+ <literal>[int8(2) 1.]</literal> produiront
+ toutes une erreur.
+ </listitem>
+ <listitem>Les éléments de texte (type "string") peuvent
+ être concaténés (au sens ensembliste, avec les crochets)
+ uniquement entre eux ou avec la matrice vide
+ <literal>[]</literal>.
+ </listitem>
+ </orderedlist>
+ </para>
+ </refsect3>
+ <refsect3 id="brackets_overloading">
+ <title>Surcharge</title>
+ <para>
+ <itemizedlist>
+ <listitem>[,]: concaténation horizontale :
+ cet opérateur n-aire (pouvant être appliqué à un
+ nombre arbitraire n de données) est en fait un
+ opérateur binaire automatiquement itéré de la
+ gauche vers la droite. Son code de surcharge est
+ <literal>"c"</literal>.
+ </listitem>
+ <listitem>[;]: la concaténation verticale est
+ également un opérateur binaire, itéré du haut
+ vers le bas. Son code de surcharge est
+ <literal>"f"</literal>.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </refsect3>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>[] figurant à gauche d'une affectation <literal>"="</literal></term>
+ <listitem>
+ <para>
+ Dans ce cas, les crochets ne désignent en rien une concaténation.
+ Ils délimitent une série de variables servant de récipients.
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem>Les termes entre crochets doivent alors
+ impérativement être des variables. Les expressions
+ litérales ou symboliques sont rejetées.
+ </listitem>
+ <listitem>Les variables sont séparées par des virgules
+ ou des espaces. Lorsqu'il s'agit de la liste des
+ arguments de sortie d'une function, les virgules
+ sont obligatoires.
+ </listitem>
+ <listitem>Dans une affectation distributive, il doit
+ y avoir <emphasis role="italic">au plus</emphasis>
+ autant de récipients que de sources de données
+ provenant du terme de droite, pas plus. S'il y
+ moins de récipients à gauche que de sources à droite,
+ les sources non collectées sont ignorées. Exemples :
+ <simplelist>
+ <member><literal>[a,b] = (%pi,"Hi", %z)</literal>
+ est correct, mais <literal>%z</literal>
+ sera ignoré.
+ </member>
+ <member><literal>[a,b,c] = (%pi,"Hi")</literal>
+ produit une erreur, car <literal>c</literal>
+ attend du contenu.
+ </member>
+ </simplelist> </listitem>
+ <listitem>La même variable peut être utilisée plusieurs
+ fois dans la liste de gauche entre crochets.
+ Le cas échéant, les affectations successives réalisées
+ de gauche à droite dans la liste écrasent les contenus
+ pré-existants. Exemple :
+ <literal>[a,b,a]=(%pi,%z,"Allo")</literal>
+ est équivalent à <literal>a="Allo", b=%z</literal>.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</refsection>
- <refsection>
+ <refsection role="examples">
<title>Exemples</title>
<programlisting role="example"><![CDATA[
-[6.9,9.64; sqrt(-1) 0]
-[1 +%i 2 -%i 3]
-[]
-['ceci est';'un vecteur';'de chaines de caracteres']
-s=poly(0,'s');[1/s,2/s]
+// Concaténation horizontale
+a = [ %pi 4 -1 ]
+b1 = grand(3,4,"uin",0,10)
+b2 = grand(3,2,"uin",0,10)
+b = [b1 b2] // b1, b2.. doivent avoir le même nombre de lignes
+
+// Concaténation verticale
+a = [-2 ; 10 ; 7]
+
+b1 = grand(2,4,"uin",0,10)
+b2 = grand(3,4,"uin",0,10)
+b = [b1 ; b2] // // b1, b2.. doivent avoir le même nombre de colonnes
+
+// Double concaténation horizontale et verticale
+a = [ 3 7 ; 6, 5 ]
+b = [ 1:3 ; 7:3:13]
+c = [ a b ; a b]
+
+d = [ 3 5
+ 1 4
+ ]
+e = [ d d d
+ d d d
+ ]
+// Concaténation de types d'objets variés :
+['this is' ; 'a column' ; 'of texts']
+
+s = poly(0,'s');[1/s,2/s]
[tf2ss(1/s),tf2ss(2/s)]
-[u,s]=schur(rand(3,3))
+[%t %f %f %T %F]
+
+// Concaténation d'objets de types compatibles différents, avec transtypages automatiques
+[%T %pi %f 2]
+[%pi, 2+%i, %F]
+v = [%pi+0*%i, %F, %z, (1-%z)^2 ]; typeof(v), isreal(v)
+v = [10 1/%z], typeof(v)
+
+// Concaténations hétérogènes d'objets de types incompatibles => ERREURS
+[%F %z]
+[%F int8(5)]
+[int8(%pi) uint8(%e)]
+[int8(%pi) int16(%e)]
]]></programlisting>
+
+ <para>
+ <emphasis role="bold">Affectations distributives :</emphasis>
+ </para>
+ <programlisting role="example"><![CDATA[
+// Variables des réponses d'une function.
+// Elles sont le plus souvent optionnelles, l'une après l'autre
+M = rand(3,3);
+[u, s] = schur(M) // Nous attendons et utilisons à la fois u et s
+u = schur(M) // Nous attendons et stockons uniquement u
+
+// Liste directe (implicite) d'objets à affecter
+[a, b, c] = (%pi, %t, "test")
+[a, b] = (%e, %f, "Hello")
+[a, b, a] = (%pi, %t, "test");
+
+// Liste explicite d'objets à affecter
+L = list(%z, %i, %t, %pi, "Text");
+[a, b, c] = L(:)
+
+// Tableau de structures :
+// Sélection de certaines cellules et affectation de leurs contenus
+s(2,3).r = %pi; s(2,1).r = %i; s(2,2) = %e;
+s(2,:).r
+s.r([2 4 6])
+[a, b, c] = s.r([2 4 6])
+
+// Expressions gauches interdites et rejetées (=> erreur)
+[m, n, m+n] = myfun(a,b) // "m+n" est une expression, non un nom de variable.
+[p, 4.5, q] = myfun(a,b) // "4.5 est une valeur littérale, non un nom de variable.
+[r, s+3 ] = myfun(a,b) // "s+3" est une expression mixte, non un nom de variable
+ ]]></programlisting>
+ <screen><![CDATA[--> [a, b, c] = (%pi, %t, "test")
+ c =
+ test
+
+ b =
+ T
+
+ a =
+ 3.1415927
+
+--> [a, b] = (%e, %f, "Hello")
+ b =
+ F
+
+ a =
+ 2.7182818
+
+--> [a, b, a] = (%pi, %t, "test"); a
+ a =
+ 3.1415927
+]]></screen>
</refsection>
<refsection role="see also">
<title>Voir aussi</title>
<simplelist type="inline">
<member>
+ <link linkend="empty">empty</link>
+ </member>
+ <member>
<link linkend="parentheses">parentheses</link>
</member>
<member>
+ <link linkend="lstcat">lstcat</link>
+ </member>
+ <member>
<link linkend="comma">comma</link>
</member>
<member>
<link linkend="semicolon">semicolon</link>
</member>
+ <member>
+ <link linkend="overloading">overloading</link>
+ </member>
</simplelist>
</refsection>
+ <refsection role="history">
+ <title>Historique</title>
+ <revhistory>
+ <revision>
+ <revnumber>6.0</revnumber>
+ <revdescription>
+ Crochets <literal>[..]</literal> et accolades
+ <literal>{..}</literal> ont désormais des fonctions distinctes.
+ </revdescription>
+ </revision>
+ </revhistory>
+ </refsection>
</refentry>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="brackets">
-
- <refnamediv>
-
- <refname>brackets</refname>
-
- <refpurpose>([,]) 左および右括弧</refpurpose>
-
- </refnamediv>
-
- <refsynopsisdiv>
-
- <title>呼び出し手順</title>
-
- <synopsis>[a11,a12,...;a21,a22,...;...]
-
- [s1,s2,...]=func(...)
-
- </synopsis>
-
- </refsynopsisdiv>
-
- <refsection>
-
- <title>引数</title>
-
- <variablelist>
-
- <varlistentry>
-
- <term>a11,a12,... </term>
-
- <listitem>
-
- <para>
-
- 適当な次元の行列 (実数, 多項式, 有理,<literal>syslin</literal>
-
- リスト...)
-
- </para>
-
- </listitem>
-
- </varlistentry>
-
- <varlistentry>
-
- <term>s1,s2,... </term>
-
- <listitem>
-
- <para>任意の変数名</para>
-
- </listitem>
-
- </varlistentry>
-
- </variablelist>
-
- </refsection>
-
- <refsection>
-
- <title>説明</title>
-
- <para>
-
- 左および右括弧はベクトルおよび行列を結合する
-
- する際に使用されます.
-
- これらの記号は関数コールにおいて複数の左辺値を定義する際に
-
- 使用されます.
-
- </para>
-
- <para>
-
- 括弧の組の内部では,空白またはカンマ文字は
-
- "列結合"を意味し,セミコロンおよびキャレッジリターンは
-
- "行結合"を意味します.
-
- </para>
-
- <para>
-
- 注意 : 混乱を避けるため,列を区切るために空白ではなくカンマを使用する
-
- 方がより安全です.
-
- </para>
-
- <para>
-
- 複数の lhs 括弧の中の変数名はカンマで区切る必要があります.
-
- </para>
-
- </refsection>
-
- <refsection>
-
- <title>例</title>
-
- <programlisting role="example"><![CDATA[
-[6.9,9.64; sqrt(-1) 0]
-[1 +%i 2 -%i 3]
-[]
-['this is';'a string';'vector']
-s=poly(0,'s');[1/s,2/s]
-[tf2ss(1/s),tf2ss(2/s)]
-
-[u,s]=schur(rand(3,3))
- ]]></programlisting>
-
- </refsection>
-
- <refsection role="see also">
-
- <title>参照</title>
-
- <simplelist type="inline">
-
- <member>
-
- <link linkend="comma">comma</link>
-
- </member>
-
- <member>
-
- <link linkend="semicolon">semicolon</link>
-
- </member>
-
- </simplelist>
-
- </refsection>
-
-</refentry>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="brackets">
- <refnamediv>
- <refname>квадратные скобки</refname>
- <refpurpose>([, ]) левые и правые квадратные скобки</refpurpose>
- </refnamediv>
- <refsynopsisdiv>
- <title>Синтаксис</title>
- <synopsis>[a11,a12,...;a21,a22,...;...]
- [s1,s2,...]=func(...)
- </synopsis>
- </refsynopsisdiv>
- <refsection>
- <title>Аргументы</title>
- <variablelist>
- <varlistentry>
- <term>a11,a12,... </term>
- <listitem>
- <para>
- любая матрица (вещественная, полиномиальная, рациональная, список <literal>syslin</literal> ...) соответствующих размеров
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>s1,s2,... </term>
- <listitem>
- <para>любое возможное имя переменной</para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsection>
- <refsection>
- <title>Описание</title>
- <para>
- Левая и правая скобки используются для обозначения конкатенации векторов и матриц. Эти символы также используются для обозначения
- множественных выходных данных вызова функции.
- </para>
- <para>
- Внутри скобок конкатенации символы пробела или запятой означают "конкатенацию столбцов", точка с запятой и возврат каретки означают
- "конкатенацию строк".
- </para>
- <para>
- Примечание: чтобы избежать проблем, для разделения столбцов безопаснее использовать запятые вместо пробелов.
- </para>
- <para>
- Внутри скобок, объединяющих выходные переменные функции, имена переменных должны быть разделены запятыми.
- </para>
- </refsection>
- <refsection>
- <title>Примеры</title>
- <programlisting role="example"><![CDATA[
-[6.9,9.64; sqrt(-1) 0]
-[1 +%i 2 -%i 3]
-[]
-['this is';'a string';'vector']
-s=poly(0,'s');[1/s,2/s]
-[tf2ss(1/s),tf2ss(2/s)]
-
-[u,s]=schur(rand(3,3))
- ]]></programlisting>
- </refsection>
- <refsection role="see also">
- <title>Смотрите также</title>
- <simplelist type="inline">
- <member>
- <link linkend="parentheses">круглые скобки</link>
- </member>
- <member>
- <link linkend="comma">запятая</link>
- </member>
- <member>
- <link linkend="semicolon">точка с запятой</link>
- </member>
- </simplelist>
- </refsection>
-</refentry>
{
#ifndef _MSC_VER
/*
- Depending on the linking order, sometime, libs are not loaded the right way.
+ Depending on the linking order, sometimes, libs are not loaded the right way.
This can cause painful debugging tasks for packager or developer, we are
doing the check to help them.
*/
*
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="and_op" xml:lang="en">
+
<refnamediv>
- <refname>&</refname>
+ <refname>&, &&</refname>
<refpurpose>logical AND operator</refpurpose>
</refnamediv>
+
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>A&B</synopsis>
+ <para>
+ Matrix operation with full evaluation:
+ </para>
+ <synopsis>
+ full_res = A & B
+ int_res = intA & intB
+ </synopsis>
+ <para>
+ Short-circuited evaluation:
+ </para>
+ <synopsis>
+ short_circuit_res = A && B
+ if (A & B) then ... end
+ if (A && B) then ... end
+ while (A & B) then ... end
+ while (A && B) then ... end
+ </synopsis>
</refsynopsisdiv>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>full_res</varname>
+ is a boolean matrix of their common size.
+ The result is the element-wise <link linkend="and">and</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>full_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="and">and</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>int_res</varname>
+ is a matrix of integer of their common size.
+ The result is the element-wise <link linkend="bitand">bitand</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>int_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="bitand">bitand</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are of different integer encoding,
+ integer promotion is performed according to the following rules:
+ <itemizedlist>
+ <listitem>
+ if any operand is unsigned, <varname>int_res</varname> is unsigned;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> has the encoding of the higher number of bits between the encoding of <varname>A</varname> and <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> and <varname>B</varname> are promoted to the same encoding before computation is performed
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ boolean scalar when the operation is short-circuited.
+ </para>
+ <para>
+ The short-circuit operation evaluates to false if any entry of <varname>A</varname> is false. In this case <varname>B</varname> is not evaluated.
+ </para>
+ <para>
+ See <link linkend="and">and</link> for the definition of the evaluation to false depending on type and encoding.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+
<refsection>
<title>Description</title>
<para>
- <literal>A&B</literal> gives the element-wise logical
- <literal>and</literal> of the booleans matrices <literal>A</literal> and
- <literal>B</literal>. <literal>A</literal> and <literal>B</literal> must
+ When the right and left operands are <emphasis>not</emphasis> both of integer type, <literal>A & B</literal> yields the element-wise logical
+ <literal>AND</literal> of matrices <varname>A</varname> and
+ <literal>B</literal> evaluated as matrices of boolean. <varname>A</varname> and <varname>B</varname> must
be matrices with the same dimensions or one from them must be a single
boolean.
+ If any operand is sparse the result of <literal>A & B</literal> is sparse encoded.
+ </para>
+ <para>
+ When both operands are of integer type, <literal>A & B</literal> yields the bitwise comparison between each element of <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ For <link linkend="if">if</link> and <link linkend="while">while</link> control structures or when computing <literal>A && B</literal>, the left operand is evaluated prior to the right operand. If any entry in the left operand is false, the result is set to <literal>%f</literal> short-circuiting the evaluation of the right operand.
+ Otherwise, <literal>A & B</literal> is computed.
</para>
</refsection>
+
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-[%t %t %f] & [%f %t %t]
-[%t %t %f] & %f
-[%t %t %f] & %t
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A is evaluated as
+// [%f, %t;
+// %t, %f]
+// B is evaluated as
+// [%t, %t;
+// %f, %f]
+
+// & as logical operation
+A & B
+A & spB // Result is sparse encoded
+iA & spB // Result is sparse encoded
+cA & iB
+
+// & as bitwise operation
+iA & iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 & i8_B
+
+// Integer promotion
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A & ui32_B
+
+// && as a shortcut operation
+function res = foo()
+ disp("this is executed");
+ res = %t;
+endfunction
+
+if ( %f & foo() ) then
+ // This is not executed
+end
+
+A && foo() // A has at least one element equals to 0
+iA && foo() // therefore, foo() is not executed
+cA && foo()
+
+iA && iB // iA is evalueated as false resulting in the short-circuited operation
]]></programlisting>
</refsection>
<member>
<link linkend="or_op">or operator (|)</link>
</member>
+ <member>
+ <link linkend="bitand">bitand</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008 - INRIA
- *
+ * Copyright (C) 2016 - Samuel GOUGEON
+ *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* along with this program.
*
-->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isinf" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:id="isinf" xml:lang="en">
<refnamediv>
<refname>isinf</refname>
- <refpurpose>check for infinite entries</refpurpose>
+ <refpurpose>tests for infinite elements</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>r=isinf(x)</synopsis>
+ <synopsis>
+ r = isinf(x)
+ </synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<varlistentry>
<term>x</term>
<listitem>
- <para>real or complex vector or matrix r : boolean vector or
- matrix
+ <para>matrix of real or complex numbers
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>r</term>
+ <listitem>
+ <para>
+ matrix of booleans of the same size as <varname>x</varname>
</para>
</listitem>
</varlistentry>
<refsection>
<title>Description</title>
<para>
- <literal>isinf(x)</literal> returns a boolean vector or matrix which
- contains true entries corresponding with infinite <literal>x</literal>
- entries and false entries corresponding with finite <literal>x</literal>
- entries.
+ <literal>isinf(x)</literal> returns the matrix <varname>r</varname>
+ of booleans such that, for each element <varname>x(i)</varname>,
+ <varname>r(i)</varname> is set to <literal>%T</literal> if and only if
+ <varname>x(i)</varname> is infinite.
+ </para>
+ <para>
+ When <literal>x</literal> is complex-encoded, <literal>x(i)</literal>
+ is considered infinite if its real part or its imaginary part (or both)
+ are infinite.
</para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting role="example"><![CDATA[
-isinf([1 0.01 -%inf %inf])
+ <programlisting role="example"><![CDATA[
+[i, inf, nan] = (%i, %inf, %nan);
+isinf([-1 0.01 -inf inf nan])
+isinf([2+i, -10-inf, inf+i])
+isinf([nan-i, inf-nan*i, nan+i*inf])
]]></programlisting>
</refsection>
<refsection role="see also">
<member>
<link linkend="isnan">isnan</link>
</member>
+ <member>
+ <link linkend="isreal">isreal</link>
+ </member>
+ <member>
+ <link linkend="isnum">isnum</link>
+ </member>
+ <member>
+ <link linkend="type">type</link>
+ </member>
</simplelist>
</refsection>
</refentry>
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="or_op" xml:lang="en">
<refnamediv>
- <refname>|</refname>
+ <refname>|, ||</refname>
<refpurpose>logical OR operator</refpurpose>
</refnamediv>
+
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>A|B</synopsis>
+ <para>
+ Matrix operation with full evaluation:
+ </para>
+ <synopsis>
+ full_res = A | B
+ int_res = intA | intB
+ </synopsis>
+ <para>
+ Short-circuited evaluation:
+ </para>
+ <synopsis>
+ short_circuit_res = A || B
+ if (A | B) then ... end
+ if (A || B) then ... end
+ while (A | B) then ... end
+ while (A || B) then ... end
+ </synopsis>
</refsynopsisdiv>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>full_res</varname>
+ is a boolean matrix of their common size.
+ The result is the element-wise <link linkend="or">or</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>full_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="or">or</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>int_res</varname>
+ is a matrix of integer of their common size.
+ The result is the element-wise <link linkend="bitor">bitor</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>int_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="bitor">bitor</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are of different integer encoding,
+ integer promotion is performed according to the following rules:
+ <itemizedlist>
+ <listitem>
+ if any operand is unsigned, <varname>int_res</varname> is unsigned;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> has the encoding of the higher number of bits between the encoding of <varname>A</varname> and <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> and <varname>B</varname> are promoted to the same encoding before computation is performed
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ boolean scalar when the operation is short-circuited.
+ </para>
+ <para>
+ The short-circuit operation evaluates to true if all entries of <varname>A</varname> is true. In this case <varname>B</varname> is not evaluated.
+ </para>
+ <para>
+ See <link linkend="or">or</link> for the definition of the evaluation to true depending on type and encoding.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+
<refsection>
<title>Description</title>
<para>
- <literal>A|B</literal> gives the element-wise logical
- <literal>or</literal> of the booleans matrices <literal>A</literal> and
- <literal>B</literal>. <literal>A</literal> and <literal>B</literal> must
+ When the right and left operands are <emphasis>not both</emphasis> of integer type, <literal>A | B</literal> yields the element-wise logical
+ <literal>OR</literal> of matrices <varname>A</varname> and
+ <literal>B</literal> evaluated as matrices of boolean. <varname>A</varname> and <varname>B</varname> must
be matrices with the same dimensions or one from them must be a single
boolean.
+ If any operand is sparse the result of <literal>A | B</literal> is sparse encoded.
+ </para>
+ <para>
+ When both operands are of integer type, <literal>A | B</literal> yields the bitwise comparison between each element of <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ For <link linkend="if">if</link> and <link linkend="while">while</link> control structures or when computing <literal>A || B</literal>, the left operand is evaluated prior to the right operand. If all entries in the left operand are true, the result is set to <literal>%t</literal> short-circuiting the evaluation of the right operand.
+ Otherwise, <literal>A | B</literal> is computed.
</para>
</refsection>
+
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-[%t %t %f] | [%f %t %t]
-[%t %t %f] | %f
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A is evaluated as
+// [%f, %t;
+// %t, %f]
+// B is evaluated as
+// [%t, %t;
+// %f, %f]
+
+// | as logical operation
+A | B
+A | spB // Result is sparse encoded
+iA | spB // Result is sparse encoded
+cA | iB
+
+// | as bitwise operation
+iA | iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 | i8_B
+
+// Integer promotion
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A | ui32_B
+
+// || as a shortcut operation
+function res = foo()
+ disp("this is executed");
+ res = %t;
+endfunction
+
+if ( %t | foo() ) then
+ // foo is not executed
+end
+
+C = [1 %i; 2, 10]; // All C entries are different than 0
+if ( C || foo() ) then
+ // foo() is not executed
+end
+
]]></programlisting>
</refsection>
+
<refsection role="see also">
<title>See also</title>
<simplelist type="inline">
<member>
<link linkend="find">find</link>
</member>
+ <member>
+ <link linkend="bitor">bitor</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<?xml version="1.0" encoding="UTF-8"?>
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="and_op" xml:lang="fr">
<refnamediv>
- <refname>&</refname>
- <refpurpose>opérateur et logique</refpurpose>
+ <refname>&, &&</refname>
+ <refpurpose>opérateur ET logique</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Séquence d'appel</title>
- <synopsis>A&B</synopsis>
+ <para>
+ Opérateur matriciel avec évaluation complète:
+ </para>
+ <synopsis>
+ full_res = A & B
+ int_res = intA & intB
+ </synopsis>
+ <para>
+ Évaluation court-circuitée :
+ </para>
+ <synopsis>
+ short_circuit_res = A && B
+ if (A & B) then ... end
+ if (A && B) then ... end
+ while (A & B) then ... end
+ while (A && B) then ... end
+ </synopsis>
</refsynopsisdiv>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice de booléens (possiblement creux),
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>), de nombres réels ou complexes.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice de booléens (possiblement creux),
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>), de nombres réels ou complexes.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ Si <varname>A</varname> et <varname>B</varname> ne sont pas des scalaires,
+ ils doivent être de la même taille et <varname>full_res</varname> est alors une matrice
+ de booléens de leur taille commune.
+ Le résultat est l'opérateur <link linkend="and">and</link> logique appliqué élément
+ par élément entre <varname>A</varname> et <varname>B</varname>.
+ </para>
+ <para>
+ Si <varname>A</varname> ou <varname>B</varname> est un scalaire,
+ <varname>full_res</varname> est une matrice de booléens
+ de la taille de l'autre opérande.
+ Le résultat est l'opérateur <link linkend="and">and</link> logique appliqué élément par élément
+ entre la matrice de la plus grande taille et le scalaire.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ Si <varname>A</varname> et <varname>B</varname> ne sont pas des scalaires,
+ ils doivent être de la même taille et <varname>int_res</varname> est alors une matrice
+ de booléens de leur taille commune.
+ Le résultat est l'opérateur <link linkend="bitand">bitand</link> appliqué élément
+ par élément entre <varname>A</varname> et <varname>B</varname>.
+ </para>
+ <para>
+ Si <varname>A</varname> ou <varname>B</varname> est un scalaire,
+ <varname>int_res</varname> est une matrice de booléens
+ de la taille de l'autre opérande.
+ Le résultat est l'opérateur <link linkend="bitand">bitand</link> appliqué élément par élément
+ entre la matrice de la plus grande taille et le scalaire.
+ </para>
+ <para>
+ Si les codages en entier de <varname>A</varname> et <varname>B</varname> sont différents,
+ une promotion d'entier est opérée selon les règles suivantes :
+ <itemizedlist>
+ <listitem>
+ si une des opérandes est non signée, <varname>int_res</varname> est non signé;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> a le codage entier du nombre de bits le plus grand entre le codage de <varname>A</varname> et celui de <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> et <varname>B</varname> sont promus pour être du même codage avant que l'opération ne soit effectuée.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ booléen scalaire si l'opération est court-circuitée.
+ </para>
+ <para>
+ L'opération court-circuitée renvoie vrai si toutes les entrées de <varname>A</varname> sont vraies. Dans ce cas <varname>B</varname> n'est pas évaluée.
+ </para>
+ <para>
+ Voir <link linkend="and">and</link> pour la définition de l'évaluation à vrai selon le type et le codage utilisé.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+
<refsection>
<title>Description</title>
<para>
- <literal>A&B</literal> renvoie la conjonction logique élément
- par élément des matrices booléennes <literal>A</literal> et
- <literal>B</literal> .<literal>A</literal> et <literal>B</literal> doivent
- être des matrices de même dimensions ou l'une d'elle doit être un simple
- booléen.
+ Quand les opérandes de gauche et de droite ne sont <emphasis>pas toutes deux</emphasis> de type entier, <literal>A & B</literal> renvoie le <literal>ET</literal> logique effectué élément par élément entre les matrices <varname>A</varname> et <varname>B</varname> évaluées comme matrice de booléens.
+ <varname>A</varname> et <varname>B</varname> doivent être des matrices de même taille ou l'une d'entre elle doit être un scalaire.
+ Si une opérande est creuse, le résultat de <literal>A & B</literal> est creux.
+ </para>
+ <para>
+ Quand les deux opérandes sont de type entier, <literal>A & B</literal> renvoie la comparaison bit à bit de chaque élément de <varname>A</varname> et de <varname>B</varname>.
</para>
+ <para>
+ Pour les structures de contrôle <link linkend="if">if</link> et <link linkend="while">while</link> ou quand l'on calcule <literal>A && B</literal>, l'opérande de gauche est évaluée avant l'opérande de droite. Si une entrée de l'opérande de gauche est fausse, le résultat est <literal>%f</literal>, ce qui court-circuite l'évaluation de l'opérande de droite.
+ Dans les autres cas, l'on calcule <literal>A & B.</literal>
+ </para>
+ </refsection>
+ <refsection>
+ <title>Exemples</title>
+ <programlisting role="example"><![CDATA[
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A est évalué comme
+// [%f, %t;
+// %t, %f]
+// B est évalué comme
+// [%t, %t;
+// %f, %f]
+
+// & comme ET logique
+A & B
+A & spB // Le résultat est creux
+iA & spB // Le résultat est creux
+cA & iB
+
+// & comme opération bit à bit
+iA & iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// codage entier de i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// codage entier i8_B:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 & i8_B
+
+// Promotion d'entier
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A & ui32_B
+
+// && comme opération court-circuitée
+function res = foo()
+ disp("ceci est exécuté");
+ res = %t;
+endfunction
+
+if ( %f & foo() ) then
+ // foo n'est pas exécuté
+end
+
+A && foo() // Au moins une entrée de A vaut 0
+iA && foo() // alors, foo() n'est pas executée
+cA && foo()
+
+iA && iB // iA est évaluée à faux et l'opération est court-circuitée
+ ]]></programlisting>
</refsection>
+
<refsection role="see also">
<title>Voir aussi</title>
<simplelist type="inline">
<member>
<link linkend="or_op">opérateur ou (|)</link>
</member>
+ <member>
+ <link linkend="bitand">bitand</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isinf" xml:lang="fr">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2016 - Samuel GOUGEON
+ *
+ * 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.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
+ xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:scilab="http://www.scilab.org" xml:id="isinf" xml:lang="fr">
<refnamediv>
<refname>isinf</refname>
- <refpurpose>vérifie si des composantes "Inf" (infinies) sont
- présentes.
- </refpurpose>
+ <refpurpose>teste la présence de valeurs infinies</refpurpose>
</refnamediv>
<refsynopsisdiv>
- <title>Séquence d'appel</title>
- <synopsis>r=isinf(x)</synopsis>
+ <title>Syntaxe</title>
+ <synopsis>r = isinf(x)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Paramètres</title>
<varlistentry>
<term>x</term>
<listitem>
- <para>vecteur ou matrice complexe ou réelle. r : vecteur ou matrice
- de booléens.
+ <para>matrice de nombres décimaux ou complexes.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>r</term>
+ <listitem>
+ <para>matrice de booléens, de même taille que <varname>x</varname>
</para>
</listitem>
</varlistentry>
<refsection>
<title>Description</title>
<para>
- <literal>isinf(x)</literal> renvoie un vecteur ou une matrice de
- booléens contenant des composantes égales à %T (vrai) correspondant aux
- composantes "Inf" (infinies) de <literal>x</literal> et %F (faux) pour les
- autres.
+ <literal>isinf(x)</literal> renvoie une matrice <literal>r</literal> dont chaque
+ élément <literal>r(i)</literal> vaut <literal>%T</literal> (vrai) si et seulement si
+ <literal>x(i)</literal> est infini.
+ </para>
+ <para>Pour <literal>x</literal> complexe, <literal>x(i)</literal> est considéré infini
+ dés que sa partie réelle ou complexe ou les deux sont infinies.
</para>
</refsection>
<refsection>
<title>Exemples</title>
- <programlisting role="example"><![CDATA[
-isinf([1 0.01 -%inf %inf])
+ <programlisting role="example"><![CDATA[
+[i, inf, nan] = (%i, %inf, %nan);
+isinf([-1 0.01 -inf inf nan])
+isinf([2+i, -10-inf, inf+i])
+isinf([nan-i, inf-nan*i, nan+i*inf])
]]></programlisting>
</refsection>
<refsection role="see also">
<member>
<link linkend="isnan">isnan</link>
</member>
+ <member>
+ <link linkend="isreal">isreal</link>
+ </member>
+ <member>
+ <link linkend="isnum">isnum</link>
+ </member>
+ <member>
+ <link linkend="type">type</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<?xml version="1.0" encoding="UTF-8"?>
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="or_op" xml:lang="fr">
<refnamediv>
- <refname>|</refname>
+ <refname>|, ||</refname>
<refpurpose>opérateur de disjonction logique</refpurpose>
</refnamediv>
+
<refsynopsisdiv>
<title>Séquence d'appel</title>
<synopsis>A|B</synopsis>
+ <para>
+ Opérateur matriciel avec évaluation complète:
+ </para>
+ <synopsis>
+ full_res = A | B
+ int_res = intA | intB
+ </synopsis>
+ <para>
+ Évaluation court-circuitée :
+ </para>
+ <synopsis>
+ short_circuit_res = A || B
+ if (A | B) then ... end
+ if (A || B) then ... end
+ while (A | B) then ... end
+ while (A || B) then ... end
+ </synopsis>
</refsynopsisdiv>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice de booléens (possiblement creux),
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>), de nombres réels ou complexes.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice de booléens (possiblement creux),
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>), de nombres réels ou complexes.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ Si <varname>A</varname> et <varname>B</varname> ne sont pas des scalaires,
+ ils doivent être de la même taille et <varname>full_res</varname> est alors une matrice
+ de booléens de leur taille commune.
+ Le résultat est l'opérateur <link linkend="or">or</link> logique appliqué élément
+ par élément entre <varname>A</varname> et <varname>B</varname>.
+ </para>
+ <para>
+ Si <varname>A</varname> ou <varname>B</varname> est un scalaire,
+ <varname>full_res</varname> est une matrice de booléens
+ de la taille de l'autre opérande.
+ Le résultat est l'opérateur <link linkend="or">or</link> logique appliqué élément par élément
+ entre la matrice de la plus grande taille et le scalaire.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalaire, vecteur, matrice ou hypermatrice
+ d'entiers codés (de tout <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ Si <varname>A</varname> et <varname>B</varname> ne sont pas des scalaires,
+ ils doivent être de la même taille et <varname>int_res</varname> est alors une matrice
+ de booléens de leur taille commune.
+ Le résultat est l'opérateur <link linkend="bitor">bitor</link> appliqué élément
+ par élément entre <varname>A</varname> et <varname>B</varname>.
+ </para>
+ <para>
+ Si <varname>A</varname> ou <varname>B</varname> est un scalaire,
+ <varname>int_res</varname> est une matrice de booléens
+ de la taille de l'autre opérande.
+ Le résultat est l'opérateur <link linkend="bitor">bitor</link> appliqué élément par élément
+ entre la matrice de la plus grande taille et le scalaire.
+ </para>
+ <para>
+ Si les codages en entier de <varname>A</varname> et <varname>B</varname> sont différents,
+ une promotion d'entier est opérée selon les règles suivantes :
+ <itemizedlist>
+ <listitem>
+ si une des opérandes est non signée, <varname>int_res</varname> est non signé;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> a le codage entier du nombre de bits le plus grand entre le codage de <varname>A</varname> et celui de <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> et <varname>B</varname> sont promus pour être du même codage avant que l'opération ne soit effectuée.
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ booléen scalaire si l'opération est court-circuitée.
+ </para>
+ <para>
+ L'opération court-circuitée renvoie vrai si toutes les entrées de <varname>A</varname> sont vraies. Dans ce cas <varname>B</varname> n'est pas évaluée.
+ </para>
+ <para>
+ Voir <link linkend="or">or</link> pour la définition de l'évaluation à vrai selon le type et le codage utilisé.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+
<refsection>
<title>Description</title>
<para>
- <literal>A|B</literal> renvoie la disjonction logique élément par
- élément des matrices booléennes <literal>A</literal> et
- <literal>B</literal>. <literal>A</literal> et <literal>B</literal> doivent
- être des matrices de mêmes dimensions ou l'une d'elles doit être un simple
- booléen.
+ Quand les opérandes de gauche et de droite ne sont <emphasis>pas toutes deux</emphasis> de type entier, <literal>A | B</literal> renvoie le <literal>OU</literal> logique effectué élément par élément entre les matrices <varname>A</varname> et <varname>B</varname> évaluées comme matrice de booléens.
+ <varname>A</varname> et <varname>B</varname> doivent être des matrices de même taille ou l'une d'entre elle doit être un scalaire.
+ Si une opérande est creuse, le résultat de <literal>A | B</literal> est creux.
+ </para>
+ <para>
+ Quand les deux opérandes sont de type entier, <literal>A | B</literal> renvoie la comparaison bit à bit de chaque élément de <varname>A</varname> et de <varname>B</varname>.
+ </para>
+ <para>
+ Pour les structures de contrôle <link linkend="if">if</link> et <link linkend="while">while</link> ou quand l'on calcule <literal>A || B</literal>, l'opérande de gauche est évaluée avant l'opérande de droite. Si toutes les entrées de l'opérande de gauche sont vraies, le résultat est <literal>%t</literal>, ce qui court-circuite l'évaluation de l'opérande de droite.
+ Dans les autres cas, l'on calcule <literal>A | B.</literal>
</para>
</refsection>
<refsection>
<title>Exemples</title>
<programlisting role="example"><![CDATA[
-[%t %t %f]|[%f %t %t]
-[%t %t %f]|%f
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A est évalué comme
+// [%f, %t;
+// %t, %f]
+// B est évalué comme
+// [%t, %t;
+// %f, %f]
+
+// | comme OU logique
+A | B
+A | spB // Le résultat est creux
+iA | spB // Le résultat est creux
+cA | iB
+
+// | comme opération bit à bit
+iA | iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// codage entier de i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// codage entier i8_B:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 | i8_B
+
+// Promotion d'entier
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A | ui32_B
+
+// || comme opération court-circuitée
+function res = foo()
+ disp("ceci est exécuté");
+ res = %t;
+endfunction
+
+if ( %t | foo() ) then
+ // foo n'est pas exécuté
+end
+
+C = [1 %i; 2, 10]; // Toutes les entrées de C sont différentes de 0
+if ( C || foo() ) then
+ // foo() foo n'est pas exécuté
+end
+
]]></programlisting>
</refsection>
+
<refsection role="see also">
<title>Voir aussi</title>
<simplelist type="inline">
<member>
<link linkend="find">find</link>
</member>
+ <member>
+ <link linkend="bitor">bitor</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="and_op" xml:lang="ja">
<refnamediv>
-
- <refname>&</refname>
-
+ <refname>&, &&</refname>
<refpurpose>論理積演算子</refpurpose>
-
</refnamediv>
<refsynopsisdiv>
-
<title>呼び出し手順</title>
-
<synopsis>A&B</synopsis>
-
</refsynopsisdiv>
-
<refsection>
-
<title>説明</title>
-
<para>
-
- <literal>A&B</literal> は,
-
- 論理値行列 <literal>A</literal>および<literal>B</literal>の
-
- 要素毎の論理 <literal>and</literal>です.
-
- <literal>A</literal> および <literal>B</literal> は
-
- 同じ次元を有する行列または
-
- どちらかが単一の論理値である必要があります.
-
+ Matrix operation with full evaluation:
+ </para>
+ <synopsis>
+ full_res = A & B
+ int_res = intA & intB
+ </synopsis>
+ <para>
+ Short-circuited evaluation:
</para>
-
+ <synopsis>
+ short_circuit_res = A && B
+ if (A & B) then ... end
+ if (A && B) then ... end
+ while (A & B) then ... end
+ while (A && B) then ... end
+ </synopsis>
+ </refsection>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>full_res</varname>
+ is a boolean matrix of their common size.
+ The result is the element-wise <link linkend="and">and</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>full_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="and">and</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>int_res</varname>
+ is a matrix of integer of their common size.
+ The result is the element-wise <link linkend="bitand">bitand</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>int_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="bitand">bitand</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are of different integer encoding,
+ integer promotion is performed according to the following rules:
+ <itemizedlist>
+ <listitem>
+ if any operand is unsigned, <varname>int_res</varname> is unsigned;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> has the encoding of the higher number of bits between the encoding of <varname>A</varname> and <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> and <varname>B</varname> are promoted to the same encoding before computation is performed
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ boolean scalar when the operation is short-circuited.
+ </para>
+ <para>
+ The short-circuit operation evaluates to false if any entry of <varname>A</varname> is false. In this case <varname>B</varname> is not evaluated.
+ </para>
+ <para>
+ See <link linkend="and">and</link> for the definition of the evaluation to false depending on type and encoding.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</refsection>
<refsection>
-
<title>例</title>
-
<programlisting role="example"><![CDATA[
-[%t %t %f] & [%f %t %t]
-[%t %t %f] & %f
-[%t %t %f] & %t
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A is evaluated as
+// [%f, %t;
+// %t, %f]
+// B is evaluated as
+// [%t, %t;
+// %f, %f]
+
+// & as logical operation
+A & B
+A & spB // Result is sparse encoded
+iA & spB // Result is sparse encoded
+cA & iB
+
+// & as bitwise operation
+iA & iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 & i8_B
+
+// Integer promotion
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A & ui32_B
+
+// && as a shortcut operation
+function res = foo()
+ disp("this is executed");
+ res = %t;
+endfunction
+
+if ( %f & foo() ) then
+ // This is not executed
+end
+
+A && foo() // A has at least one element equals to 0
+iA && foo() // therefore, foo() is not executed
+cA && foo()
+
+iA && iB // iA is evalueated as false resulting in the short-circuited operation
]]></programlisting>
-
</refsection>
<refsection role="see also">
-
<title>参照</title>
-
<simplelist type="inline">
-
<member>
-
<link linkend="not">not</link>
-
</member>
-
<member>
-
<link linkend="and">and</link>
-
</member>
-
<member>
-
<link linkend="or_op">or operator (|)</link>
-
</member>
-
+ <member>
+ <link linkend="bitand">bitand</link>
+ </member>
</simplelist>
-
</refsection>
-
</refentry>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA
- *
- * 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.
- *
- -->
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isinf" xml:lang="ja">
-
- <refnamediv>
-
- <refname>isinf</refname>
-
- <refpurpose>無限大のエントリかどうかを調べる</refpurpose>
-
- </refnamediv>
-
- <refsynopsisdiv>
-
- <title>呼び出し手順</title>
-
- <synopsis>r=isinf(x)</synopsis>
-
- </refsynopsisdiv>
-
- <refsection>
-
- <title>引数</title>
-
- <variablelist>
-
- <varlistentry>
-
- <term>x</term>
-
- <listitem>
-
- <para>
-
- 実数または複素数のベクトルまたは行列r: 論理値のベクトルまたは行列
-
- </para>
-
- </listitem>
-
- </varlistentry>
-
- </variablelist>
-
- </refsection>
-
- <refsection>
-
- <title>説明</title>
-
- <para>
-
- <literal>isinf(x)</literal> は,
-
- <literal>x</literal>の無限大のエントリに対応するエントリに真,
-
- <literal>x</literal>の有限のエントリに対応するエントリに偽を含む
-
- 論理値のベクトルまたは行列を返します.
-
- </para>
-
- </refsection>
-
- <refsection>
-
- <title>例</title>
-
- <programlisting role="example"><![CDATA[
-isinf([1 0.01 -%inf %inf])
- ]]></programlisting>
-
- </refsection>
-
- <refsection role="see also">
-
- <title>参照</title>
-
- <simplelist type="inline">
-
- <member>
-
- <link linkend="isnan">isnan</link>
-
- </member>
-
- </simplelist>
-
- </refsection>
-
-</refentry>
-
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="or_op" xml:lang="ja">
<refnamediv>
- <refname>|</refname>
+ <refname>|, ||</refname>
<refpurpose>論理和演算子</refpurpose>
</refnamediv>
+
<refsynopsisdiv>
<title>呼び出し手順</title>
- <synopsis>A|B</synopsis>
+ <para>
+ Matrix operation with full evaluation:
+ </para>
+ <synopsis>
+ full_res = A | B
+ int_res = intA | intB
+ </synopsis>
+ <para>
+ Short-circuited evaluation:
+ </para>
+ <synopsis>
+ short_circuit_res = A || B
+ if (A | B) then ... end
+ if (A || B) then ... end
+ while (A | B) then ... end
+ while (A || B) then ... end
+ </synopsis>
</refsynopsisdiv>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>full_res</varname>
+ is a boolean matrix of their common size.
+ The result is the element-wise <link linkend="or">or</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>full_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="or">or</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>int_res</varname>
+ is a matrix of integer of their common size.
+ The result is the element-wise <link linkend="bitor">bitor</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>int_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="bitor">bitor</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are of different integer encoding,
+ integer promotion is performed according to the following rules:
+ <itemizedlist>
+ <listitem>
+ if any operand is unsigned, <varname>int_res</varname> is unsigned;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> has the encoding of the higher number of bits between the encoding of <varname>A</varname> and <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> and <varname>B</varname> are promoted to the same encoding before computation is performed
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ boolean scalar when the operation is short-circuited.
+ </para>
+ <para>
+ The short-circuit operation evaluates to true if all entries of <varname>A</varname> is true. In this case <varname>B</varname> is not evaluated.
+ </para>
+ <para>
+ See <link linkend="or">or</link> for the definition of the evaluation to true depending on type and encoding.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+
<refsection>
<title>説明</title>
<para>
- <literal>A|B</literal> は論理値行列<literal>A</literal> および
- <literal>B</literal>の要素毎の論理和を出力します.
- <literal>A</literal> および <literal>B</literal> は
- 同じ次元の行列または片方が論理値スカラーである必要があります.
+ When the right and left operands are <emphasis>not both</emphasis> of integer type, <literal>A | B</literal> yields the element-wise logical
+ <literal>OR</literal> of matrices <varname>A</varname> and
+ <literal>B</literal> evaluated as matrices of boolean. <varname>A</varname> and <varname>B</varname> must
+ be matrices with the same dimensions or one from them must be a single
+ boolean.
+ If any operand is sparse the result of <literal>A | B</literal> is sparse encoded.
+ </para>
+ <para>
+ When both operands are of integer type, <literal>A | B</literal> yields the bitwise comparison between each element of <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ For <link linkend="if">if</link> and <link linkend="while">while</link> control structures or when computing <literal>A || B</literal>, the left operand is evaluated prior to the right operand. If all entries in the left operand are true, the result is set to <literal>%t</literal> short-circuiting the evaluation of the right operand.
+ Otherwise, <literal>A | B</literal> is computed.
</para>
</refsection>
+
<refsection>
<title>例</title>
<programlisting role="example"><![CDATA[
-[%t %t %f] | [%f %t %t]
-[%t %t %f] | %f
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A is evaluated as
+// [%f, %t;
+// %t, %f]
+// B is evaluated as
+// [%t, %t;
+// %f, %f]
+
+// | as logical operation
+A | B
+A | spB // Result is sparse encoded
+iA | spB // Result is sparse encoded
+cA | iB
+
+// | as bitwise operation
+iA | iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 | i8_B
+
+// Integer promotion
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A | ui32_B
+
+// || as a shortcut operation
+function res = foo()
+ disp("this is executed");
+ res = %t;
+endfunction
+
+if ( %t | foo() ) then
+ // foo is not executed
+end
+
+C = [1 %i; 2, 10]; // All C entries are different than 0
+if ( C || foo() ) then
+ // foo() is not executed
+end
]]></programlisting>
</refsection>
+
<refsection role="see also">
<title>参照</title>
<simplelist type="inline">
<member>
<link linkend="find">find</link>
</member>
+ <member>
+ <link linkend="bitor">bitor</link>
+ </member>
</simplelist>
</refsection>
</refentry>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA
- *
- * 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.
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isinf" xml:lang="pt">
- <refnamediv>
- <refname>isinf</refname>
- <refpurpose>verifica se há entradas infinitas</refpurpose>
- </refnamediv>
- <refsynopsisdiv>
- <title>Seqüência de Chamamento</title>
- <synopsis>r=isinf(x)</synopsis>
- </refsynopsisdiv>
- <refsection>
- <title>Parâmetros</title>
- <variablelist>
- <varlistentry>
- <term>x</term>
- <listitem>
- <para>um vetor ou matriz de reais ou complexos. r : um vetor ou
- matriz de valores booleanos
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </refsection>
- <refsection>
- <title>Descrição</title>
- <para>
- <literal>isinf(x)</literal> retorna um vetor ou matriz de valores
- booleanos que contém entradas verdadeiras correspondentes às entradas de
- <literal>x</literal> infinitas e entradas falsas correspondentes às
- entradas de <literal>x</literal> finitas.
- </para>
- </refsection>
- <refsection>
- <title>Exemplos</title>
- <programlisting role="example"><![CDATA[
-isinf([1 0.01 -%inf %inf])
- ]]></programlisting>
- </refsection>
- <refsection role="see also">
- <title>Ver Também</title>
- <simplelist type="inline">
- <member>
- <link linkend="isnan">isnan</link>
- </member>
- </simplelist>
- </refsection>
-</refentry>
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="and_op" xml:lang="ru">
<refnamediv>
- <refname>&</refname>
+ <refname>&, &&</refname>
<refpurpose>оператор логического И</refpurpose>
</refnamediv>
+
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>A&B</synopsis>
+ <para>
+ Matrix operation with full evaluation:
+ </para>
+ <synopsis>
+ full_res = A & B
+ int_res = intA & intB
+ </synopsis>
+ <para>
+ Short-circuited evaluation:
+ </para>
+ <synopsis>
+ short_circuit_res = A && B
+ if (A & B) then ... end
+ if (A && B) then ... end
+ while (A & B) then ... end
+ while (A && B) then ... end
+ </synopsis>
</refsynopsisdiv>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>full_res</varname>
+ is a boolean matrix of their common size.
+ The result is the element-wise <link linkend="and">and</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>full_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="and">and</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>int_res</varname>
+ is a matrix of integer of their common size.
+ The result is the element-wise <link linkend="bitand">bitand</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>int_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="bitand">bitand</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are of different integer encoding,
+ integer promotion is performed according to the following rules:
+ <itemizedlist>
+ <listitem>
+ if any operand is unsigned, <varname>int_res</varname> is unsigned;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> has the encoding of the higher number of bits between the encoding of <varname>A</varname> and <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> and <varname>B</varname> are promoted to the same encoding before computation is performed
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ boolean scalar when the operation is short-circuited.
+ </para>
+ <para>
+ The short-circuit operation evaluates to false if any entry of <varname>A</varname> is false. In this case <varname>B</varname> is not evaluated.
+ </para>
+ <para>
+ See <link linkend="and">and</link> for the definition of the evaluation to false depending on type and encoding.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+
<refsection>
<title>Описание</title>
<para>
- <literal>A&B</literal> даёт поэлементное логическое
- <literal>И</literal> матриц логических значений <literal>A</literal> и
- <literal>B</literal>. <literal>A</literal> и <literal>B</literal> должны быть
- матрицами одинаковых размеров или одна из них должна быть логическим скаляром.
+ When the right and left operands are <emphasis>not</emphasis> both of integer type, <literal>A & B</literal> yields the element-wise logical
+ <literal>AND</literal> of matrices <varname>A</varname> and
+ <literal>B</literal> evaluated as matrices of boolean. <varname>A</varname> and <varname>B</varname> must
+ be matrices with the same dimensions or one from them must be a single
+ boolean.
+ If any operand is sparse the result of <literal>A & B</literal> is sparse encoded.
+ </para>
+ <para>
+ When both operands are of integer type, <literal>A & B</literal> yields the bitwise comparison between each element of <varname>A</varname> and <varname>B</varname>.
</para>
+ <para>
+ For <link linkend="if">if</link> and <link linkend="while">while</link> control structures or when computing <literal>A && B</literal>, the left operand is evaluated prior to the right operand. If any entry in the left operand is false, the result is set to <literal>%f</literal> short-circuiting the evaluation of the right operand.
+ Otherwise, <literal>A & B</literal> is computed.
+ </para>
+ </refsection>
+
+ <refsection>
+ <title>Examples</title>
+ <programlisting role="example"><![CDATA[
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A is evaluated as
+// [%f, %t;
+// %t, %f]
+// B is evaluated as
+// [%t, %t;
+// %f, %f]
+
+// & as logical operation
+A & B
+A & spB // Result is sparse encoded
+iA & spB // Result is sparse encoded
+cA & iB
+
+// & as bitwise operation
+iA & iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 & i8_B
+
+// Integer promotion
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A & ui32_B
+
+// && as a shortcut operation
+function res = foo()
+ disp("this is executed");
+ res = %t;
+endfunction
+
+if ( %f & foo() ) then
+ // This is not executed
+end
+
+A && foo() // A has at least one element equals to 0
+iA && foo() // therefore, foo() is not executed
+cA && foo()
+
+iA && iB // iA is evalueated as false resulting in the short-circuited operation
+ ]]></programlisting>
</refsection>
+
<refsection role="see also">
<title>Смотрите также</title>
<simplelist type="inline">
<member>
<link linkend="or_op">or operator (|)</link>
</member>
+ <member>
+ <link linkend="bitand">bitand</link>
+ </member>
</simplelist>
</refsection>
</refentry>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>r=isinf(x)</synopsis>
+ <synopsis>r = isinf(x)</synopsis>
</refsynopsisdiv>
<refsection>
<title>Аргументы</title>
<refsection>
<title>Описание</title>
<para>
- <literal>isinf(x)</literal> возвращает вектор или матрицу логических значений, в которых истинные элементы соответствуют бесконечным элементам <literal>x</literal>,
- а ложные элементы соответствуют конечным элементам <literal>x</literal>.
+ <literal>isinf(x)</literal> returns a matrix <varname>r</varname>
+ of booleans such that, for each element <varname>x(i)</varname>,
+ <varname>r(i)</varname> is set to <literal>%T</literal> as soon as
+ <varname>x(i)</varname> is infinite.
+ </para>
+ <para>When <literal>x</literal> is complex-encoded, <literal>x(i)</literal>
+ is considered infinite as soon as its real or imaginary or both parts
+ are infinite.
</para>
</refsection>
<refsection>
<title>Примеры</title>
- <programlisting role="example"><![CDATA[
-isinf([1 0.01 -%inf %inf])
+ <programlisting role="example"><![CDATA[
+[i, inf, nan] = (%i, %inf, %nan);
+isinf([-1 0.01 -inf inf nan])
+isinf([2+i, -10-inf, inf+i])
+isinf([nan-i, inf-nan*i, nan+i*inf])
]]></programlisting>
</refsection>
<refsection role="see also">
<member>
<link linkend="isnan">isnan</link>
</member>
+ <member>
+ <link linkend="isreal">isreal</link>
+ </member>
+ <member>
+ <link linkend="isnum">isnum</link>
+ </member>
+ <member>
+ <link linkend="type">type</link>
+ </member>
</simplelist>
</refsection>
</refentry>
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="or_op" xml:lang="ru">
<refnamediv>
- <refname>|</refname>
+ <refname>|, ||</refname>
<refpurpose>оператор логического ИЛИ</refpurpose>
</refnamediv>
+
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>A|B</synopsis>
+ <para>
+ Matrix operation with full evaluation:
+ </para>
+ <synopsis>
+ full_res = A | B
+ int_res = intA | intB
+ </synopsis>
+ <para>
+ Short-circuited evaluation:
+ </para>
+ <synopsis>
+ short_circuit_res = A || B
+ if (A | B) then ... end
+ if (A || B) then ... end
+ while (A | B) then ... end
+ while (A || B) then ... end
+ </synopsis>
</refsynopsisdiv>
+
+ <refsection role="parameters">
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of booleans (may be sparse encoded)
+ encoded integers (of any
+ <link linkend="inttype">inttype</link>), real, or complex numbers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>full_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>full_res</varname>
+ is a boolean matrix of their common size.
+ The result is the element-wise <link linkend="or">or</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>full_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="or">or</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intA</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>intB</term>
+ <listitem>
+ <para>
+ scalar, vector, matrix, or hypermatrix of encoded integers (of any
+ <link linkend="inttype">inttype</link>).
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>int_res</term>
+ <listitem>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are not scalar,
+ they must be of the same size and <varname>int_res</varname>
+ is a matrix of integer of their common size.
+ The result is the element-wise <link linkend="bitor">bitor</link> operation between <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ If <varname>A</varname> or <varname>B</varname> is a scalar,
+ <varname>int_res</varname> is a boolean matrix of the size
+ of the other operand.
+ The result is the element-wise <link linkend="bitor">bitor</link> operation between the matrix of the greater size and the scalar.
+ </para>
+ <para>
+ If <varname>A</varname> and <varname>B</varname> are of different integer encoding,
+ integer promotion is performed according to the following rules:
+ <itemizedlist>
+ <listitem>
+ if any operand is unsigned, <varname>int_res</varname> is unsigned;
+ </listitem>
+ <listitem>
+ <varname>int_res</varname> has the encoding of the higher number of bits between the encoding of <varname>A</varname> and <varname>B</varname>;
+ </listitem>
+ <listitem>
+ <varname>A</varname> and <varname>B</varname> are promoted to the same encoding before computation is performed
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>short_circuit_res</term>
+ <listitem>
+ <para>
+ boolean scalar when the operation is short-circuited.
+ </para>
+ <para>
+ The short-circuit operation evaluates to true if all entries of <varname>A</varname> is true. In this case <varname>B</varname> is not evaluated.
+ </para>
+ <para>
+ See <link linkend="or">or</link> for the definition of the evaluation to true depending on type and encoding.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+
<refsection>
<title>Описание</title>
<para>
- <literal>A|B</literal> даёт поэлементное логическое ИЛИ матриц логических
- значений <literal>A</literal> и <literal>B</literal>. <literal>A</literal>
- и <literal>B</literal> должны быть матрицами одинакового размера, либо
- одна из них должна быть логическим скаляром.
+ When the right and left operands are <emphasis>not both</emphasis> of integer type, <literal>A | B</literal> yields the element-wise logical
+ <literal>OR</literal> of matrices <varname>A</varname> and
+ <literal>B</literal> evaluated as matrices of boolean. <varname>A</varname> and <varname>B</varname> must
+ be matrices with the same dimensions or one from them must be a single
+ boolean.
+ If any operand is sparse the result of <literal>A | B</literal> is sparse encoded.
+ </para>
+ <para>
+ When both operands are of integer type, <literal>A | B</literal> yields the bitwise comparison between each element of <varname>A</varname> and <varname>B</varname>.
+ </para>
+ <para>
+ For <link linkend="if">if</link> and <link linkend="while">while</link> control structures or when computing <literal>A || B</literal>, the left operand is evaluated prior to the right operand. If all entries in the left operand are true, the result is set to <literal>%t</literal> short-circuiting the evaluation of the right operand.
+ Otherwise, <literal>A | B</literal> is computed.
</para>
</refsection>
+
<refsection>
<title>Примеры</title>
<programlisting role="example"><![CDATA[
-[%t %t %f] | [%f %t %t]
-[%t %t %f] | %f
+A = [0 1; 1 0];
+B = [1 1; 0 0];
+spA = sparse(A);
+spB = sparse(B);
+spbA = sparse(A<>0);
+spbB = sparse(B<>0);
+iA = int8(A);
+iB = int8(B);
+cA = A + 0*%i;
+cB = B + 0*%i;
+
+// A is evaluated as
+// [%f, %t;
+// %t, %f]
+// B is evaluated as
+// [%t, %t;
+// %f, %f]
+
+// | as logical operation
+A | B
+A | spB // Result is sparse encoded
+iA | spB // Result is sparse encoded
+cA | iB
+
+// | as bitwise operation
+iA | iB
+
+i8_A = int8([ -1, 1; 127, -128]);
+// Integer representation of i8_A:
+// [ 1111 1111, 0000 0001 ;
+// 0111 1111, 1000 0000 ]
+
+i8_B = int8([-2, 0; 126, -127]);
+// Integer representation of i8_A:
+// [ 1111 1110, 0000 0000 ;
+// 0111 1110, 1000 0001 ]
+
+i8_1 | i8_B
+
+// Integer promotion
+i16_A = int16(i8_A);
+ui32_B = uint32(i8_B);
+
+i16_A | ui32_B
+
+// || as a shortcut operation
+function res = foo()
+ disp("this is executed");
+ res = %t;
+endfunction
+
+if ( %t | foo() ) then
+ // foo is not executed
+end
+
+C = [1 %i; 2, 10]; // All C entries are different than 0
+if ( C || foo() ) then
+ // foo() is not executed
+end
+
]]></programlisting>
</refsection>
+
<refsection role="see also">
<title>Смотрите также</title>
<simplelist type="inline">
<member>
<link linkend="find">find</link>
</member>
+ <member>
+ <link linkend="bitor">bitor</link>
+ </member>
</simplelist>
</refsection>
</refentry>
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
+// Copyright (C) 2016 - Samuel GOUGEON
//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
//
// For more information, see the COPYING file which you should have received
// along with this program.
-function r=isinf(x)
+function r = isinf(x)
rhs = argn(2);
if rhs <> 1 then
- error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"),"isinf",1));
+ msg = _("%s: Wrong number of input argument(s): %d expected.\n")
+ error(msprintf(msg, "isinf", 1))
end
if x==[] then
- r=[];
+ r = []
else
- r=abs(x)==%inf;
+ if isreal(x)
+ r = abs(x)==%inf;
+ else
+ // workaround of http://bugzilla.scilab.org/14062
+ r = abs(real(x))==%inf | abs(imag(x))==%inf
+ end
end
endfunction
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Samuel GOUGEON
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 14648 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/14648
+//
+// <-- Short Description -->
+// isinf(complex(%inf,%inf)) and isinf(complex(%nan,%inf)) returned %F
+// =============================================================================
+c = complex(%inf*[1 1 -1 -1], %inf*[1 -1 1 -1]);
+assert_checktrue(and(isinf(c)));
+c = complex([%nan %nan %inf -%inf], [%inf -%inf %nan %nan]);
+assert_checktrue(and(isinf(c)));
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Samuel GOUGEON
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 14648 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/14648
+//
+// <-- Short Description -->
+// isinf(complex(%inf,%inf)) and isinf(complex(%nan,%inf)) returned %F
+// =============================================================================
+c = complex(%inf*[1 1 -1 -1], %inf*[1 -1 1 -1]);
+assert_checktrue(and(isinf(c)));
+c = complex([%nan %nan %inf -%inf], [%inf -%inf %nan %nan]);
+assert_checktrue(and(isinf(c)));
</tr>
<tr>
<td>
+ <ulink url="http://docbook.org/tdg51/en/html/refsect1.html">refsect1</ulink>
+ </td>
+ <td>
+ A recursive section in a refentry level 1 ; similar to <code>refsection</code>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <ulink url="http://docbook.org/tdg51/en/html/refsect2.html">refsect2</ulink>
+ </td>
+ <td>
+ A recursive section in a refentry level 2 ; sub-section of <code>refsect1</code>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <ulink url="http://docbook.org/tdg51/en/html/refsect3.html">refsect3</ulink>
+ </td>
+ <td>
+ A recursive section in a refentry level 3 ; sub-section of <code>refsect2</code>
+ </td>
+ </tr>
+ <tr>
+ <td>
<ulink url="http://docbook.org/tdg51/en/html/book.html">book</ulink>
</td>
<td>A book</td>
<revnumber>5.4.0</revnumber>
<revdescription>Management of tags <note>, <caution>, <warning>, <important> and <tip>
</revdescription>
+ </revision>
+ <revision>
<revnumber>6.0.0</revnumber>
<revdescription>Update the documentation to Docbook 5.1</revdescription>
</revision>
do
{
HistoryManager::getInstance()->deleteNthLine(pDbl->get(0));
+ FREE(pcLigne);
pcLigne = HistoryManager::getInstance()->getNthLine(pDbl->get(0));
size = HistoryManager::getInstance()->getNumberOfLines();
}
{
HistoryManager::getInstance()->deleteNthLine(pDbl->get(0));
}
+ FREE(pcLigne);
}
else
{
/*------------------------------------------------------------------------*/
#define STRING_BEGIN_SESSION _("Begin Session : ")
#define FORMAT_SESSION "%s%s%s"
+#define LONG_FORMAT_SESSION "%s%s%s%s"
#define MAX_wday 7 /* number days in a week */
#define MAX_mon 12 /* number of month in a year */
/*------------------------------------------------------------------------*/
{
if (longFormat)
{
- sprintf(line, FORMAT_SESSION, SESSION_PRAGMA_BEGIN, STRING_BEGIN_SESSION, time_str, SESSION_PRAGMA_END);
+ sprintf(line, LONG_FORMAT_SESSION, SESSION_PRAGMA_BEGIN, STRING_BEGIN_SESSION, time_str, SESSION_PRAGMA_END);
}
else
{
}
else
{
+ result = (char *)MALLOC(sizeof(char));
strcpy(result, "");
}
m_iSavedLines = 0;
}
- if (pstCleanedLine)
- {
- FREE(pstCleanedLine);
- pstCleanedLine = NULL;
- }
+ FREE(pstCleanedLine);
+ pstCleanedLine = NULL;
}
return bOK;
// Copyright (C) INRIA
//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
//
// 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.
// For more information, see the COPYING file which you should have received
// along with this program.
-function r=%s_h_b(a,b)
- // r=a&b
- r=(a<>0)&b
+function res=%b_g_i(b1,i2)
+ res = (i2<>0) | b1;
endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%b_g_sp(b1, sp2)
+ // Sparse matrix with scalar boolean special case
+ res = b1 | (sp2<>0);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%b_h_i(b1,i2)
+ res = generic_s_h_s(b1,i2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%b_h_sp(b1, sp2)
+ // Sparse matrix with scalar boolean special case
+ res = b1 & (sp2<>0);
+endfunction
+++ /dev/null
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) Bruno Pincon
-//
-// 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.
-
-function r=%hm_g_hm(a,b)
- // define the operation a | b for boolean hypermatrices a and b
- // a | b is defined if a and b are boolean hypermatrices
- // and if a and b have the same dimensions
- // or if one have only one element
- if type(a.entries) ~= 4 | type(b.entries) ~= 4 then
- error(msprintf(_("%s: Operand is not a boolean hypermatrix.\n"),"%hm_g_hm"));
- end
- if and(a.dims==b.dims) then
- r=hypermat(a.dims,a.entries | b.entries)
- elseif prod(a.dims) == 1 then
- r=hypermat(b.dims,a.entries | b.entries)
- elseif prod(b.dims) == 1 then
- r=hypermat(a.dims,a.entries | b.entries)
- else
- error(msprintf(_("%s: Incompatible operand dimensions.\n"),"%hm_g_hm"));
- end
-endfunction
+++ /dev/null
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) Bruno Pincon
-//
-// 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.
-
-
-function r=%hm_h_hm(a,b)
- // define the operation a & b for boolean hypermatrices a and b
- // a & b is defined if a and b are boolean hypermatrices
- // and if a and b have the same dimensions
- // or if one have only one element
- if type(a.entries) ~= 4 | type(b.entries) ~= 4 then
- error(msprintf(_("%s: Wrong type for input argument(s): hypermatrix expected.\n"),"%hm_h_hm"));
- end
- if and(a.dims==b.dims) then
- r=hypermat(a.dims,a.entries & b.entries)
- elseif prod(a.dims) == 1 then
- r=hypermat(b.dims,a.entries & b.entries)
- elseif prod(b.dims) == 1 then
- r=hypermat(a.dims,a.entries & b.entries)
- else
- error(msprintf(_("%s: Incompatible operand dimensions.\n"),"%hm_h_hm"));
- end
-endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_g_b(i1,b2)
+ res = (i1<>0) | b2;
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_g_s(i1,s2)
+ res = (i1 <> 0) | (s2 <> 0);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_g_sp(i1,sp2)
+ res = generic_s_g_s(i1, sp2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_g_spb(i1,spb2)
+ res = (i1 <> 0) | spb2;
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_h_b(i1,b2)
+ res = generic_s_h_s(i1, b2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_h_s(i1,s2)
+ res = generic_s_h_s(i1, s2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_h_sp(i1,sp2)
+ res = generic_s_h_s(i1, sp2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%i_h_spb(i1,spb2)
+ res = (i1 <> 0) & spb2;
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%s_g_i(s1,i2)
+ res = (s1 <> 0) | (i2 <> 0);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%s_g_s(s1,s2)
+ // Logical operand on complex numbers
+ res = (s1<>0) | (s2<>0);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%s_g_sp(s1, sp2)
+ res = generic_s_g_s(s1, sp2);
+endfunction
// Copyright (C) INRIA
//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
//
// 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.
// For more information, see the COPYING file which you should have received
// along with this program.
-function r=%spb_h_spb(a,b)
- // perform logical elementwise and a&b where a and b are boolean sparse
- // matrices
-
- if prod(size(a))==1 then
- if full(a) then
- r=b
- else
- r=sparse([],[],size(b))<>0
- end
- elseif prod(size(b))==1 then
- if full(b) then
- r=a
- else
- r=sparse([],[],size(a))<>0
- end
- else
- r=a&b
- end
+function res=%s_g_spb(s1, spb2)
+ res = (s1 <> 0) | spb2;
endfunction
+
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%s_h_i(s1,i2)
+ res = generic_s_h_s(s1, i2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%s_h_s(s1,s2)
+ // Logical operand on complex numbers
+ res = (s1<>0) & (s2<>0);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%s_h_sp(s1, sp2)
+ res = generic_s_h_s(s1, sp2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%s_h_spb(s1, spb2)
+ res = (s1 <> 0) & spb2;
+endfunction
+
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_g_b(sp1, b2)
+ // Sparse matrix with scalar boolean special case
+ res = (sp1<>0) | b2;
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_g_i(sp1,i2)
+ res = generic_s_g_s(sp1,i2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_g_s(sp1, s2)
+ res = generic_s_g_s(sp1, s2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_g_sp(sp1,sp2)
+ res = generic_s_g_s(sp1,sp2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_g_spb(sp1,spb2)
+ res = (sp1<>0) | spb2;
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_h_b(sp1, b2)
+ // Sparse matrix with scalar boolean special case
+ res = (sp1<>0) & b2;
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_h_i(sp1,i2)
+ res = generic_s_h_s(sp1,i2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_h_s(sp1, s2)
+ res = generic_s_h_s(sp1, s2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_h_sp(sp1,sp2)
+ res = generic_s_h_s(sp1,sp2);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%sp_h_spb(sp1,spb2)
+ res = (sp1<>0) & spb2;
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%spb_g_i(spb1, i2)
+ res = spb1 | (i2 <> 0);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%spb_g_s(spb1, s2)
+ res = spb1 | (s2 <> 0);
+endfunction
+
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%spb_g_sp(spb1,sp2)
+ res = (sp2<>0) | spb1;
+endfunction
+++ /dev/null
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// 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.
-
-function r=%spb_g_spb(a,b)
- // perform logical elementwise or a|b where a and b are boolean sparse
- // matrices
-
- if prod(size(a))==1 then
- if full(a) then
- [mb,nb]==size(b)
- r=(ones(mb,nb)==1)
- else
- r=b
- end
- elseif prod(size(b))==1 then
- if full(b) then
- [ma,na]==size(a)
- r=(ones(ma,na)==1)
- else
- r=a
- end
- else
- r=a|b
- end
-endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%spb_h_i(spb1, i2)
+ res = spb1 & (i2 <> 0);
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%spb_h_s(spb1, s2)
+ res = spb1 & (s2 <> 0);
+endfunction
+
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+//
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Scilab Enterprises - Pierre-Aimé AGNEL
+//
+// 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.
+
+function res=%spb_h_sp(spb1,sp2)
+ res = (sp2<>0) & spb1;
+endfunction
// Copyright (C) INRIA
//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Pierre-Aimé AGNEL
//
// 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.
// and continues to be available under such terms.
// For more information, see the COPYING file which you should have received
// along with this program.
-function r=%b_g_s(a,b)
- // r=a|b
- r=a|(b<>0)
+function res = generic_s_g_s(s1, s2)
+ res = (s1 <> 0) | (s2 <> 0)
endfunction
// Copyright (C) INRIA
//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2016 - Pierre-Aimé AGNEL
//
// 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.
// and continues to be available under such terms.
// For more information, see the COPYING file which you should have received
// along with this program.
-function r=%b_h_s(a,b)
- // r=a&b
- r=a&(b<>0)
+function res = generic_s_h_s(s1, s2)
+ res = (s1 <> 0) & (s2 <> 0)
endfunction
System.err.println(e);
}
- String[] scilabHandlesDictionnary = Completion.searchHandleGraphicsPropertiesDictionary(searchedPattern);
+ String[] scilabHandlesDictionary = Completion.searchHandleGraphicsPropertiesDictionary(searchedPattern);
String type = Messages.gettext("Graphics handle field");
list = new ArrayList<CompletionItem>();
- if (scilabHandlesDictionnary != null) {
- for (String item : scilabHandlesDictionnary) {
- dictionnary.add(new CompletionItemImpl(type, item + " (" + type + ")", item, Messages.gettext("No help")));
+ if (scilabHandlesDictionary != null) {
+ for (String item : scilabHandlesDictionary) {
+ dictionary.add(new CompletionItemImpl(type, item + " (" + type + ")", item, Messages.gettext("No help")));
}
}
- return dictionnary;
+ return dictionary;
}
return list;
}