Syntax
[NL,ri]=VLunidirect(VL,[thr])
Input Parameter
VL : | | Vector list |
thr : | | number of relevant digits for round; default is 5 |
Output Parameter
NL : | | Reduced Vector list |
ri : | | removal index list |
Examples
VL=[1 0 0;-1 0 0; 0 1 0; 0 -1 0; 0 0 1; 0 0 -1;1 -1 0; -1 1 0.00001],
VLunidirect(VL,3)
VLunidirect(VL,5)
Copyright 2018-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 function, VLunidirect
, processes a list of vectors to ensure that each vector is represented only once, regardless of its direction. It removes duplicate vectors that are opposite in direction, keeping only the first occurrence.
Input Parameters
- VL: A matrix representing a list of vectors. Each row corresponds to a vector.
- thr (optional): A threshold for rounding, specifying the number of relevant digits. The default value is 5.
Output Results
- NL: A reduced list of vectors, with duplicates removed.
- ri: A list of indices indicating which vectors were removed.
Algorithm Steps
- Initialize the threshold
thr
to 5. If a second argument is provided and is not empty, update thr
with this value.
- Iterate over each vector in
VL
from the last to the first.
- For each vector, check if its negative (opposite direction) is already present in the preceding vectors. Use rounding based on
thr
to compare vectors.
- Store the result of this check in
ri
, marking vectors that have duplicates in opposite directions.
- Convert
ri
to a column vector.
- Create
NL
by excluding vectors marked in ri
.
- If no output arguments are specified and the vectors are 3D, plot the original and reduced vector lists using
SGfigure
and VLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:06. (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