Changeset a392913 in tol
- Timestamp:
- Nov 13, 2009, 4:09:17 PM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- cc77af9
- Parents:
- 95ca6b7
- File:
-
- 1 edited
-
tol_pkg/MatEncode/MatEncode.tol (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol_pkg/MatEncode/MatEncode.tol
r95ca6b7 ra392913 10 10 [[ 11 11 12 #Require HashMap;13 #Require MatQuery;12 #Require HashMap; 13 #Require MatQuery; 14 14 15 15 Text _.autodoc.description = "Handling and storing generic features, " … … 37 37 Static Text _.autodoc.member.get = "Returns the stored value corresponding " 38 38 "to this feature related to an individual entity."; 39 Anything get( Matrix store, Real entity)39 Anything get(VMatrix store, Real entity) 40 40 //////////////////////////////////////////////////////////////////////////// 41 41 }; … … 65 65 66 66 //////////////////////////////////////////////////////////////////////////// 67 Anything get( Matrix store, Real entity)68 //////////////////////////////////////////////////////////////////////////// 69 { 70 MatDat(store, entity, _.position)67 Anything get(VMatrix store, Real entity) 68 //////////////////////////////////////////////////////////////////////////// 69 { 70 VMatDat(store, entity, _.position) 71 71 } 72 72 }; … … 103 103 104 104 //////////////////////////////////////////////////////////////////////////// 105 Anything get( Matrix store, Real entity)106 //////////////////////////////////////////////////////////////////////////// 107 { 108 Real idx = MatDat(store, entity, _.position);105 Anything get(VMatrix store, Real entity) 106 //////////////////////////////////////////////////////////////////////////// 107 { 108 Real idx = VMatDat(store, entity, _.position); 109 109 _.domain[idx] 110 110 }; … … 126 126 //In each row of this matrix are stored the values or indexes of features 127 127 //related to an individual entity 128 Matrix _.data = Rand(0,0,0,0);128 VMatrix _.data = Rand(0,0,0,0); 129 129 130 130 //////////////////////////////////////////////////////////////////////////// … … 162 162 163 163 //////////////////////////////////////////////////////////////////////////// 164 Text _.autodoc.member. feature.index = "Returns the index of a feature or 0"165 " if it not exists";166 Real feature.index(Text name)164 Text _.autodoc.member.get.feature.index = "Returns the index of a feature " 165 "or 0 if it not exists"; 166 Real get.feature.index(Text name) 167 167 //////////////////////////////////////////////////////////////////////////// 168 168 { … … 195 195 Text _.autodoc.member.match.feature.with.value = 196 196 "Returns a column matrix with True in rows where given feature has " 197 "specified value"; 197 "specified value, numerical or not. If the value is not numeric argument " 198 "'value.id' must be its name to search it in feature domain"; 198 199 VMatrix match.feature.with.value( 199 200 Text feature.name, … … 201 202 //////////////////////////////////////////////////////////////////////////// 202 203 { 203 Real num = _.feature.index(feature.name);204 Real num = get.feature.index(feature.name); 204 205 @Feature f = _.feature[num]; 205 206 Real value = If(f::is.numeric(0), … … 210 211 211 212 //////////////////////////////////////////////////////////////////////////// 212 Text _.autodoc.member.and.match.feature.with.value = 213 "Returns a column matrix with True in rows where given feature has " 214 "specified value"; 215 VMatrix and.match.feature.with.value( 216 Text feature.name, 217 Anything value.id, //Text value identifier in domain or Real value 218 VMatrix match) 219 //////////////////////////////////////////////////////////////////////////// 220 { 221 And(match,select.feature.with.value(feature.name,value.id)) 213 Text _.autodoc.member.match.feature.in.interval = 214 "Returns a column matrix with True in rows where given numerical feature " 215 "whose cell is inside the interval defined as: \n" 216 " [min,max]: if minIncluded=True and minIncluded=True\n" 217 " (min,max]: if minIncluded=False and minIncluded=True\n" 218 " [min,max): if minIncluded=True and minIncluded=False\n" 219 " (min,max): if minIncluded=False and minIncluded=False\n"; 220 VMatrix match.feature.in.interval( 221 Text feature.name, 222 Real minIncluded, 223 Real min, 224 Real max, 225 Real maxIncluded) 226 //////////////////////////////////////////////////////////////////////////// 227 { 228 Real num = get.feature.index(feature.name); 229 @Feature f = _.feature[num]; 230 MatQuery::MatchRowsInInterval( 231 SubCol(_.data,[[num]]), 232 minIncluded, 233 min, 234 max, 235 maxIncluded) 236 }; 237 238 //////////////////////////////////////////////////////////////////////////// 239 Text _.autodoc.member.extract.feature = 240 "Returns a column matrix with all rows with numerical code of a given " 241 "feature"; 242 VMatrix extract.feature( 243 Text feature.name, 244 Set row.indexes) //Text value identifier in domain or Real value 245 //////////////////////////////////////////////////////////////////////////// 246 { 247 Real col = get.feature.index(feature.name); 248 SubCol(_.data,[[col]]) 249 }; 250 251 //////////////////////////////////////////////////////////////////////////// 252 Text _.autodoc.member.extract.feature.rows = 253 "Returns a column matrix with selected rows with numerical code of a " 254 "given feature"; 255 VMatrix extract.feature.rows( 256 Text feature.name, 257 Set row.indexes) //Text value identifier in domain or Real value 258 //////////////////////////////////////////////////////////////////////////// 259 { 260 Real col = get.feature.index(feature.name); 261 SubRow(SubCol(_.data,[[col]]),row.indexes) 222 262 } 263 264 223 265 } 224 266
Note: See TracChangeset
for help on using the changeset viewer.
