initial notebooks

This commit is contained in:
Ivan I. Ovchinnikov 2023-02-08 10:36:56 +03:00
parent e80db1d21a
commit babb4d7156
4 changed files with 2070 additions and 0 deletions

1511
03-fpga-04-sigdel.pgf Normal file

File diff suppressed because it is too large Load Diff

195
Untitled-1.ipynb Normal file

File diff suppressed because one or more lines are too long

363
java.ipynb Normal file
View File

@ -0,0 +1,363 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"import java.util.*"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"byte[] temp = {1,2,3,4,5,6,7,8};\n",
"byte[] status = {0,0,0,0,0,0,0,0};\n",
"byte[] result = new byte[4];\n",
"\n",
"int i, s, mini, maxi;"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 0, 0, 0, 0, 0, 0, 0]\n",
"[1, 1, 0, 0, 0, 0, 0, 1]\n",
"[1, 1, 1, 0, 0, 0, 0, 1]\n",
"[1, 1, 1, 1, 0, 0, 0, 1]\n",
"[1, 1, 1, 1, 1, 0, 0, 1]\n",
"[1, 1, 1, 1, 1, 1, 0, 1]\n"
]
}
],
"source": [
"for (s = 0; s < 6; s = s + 1) {\n",
" if (s == 0) \n",
" status = new byte[]{0,0,0,0,0,0,0,0};\n",
"\n",
" mini = 0;\n",
" maxi = 0;\n",
" for (i = 0; i < 8; i = i + 1) {\n",
" if ((temp[i] <= temp[mini] || status[mini] == 1) && status[i] != 1) mini = i;\n",
" if ((temp[i] >= temp[maxi] || status[maxi] == 1) && status[i] != 1) maxi = i;\n",
" }\n",
" status[mini] = 1;\n",
" System.out.println(Arrays.toString(status));\n",
" if (s == 0){\n",
" result[3] = temp[maxi];\n",
" result[0] = temp[mini];\n",
" status[maxi] = 1;\n",
" }\n",
" \n",
" if (s == 3)\n",
" result[1] = temp[mini];\n",
"\n",
" if (s == 4)\n",
" result[2] = temp[mini];\n",
"\n",
" if (s == 5)\n",
" status = new byte[]{0,0,0,0,0,0,0,0};\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 4, 5, 8]\n"
]
}
],
"source": [
"System.out.println(Arrays.toString(result));"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"int[] moreless(int in1, int in2) {\n",
" int[] out = new int[2];\n",
" if (in1 >= in2) {\n",
" out[0] = in1;\n",
" out[1] = in2;\n",
" } else {\n",
" out[0] = in2;\n",
" out[1] = in1;\n",
" }\n",
" return out;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"int[] layer4(int[] in8) {\n",
" int[] out = new int[8];\n",
" int[] tmp;\n",
" for (int i = 0; i < 4; ++i) {\n",
" tmp = moreless(in8[i * 2], in8[i * 2 + 1]);\n",
" out[i * 2] = tmp[0];\n",
" out[i * 2 + 1] = tmp[1]; \n",
" }\n",
" return out;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"int[] layer3(int[] in8) {\n",
" int[] out = new int[8];\n",
" int[] tmp;\n",
" out[0] = in8[0];\n",
" out[7] = in8[7];\n",
" for (int i = 0; i < 3; ++i) {\n",
" tmp = moreless(in8[i * 2 + 1], in8[i * 2 + 2]);\n",
" out[i * 2 + 1] = tmp[0];\n",
" out[i * 2 + 2] = tmp[1]; \n",
" }\n",
" return out;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0, 1, 2, 3, 4, 5, 6, 7]\n",
"[1, 0, 3, 2, 5, 4, 7, 6]\n",
"[1, 3, 0, 5, 2, 7, 4, 6]\n",
"[3, 1, 5, 0, 7, 2, 6, 4]\n",
"[3, 5, 1, 7, 0, 6, 2, 4]\n",
"[5, 3, 7, 1, 6, 0, 4, 2]\n",
"[5, 7, 3, 6, 1, 4, 0, 2]\n",
"[7, 5, 6, 3, 4, 1, 2, 0]\n",
"[7, 6, 5, 4, 3, 2, 1, 0]\n",
"275.0\n"
]
}
],
"source": [
"// int[] arr = {32, 255, 130, 54, 76, 98, 0, 11};\n",
"long time = System.currentTimeMillis();\n",
"int[] arr = {0, 1, 2, 3, 4, 5, 6, 7};\n",
"int[] step;\n",
"System.out.println(Arrays.toString(arr));\n",
"step = layer4(arr);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer3(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer4(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer3(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer4(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer3(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer4(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer3(step);\n",
"System.out.println(Arrays.toString(step));\n",
"double delta = (System.currentTimeMillis() - time);\n",
"System.out.println(delta);\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"int[] layer01(int[] src) {\n",
" int[] out = new int[8];\n",
" out[0] = moreless(src[0], src[1])[0];\n",
" out[1] = moreless(src[0], src[1])[1];\n",
" out[2] = src[2];\n",
" out[3] = moreless(src[3], src[4])[0];\n",
" out[4] = moreless(src[3], src[4])[1];\n",
" out[5] = src[5];\n",
" out[6] = moreless(src[6], src[7])[0];\n",
" out[7] = moreless(src[6], src[7])[1];\n",
" return out;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"int[] layer02(int[] src) {\n",
" int[] out = new int[8];\n",
" out[0] = src[0];\n",
" out[1] = moreless(src[1], src[2])[0];\n",
" out[2] = moreless(src[1], src[2])[1];\n",
" out[3] = src[3];\n",
" out[4] = moreless(src[4], src[5])[0];\n",
" out[5] = moreless(src[4], src[5])[1];\n",
" out[6] = src[6];\n",
" out[7] = src[7];\n",
" return out;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"int[] layer04(int[] src) {\n",
" int[] out = new int[8];\n",
" out[0] = moreless(src[0], src[3])[0];\n",
" out[1] = moreless(src[0], src[3])[1];\n",
" out[2] = src[6];\n",
" out[3] = moreless(src[1], src[4])[0];\n",
" out[4] = moreless(src[1], src[4])[1];\n",
" out[5] = src[7];\n",
" out[6] = src[2];\n",
" out[7] = src[5];\n",
" return out;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"int[] layer05(int[] src) {\n",
" int[] out = new int[8];\n",
" out[0] = moreless(src[0], src[3])[0];\n",
" out[1] = moreless(src[0], src[3])[1];\n",
" out[2] = src[6];\n",
" out[3] = moreless(src[1], src[4])[0];\n",
" out[4] = moreless(src[1], src[4])[1];\n",
" out[5] = src[7];\n",
" out[6] = src[2];\n",
" out[7] = src[5];\n",
" return out;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "java"
}
},
"outputs": [],
"source": [
"System.out.println(Arrays.toString(arr));\n",
"step = layer01(arr);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer02(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer01(step);\n",
"System.out.println(Arrays.toString(step));\n",
"step = layer04(step);\n",
"System.out.println(Arrays.toString(step));\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Java",
"language": "java",
"name": "java"
},
"language_info": {
"codemirror_mode": "java",
"file_extension": ".jshell",
"mimetype": "text/x-java-source",
"name": "Java",
"pygments_lexer": "java",
"version": "11.0.18+10-LTS"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

1
try.restbook Normal file
View File

@ -0,0 +1 @@
[{"kind":2,"language":"rest-book","value":"POST http://10.201.92.55:8098/cmec/rest/v2/oauth/token\nContent-Type: application/x-www-form-urlencoded\nAuthorization: Basic Y2xpZW50OnNlY3JldA==\n\n{\n grant_type=password&username=admin&password=admin\n}","outputs":[{"mime":"application/vnd.code.notebook.error","value":{"name":"Error","message":"Corrupt response received! Missing one or more of response status, status text, and/or data!"}}]}]