00001
00002 """
00003 Boolean vector functions
00004 """
00005
00006 __copyright__ = """
00007 Copyright 2008 Sean Ross-Ross
00008 """
00009 __license__ = """
00010 This file is part of SLIMpy .
00011
00012 SLIMpy is free software: you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as published by
00014 the Free Software Foundation, either version 3 of the License, or
00015 (at your option) any later version.
00016
00017 SLIMpy is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 GNU Lesser General Public License for more details.
00021
00022 You should have received a copy of the GNU Lesser General Public License
00023 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00024 """
00025
00026 from slimpy_base.api.functions import slimpy_function_register
00027 from slimpy_base.Core.Interface.Structure import Structure
00028
00029
00030
00031
00032
00033
00034
00035
00036 @slimpy_function_register
00037 def equal( vec1 , vec2 , eps=0 ):
00038 """
00039 equal( vec1 , vec2 , eps=0 ) -> vec3
00040
00041 Test if two vectors elemnts are equal within eps precision
00042 """
00043
00044 cmd = "eq"
00045 struct = Structure( )
00046 right = struct.source_or_num( vec2 )
00047
00048 return struct.generateNew( vec1, cmd, eps=eps, right=right )
00049
00050
00051
00052
00053
00054
00055
00056
00057 @slimpy_function_register
00058 def not_equal( vec1 , vec2 , eps=0 ):
00059 """
00060 not_equal( vec1 , vec2 , eps=0 ) -> vec3
00061
00062 Test if two vectors elemnts are not equal within eps precision
00063 """
00064
00065 cmd = "ne"
00066 struct = Structure( )
00067 right = struct.source_or_num( vec2 )
00068 return struct.generateNew( vec1, cmd, eps=eps, right=right )
00069
00070
00071
00072
00073
00074
00075
00076
00077 @slimpy_function_register
00078 def less_than( vec1 , vec2 , eps=0 ):
00079 """
00080 less_than( vec1 , vec2 , eps=0 ) -> vec3
00081
00082 Test if two vectors elemnts are less than vec2
00083 """
00084 cmd = "lt"
00085 struct = Structure( )
00086 right = struct.source_or_num( vec2 )
00087 return struct.generateNew( vec1, cmd, eps=eps, right=right )
00088
00089
00090
00091
00092
00093
00094
00095
00096 @slimpy_function_register
00097 def less_than_eq( vec1 , vec2 , eps=0 ):
00098 """
00099 less_than_eq( vec1 , vec2 , eps=0 ) -> vec3
00100
00101 Test if two vectors elemnts are less than or equal to vec2
00102
00103 """
00104 cmd = "le"
00105 struct = Structure( )
00106 right = struct.source_or_num( vec2 )
00107 return struct.generateNew( vec1, cmd, eps=eps, right=right )
00108
00109
00110
00111
00112
00113
00114
00115
00116 @slimpy_function_register
00117 def greater_than( vec1 , vec2 , eps=0 ):
00118 """
00119 greater_than( vec1 , vec2 , eps=0 ) -> vec3
00120
00121 Test if two vectors elemnts are greater than vec2
00122
00123 """
00124 cmd = "gt"
00125 struct = Structure( )
00126 right = struct.source_or_num( vec2 )
00127 return struct.generateNew( vec1, cmd, eps=eps, right=right )
00128
00129
00130
00131
00132
00133
00134
00135
00136 @slimpy_function_register
00137 def greater_than_eq( vec1 , vec2 , eps=0 ):
00138 """
00139 greater_than_eq( vec1 , vec2 , eps=0 ) -> vec3
00140
00141 Test if two vectors elemnts are greater than or equal to vec2
00142 """
00143 cmd = "ge"
00144 struct = Structure( )
00145 right = struct.source_or_num( vec2 )
00146 return struct.generateNew( vec1, cmd, eps=eps, right=right )
00147
00148
00149
00150
00151
00152
00153
00154
00155 @slimpy_function_register
00156 def or_( vec1 , vec2 , eps=0 ):
00157 """
00158 or_( vec1 , vec2 , eps=0 ) -> vec3
00159
00160 Test if elements of either vec1 or vec2 are non-zero
00161 """
00162 cmd = "or_"
00163 struct = Structure( )
00164 right = struct.source_or_num( vec2 )
00165 return struct.generateNew( vec1, cmd, eps=eps, right=right )
00166
00167
00168
00169
00170
00171
00172
00173
00174 @slimpy_function_register
00175 def and_( vec1 , vec2 , eps=0 ):
00176 """
00177 and_( vec1 , vec2 , eps=0 ) -> vec3
00178
00179 Test if elements of either vec1 or vec2 are non-zero
00180 """
00181 cmd = "and_"
00182 struct = Structure( )
00183 right = struct.source_or_num( vec2 )
00184 return struct.generateNew( vec1, cmd, eps=eps, right=right )