编辑:找到编辑按钮,基本代码在https://github.com/unidef/quantum 。如果你克隆并修复它,或者 fork 它,那就太棒了
这是一个快速粘贴
jons-MacBook-Pro:quantum jon$ cat */*
todo: makefile, srsly
cat: bin/tests: Is a directory
#pragma once
#include "quantum.h"
// tests
TEST temp;
// id system
double long id;
#pragma once
#include "quantum.h"
extern FILE *filename;
extern FILE *extraFileName;
#pragma once
#include "sys.h"
#pragma once
// system macros
#define NEURAL_ARRAY 100
#define NEURAL_DIMENSION 20
#define NEURAL_DIRECTION "up"
#define NEURAL_MALLOC malloc(sizeof(NEURON))
#define NEURAL_MALLOC_BIG malloc(sizeof( NEURON * 20 )
// system libraries
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <math.h>
// built in libraries
#include "types.h"
#include "doc.h"
#include "io.h"
// extra variables
#pragma once
#include "types.h"
typedef struct neural_node NODE;
typedef struct neural OPERATIONS;
typedef struct neural SQL;
typedef struct neural TEST;
typedef struct neural DOC;
typedef struct neural ERROR;
typedef struct neural NEURON;
typedef double long ID;
#pragma once
#include "sys.h"
#include "typedefs.h"
// data structures
struct neural {
ID id;
char *description;
NODE *dimension[NEURAL_ARRAY][NEURAL_ARRAY][NEURAL_ARRAY];
} *N;
struct neural_node {
ID id;
DOC description;
ERROR (*exception)(NODE,DOC); // add SYS
NODE *up;
NODE *down;
NODE *left;
NODE *right;
} *NN;
#include "quantum.h"
// data operations
OPERATIONS arrange();
OPERATIONS delete();
OPERATIONS move();
OPERATIONS rearrange();
OPERATIONS query();
// internal sql database
SQL database();
// used for documentation purposes
DOC license();
DOC help();
void printq(char *msg, DOC *description){
printf(msg, "%s");
}
#include "sys.h"
OPERATIONS arrange();
OPERATIONS delete();
OPERATIONS move();
OPERATIONS rearrange();
OPERATIONS query();
SQL database();
DOC license();
DOC help();
// types
// doc
// system variables
#define NEURAL_ARRAY 1000000
#define NEURAL_DIMENSION 20
#define NEURAL_DIRECTION "up"
// general variables
typedef struct _neural_node NODE;
typedef struct _neural OPERATIONS;
typedef struct _neural SQL;
typedef struct _neural TEST;
typedef struct _neural DOC;
typedef double long ID;
struct _neural {
ID id;
DOC description;
NODE *dimension[NEURAL_ARRAY];
};
struct _neural_node {
ID id;
DOC description;
NODE *up;
NODE *down;
NODE *left;
NODE *right;
NODE dimension[NEURAL_DIMENSION];
};
init:
cc quantum.c -o quantum
tests:
trash:
mv *~ trash
mv lib/*~ trash
mv bin/*~ trash
General Purpose Quantum Paralellization Library
by Unidef
Licensed by the BSD License
#include "lib/quantum.h"
// additional code
int main(){
DOC INIT;
return 0;
};
#include "sys.h"
OPERATIONS arrange();
OPERATIONS delete();
OPERATIONS move();
OPERATIONS rearrange();
OPERATIONS query();
SQL database();
DOC license();
DOC help();
#pragma once
// system libraries
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <math.h>
// built in libraries
#include "types.h"
#include "doc.h"
#include "io.h"
// system variables
#define NEURAL_ARRAY 100
#define NEURAL_DIMENSION 20
#define NEURAL_DIRECTION "up"
#pragma once
#include "types.h"
typedef struct _neural_node NODE;
typedef struct _neural OPERATIONS;
typedef struct _neural SQL;
typedef struct _neural TEST;
typedef struct _neural DOC;
typedef struct _neural ERROR;
typedef struct _neural NEURON;
typedef double long ID;
#pragma once
#include "sys.h"
#include "types.h"
#include "typedefs.h"
// data structures
struct neural {
ID id;
char *description;
NODE *dimension[NEURAL_ARRAY][NEURAL_ARRAY][NEURAL_ARRAY];
};
struct neural_node {
ID id;
DOC description;
ERROR (*exception)(NODE);
NODE *up;
NODE *down;
NODE *left;
NODE *right;
};
jons-MacBook-Pro:quantum jon$
------
抱歉,代码重复,我有很多缓存文件
基本上,我有一个小型数据库项目,我想将其称为神经/人工智能技术,该技术使用二叉树到高维,我只是对整个节点、指针、要使用多少个指针等感到困惑
在我看来,这是一棵二叉树。
#define X 100
struct NODE
{
int id;
NODE *movement[X];
};
struct SQL
{
char *description;
NODE *next;
NODE *prev;
NODE *up;
NODE *down;
};
// usage
main()
{
SQL *DOC[X];
DOC[0] = (SQL*)(malloc(sizeof(SQL));
DOC[0]->next->id = 0;
DOC[0]->next->next->id=1;
}
// etc, didn't check it on a compiler
问题是它的段错误
最佳答案
是否要求使用C语言或二叉树?当我尝试使用神经网络进行操作时,我的多维数组方法是使用展平数组并用类似的方法计算索引
double & Tensor::operator[](std::initializer_list<int> list)
{
// TODO: insert return statement here
vector<int> tuple(list.begin(), list.end());
int dim = tuple[0];
int lastDimensions = dimensions[0];
for (int i = 1; i < tuple.size(); i++) {
if (i > dimensions.size() - 1)
{
break;
}
if (tuple[i] > dimensions[i]) throw exception("Dimension do not match");
dim += tuple[i] * lastDimensions;
lastDimensions *= dimensions[i];
}
return elements[dim];
}
(全类可在 Tensor 找到)
但也许我没有正确理解这个问题......
关于c - 我需要有人为我解释二叉树,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54695147/