== General guidelines == - comment your code (everybody must understand what is being done) - NEVER more than one blank line please! - Align operators vertically to emphasize local program structure and semantics when possible - Do not use excessive blank spaces (especially in equations) == C/C++ == - if/for should follow this: - no space fetween if/for and its statement - If an if/for holds on one line, then do not use brackets - Otherwise, use brackets {{{ #!c for(int i=0>{:}` || `<>.flatten()` || Flatten a MATLAB cell array or !NumPy `ndarray`. || || `find(a>0.5)` || `np.where(a>0.5)[0]` || Find the indices where (a > 0.5).[[BR]][[BR]]When only the {{{condition}}} parameter is provided, this function is a shorthand for `np.asarray(condition).nonzero()`.[[BR]][[BR]]See also: [https://numpy.org/doc/stable/reference/generated/numpy.where.html numpy.where - NumPy][[BR]][[BR]]NOTE:[[BR]]- `a` must be of type `np.array` (or one of its subclasses): a {{{list}}} will not automatically be cast.[[BR]]- Returns a tuple of arrays of indices, one for each dimension of the input array. Thus, when the input array is 1D, the indices can be retrieved simply by addressing the first element of the result (as in the example). || || `find('cond1'&'cond2')` || `np.where(np.logical_and.reduce(('cond1','cond2'))[0]` || Find the indices where `'cond1'` and `'cond2'` are met.[[BR]][[BR]]The same protocol can be followed for MATLAB's `|` by instead using `logical_or`.[[BR]][[BR]]More than two conditions may be compounded. || || `v=nonzeros(A)` || `v=A[np.nonzero(A)]` || Find the values of the nonzero elements || || `B=sortrows(A,column)` || `B=A[A[:,column].argsort()]` || sort rows of matrix or table (MATLAB), or 2D array (!NumPy) in ascending order based on the elements in 'column' || || `sqrt(A)` || `A ** 0.5` || Element-wise square root (math.sqrt can only be applied to scalars) || == !Variable/Enum/Function Names == - variables should not use capital letters. Use underscores to make variables more understandable. - Function names and enums should not use any underscore. Use capital letters to make names more understandable. Example: {{{ #!c Input* vx_input=GetInput(inputs,VxInput); }}}