Technical Documentation
ATOM VECTOR: Compare

Two Atom Vectors (AVs) can be compared. An Atom Vector is determined to be smaller than another if the length of the vector of the first AV is smaller than the second. If the AVs are of the same length, the comparison is between the magnitudes of the two vectors. Finally, the individual elements of the AVs are compared and a result is declared as soon as there is a mismatch.

Thus, the only meaningful comparison is that for equality.

The following example is self-explanatory:

>>> from Yup.Taro.AtomVect import *
>>> A = AtomVector( numatom=3, sample='UNIFORM' )
>>> B = AtomVector( numatom=3, sample='UNIFORM' )
>>> A
AtomVector[3:3] {
-0.0277413 0.648549 0.382733
-0.0690634 -0.89526 0.656545
-0.404462 0.547166 0.0104678
}

>>> B
AtomVector[3:3] {
0.750603 0.832209 0.22074
0.44554 0.263894 -0.966918
-0.0707724 -0.531358 -0.292947
}

>>> A < B
1
>>> A > B
0
>>> A == B
0
>>> A.fill( copy=B )
>>> A
AtomVector[3:3] {
0.750603 0.832209 0.22074
0.44554 0.263894 -0.966918
-0.0707724 -0.531358 -0.292947
}

>>> A == B
1
>>> A is B
0
>>>

In the second part of the example, B is copied to A and therefore the equality operation returns 1, i.e., true. A and B are not the same objects as the is operator affirms.

Intro
New
Print
Compare
Operators
Data
Methods
Functions
Subscript
Files

Technical
Introduction
Directory
Vectors
Energy
Model
Assembly
Methods
FPF
FFF
AVF
TaroScript
YammpScript
Python
Utilities

Home
Information
News
User
Technical
Programmer
iYup
Download
Showcase
ETC