Skip to content

Commit a6f2f8f

Browse files
Add files via upload
1 parent 5bf4b54 commit a6f2f8f

7 files changed

+25
-14
lines changed

C/deeptemporalmemory.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ deeptemporalmemory.c
33
Deep Temporal Memory Implementation Template and Command Line Tool Wrapper
44
https://github.com/PeterOvermann/Writings/blob/main/TriadicMemory.pdf
55
6-
Copyright (c) 2022 Peter Overmann
6+
Copyright (c) 2022-2024 Peter Overmann
77
88
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
99
and associated documentation files (the “Software”), to deal in the Software without restriction,

C/dyadicmemoryCL.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dyadicmemoryCL.c
44
Dyadic Memory Command Line wrapper
55
66
7-
Copyright (c) 2022 Peter Overmann
7+
Copyright (c) 2022-2024 Peter Overmann
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
1010
and associated documentation files (the “Software”), to deal in the Software without restriction,
@@ -36,7 +36,7 @@ static int VERSIONMAJOR = 2;
3636
static int VERSIONMINOR = 0;
3737

3838

39-
static void print_help()
39+
static void print_help(void)
4040
{
4141
printf("dyadicmemory %d.%d\n\n", VERSIONMAJOR, VERSIONMINOR);
4242
printf("Sparse distributed memory (SDM) for storing associations x->y of sparse binary hypervectors x and y.\n");

C/temporalmemory.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
temporalmemory.c
33
Elementary Temporal Memory and Command Line Tool Wrapper
44
5-
Copyright (c) 2022 Peter Overmann
5+
Copyright (c) 2022-2024 Peter Overmann
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
88
and associated documentation files (the “Software”), to deal in the Software without restriction,

C/triadicmemory.c

+15-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ C-language implementation of Triadic Memory and related algorithms published in
99
This version is based on 1-bit storage locations, as opposed to the reference implementation
1010
which is based on 8-bit memory counters.
1111
12-
Copyright (c) 2022 Peter Overmann
12+
Copyright (c) 2022-2024 Peter Overmann
1313
1414
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
1515
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)
7777

7878

7979

80-
static void srand_init()
80+
static void srand_init(void)
8181
{
8282
static int initialized = 0;
8383
if (! initialized)
@@ -367,9 +367,8 @@ void dyadicmemory_write (DyadicMemory *D, SDR *x, SDR *y)
367367
}
368368
}
369369

370-
371370

372-
SDR* dyadicmemory_read (DyadicMemory *D, SDR *x, SDR *y)
371+
static SDR* dm_query (DyadicMemory *D, SDR *x, SDR *y, int p)
373372
{
374373
int* response = (int*)calloc(D->ny, sizeof(int));
375374

@@ -382,10 +381,21 @@ SDR* dyadicmemory_read (DyadicMemory *D, SDR *x, SDR *y)
382381

383382
}
384383

385-
return binarize(y, response, D->p);
384+
return binarize(y, response, p);
386385
}
387386

388387

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+
389399

390400
// ---------- Triadic Memory -- stores triple associations (x,y,z} ----------
391401

C/triadicmemory.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ triadicmemory.h
44
C-language reference implementation of Triadic Memory and related algorithms published in
55
https://github.com/PeterOvermann/Writings/blob/main/TriadicMemory.pdf
66
7-
Copyright (c) 2022 Peter Overmann
7+
Copyright (c) 2022-2024 Peter Overmann
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
1010
and associated documentation files (the “Software”), to deal in the Software without restriction,
@@ -71,7 +71,7 @@ typedef struct
7171
{
7272
byte **C; // pointers to base triangle of half storage "cube"
7373

74-
int nx, ny, // vector dimensions x
74+
int nx, ny, // vector dimensions of x and y
7575
p; // target sparse population of y
7676

7777
} DyadicMemory;
@@ -81,6 +81,7 @@ DyadicMemory *dyadicmemory_new (int nx, int ny, int p);
8181

8282
void dyadicmemory_write (DyadicMemory *, SDR *, SDR *);
8383
SDR* dyadicmemory_read (DyadicMemory *, SDR *, SDR *);
84+
SDR* dyadicmemory_read_p (DyadicMemory *, SDR *, SDR *, int);
8485

8586

8687

C/triadicmemoryCL.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ triadicmemoryCL.c
44
Triadic Memory Command Line
55
66
7-
Copyright (c) 2022 Peter Overmann
7+
Copyright (c) 2022-2024 Peter Overmann
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
1010
and associated documentation files (the “Software”), to deal in the Software without restriction,
@@ -37,7 +37,7 @@ static int VERSIONMAJOR = 2;
3737
static int VERSIONMINOR = 0;
3838

3939

40-
static void print_help()
40+
static void print_help(void)
4141
{
4242
printf("triadicmemory %d.%d\n\n", VERSIONMAJOR, VERSIONMINOR);
4343
printf("Sparse distributed memory for storing triple associations {x,y,z} of sparse binary hypervectors.\n");

C/triadicmemorytest.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ triadicmemorytest.c
44
Triadic Memory setup for capacity and performance tests
55
66
7-
Copyright (c) 2022 Peter Overmann
7+
Copyright (c) 2022-24 Peter Overmann
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
1010
and associated documentation files (the “Software”), to deal in the Software without restriction,

0 commit comments

Comments
 (0)