@@ -9,7 +9,7 @@ C-language implementation of Triadic Memory and related algorithms published in
9
9
This version is based on 1-bit storage locations, as opposed to the reference implementation
10
10
which is based on 8-bit memory counters.
11
11
12
- Copyright (c) 2022 Peter Overmann
12
+ Copyright (c) 2022-2024 Peter Overmann
13
13
14
14
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
15
15
and associated documentation files (the “Software”), to deal in the Software without restriction,
@@ -77,7 +77,7 @@ static SDR* binarize (SDR *x, int *response, int pop)
77
77
78
78
79
79
80
- static void srand_init ()
80
+ static void srand_init (void )
81
81
{
82
82
static int initialized = 0 ;
83
83
if (! initialized )
@@ -367,9 +367,8 @@ void dyadicmemory_write (DyadicMemory *D, SDR *x, SDR *y)
367
367
}
368
368
}
369
369
370
-
371
370
372
- SDR * dyadicmemory_read (DyadicMemory * D , SDR * x , SDR * y )
371
+ static SDR * dm_query (DyadicMemory * D , SDR * x , SDR * y , int p )
373
372
{
374
373
int * response = (int * )calloc (D -> ny , sizeof (int ));
375
374
@@ -382,10 +381,21 @@ SDR* dyadicmemory_read (DyadicMemory *D, SDR *x, SDR *y)
382
381
383
382
}
384
383
385
- return binarize (y , response , D -> p );
384
+ return binarize (y , response , p );
386
385
}
387
386
388
387
388
+ SDR * dyadicmemory_read (DyadicMemory * D , SDR * x , SDR * y )
389
+ {
390
+ return dm_query (D , x , y , D -> p );
391
+ }
392
+
393
+ SDR * dyadicmemory_read_p (DyadicMemory * D , SDR * x , SDR * y , int p )
394
+ {
395
+ return dm_query (D , x , y , p );
396
+ }
397
+
398
+
389
399
390
400
// ---------- Triadic Memory -- stores triple associations (x,y,z} ----------
391
401
0 commit comments