hash tables

hash – hash tables

Calling sequence

L = hash_create(size,var1,...,varn,name1=val1,...)  
L = hash(size,var1,...,varn,name1=val1,...)

Parameters

Description
The hash data type is useful to maintain a collection of objects which can be accessed using their names as access key. A hash table could be created with the hash_create function (you can use either the shortly name +hash+). Internally nsp hash tables are implemented as hash tables with open adressing. They are dynamically resized according to the number of stored objects.

Operations on hashs

attributes

methods

extraction, insertion, deletion

Some functions

Examples

A = rand(4,4); 
H = hash_create(5,A,B=34,C="foo")  
// or shortly H = hash(5,A,B=34,C="foo") 
H.delete['A',['B','C']]; 
H.enter[A,Z='foo',C=3.56]; 
[a,b,c]=H.find['A',['B','C']] 
[a,b,c]=H.iskey['A',['B','C']] 
H.merge[hash_create(P=89,Q=67)]; 
H.A = 56  
str = 'A' 
H(str) = 45; 
function y=f(a=1,b=2,c=3);y=[a,b,c];endfunction  
H = hash_create(a=67,b=45); 
f(H(:)); 

Authors jpc