allmembers

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 1.0, Creation date: 2012-07-09, Last change: 2025-09-14

similar to ismember(A,S,'rows') but returns all members of a set

Description

performs a fast comparison of elements, and returns a list of indices

Example Illustration

 missing image of allmembers(A,S)

Syntax

IL=allmembers(A,S)

Input Parameter

A: Vector to comapre
S: List of vectors

Output Parameter

IL: List of Indices




Copyright 2012-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This algorithm is designed to find all indices of a vector A within a list of vectors S. It is similar to the MATLAB function ismember(A,S,'rows') but returns all matching indices.

Input Parameters

Output Results

Algorithm Steps

  1. Compute a logical matrix where each element of S is compared with A using the equality operator ==.
  2. Multiply the logical matrix by a column vector (1:size(S,1))' to get indices where matches occur.
  3. Use the unique function to remove duplicate indices and ensure each index is listed only once.
  4. Check if the first element of IL is zero. If it is, remove it from the list to ensure only valid indices are returned.
Algorithm explaination created using ChatGPT on 2025-08-18 21:55. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21