1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5905],{5680:(n,e,t)=>{t.d(e,{xA:()=>l,yg:()=>f});var x=t(6540);function r(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function i(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(n);e&&(x=x.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),t.push.apply(t,x)}return t}function a(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?i(Object(t),!0).forEach(function(e){r(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function o(n,e){if(null==n)return{};var t,x,r=function(n,e){if(null==n)return{};var t,x,r={},i=Object.keys(n);for(x=0;x<i.length;x++)t=i[x],e.indexOf(t)>=0||(r[t]=n[t]);return r}(n,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(x=0;x<i.length;x++)t=i[x],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}var c=x.createContext({}),p=function(n){var e=x.useContext(c),t=e;return n&&(t="function"==typeof n?n(e):a(a({},e),n)),t},l=function(n){var e=p(n.components);return x.createElement(c.Provider,{value:e},n.children)},s="mdxType",d={inlineCode:"code",wrapper:function(n){var e=n.children;return x.createElement(x.Fragment,{},e)}},u=x.forwardRef(function(n,e){var t=n.components,r=n.mdxType,i=n.originalType,c=n.parentName,l=o(n,["components","mdxType","originalType","parentName"]),s=p(t),u=r,f=s["".concat(c,".").concat(u)]||s[u]||d[u]||i;return t?x.createElement(f,a(a({ref:e},l),{},{components:t})):x.createElement(f,a({ref:e},l))});function f(n,e){var t=arguments,r=e&&e.mdxType;if("string"==typeof n||r){var i=t.length,a=new Array(i);a[0]=u;var o={};for(var c in e)hasOwnProperty.call(e,c)&&(o[c]=e[c]);o.originalType=n,o[s]="string"==typeof n?n:r,a[1]=o;for(var p=2;p<i;p++)a[p]=t[p];return x.createElement.apply(null,a)}return x.createElement.apply(null,t)}u.displayName="MDXCreateElement"},8374:(n,e,t)=>{t.r(e),t.d(e,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var x=t(8168),r=(t(6540),t(5680));const i={},a=void 0,o={unversionedId:"taichi/snode",id:"taichi/snode",title:"snode",description:"x[0,0]=0.000000",source:"@site/docs/taichi/snode.md",sourceDirName:"taichi",slug:"/taichi/snode",permalink:"/old-blog/taichi/snode",draft:!1,editUrl:"https://github.com/chunleili/old-blog/tree/master/docs/taichi/snode.md",tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"\u5728taichi\u4e2d\u4f7f\u7528shape\u4f5c\u4e3a\u5faa\u73af\u5927\u5c0f",permalink:"/old-blog/taichi/shape"},next:{title:"\u4e3ataichi\u7a0b\u5e8f\u6682\u505c\u548creset\u4ee5\u4fbf\u4e8e\u8c03\u8bd5",permalink:"/old-blog/taichi/taichi-debug"}},c={},p=[],l={toc:p},s="wrapper";function d({components:n,...e}){return(0,r.yg)(s,(0,x.A)({},l,e,{components:n,mdxType:"MDXLayout"}),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-python"},"import taichi as ti\nti.init()\nx = ti.field(ti.f32)\nsnode = ti.root.dense(ti.ij,(10,10))\nsnode.place(x)\n# same as \n# x = ti.field(ti.f32, (10,10))\n\nprint(x.shape)\n\n\nx[1,3] = 1\nx[1,5] = 2.1\nx[2,3] = 3.5\nx[3,3] = 2\n\[email protected]\ndef test():\n for i,j in x:\n print('x[{},{}]={}'.format(i,j,x[i,j]))\n \ntest()\n")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},"x[0,0]=0.000000\nx[0,1]=0.000000\nx[0,2]=0.000000\nx[0,3]=0.000000\nx[0,4]=0.000000\nx[0,5]=0.000000\nx[0,6]=0.000000\nx[0,7]=0.000000\nx[0,8]=0.000000\nx[0,9]=0.000000\nx[1,0]=0.000000\nx[1,1]=0.000000\nx[1,2]=0.000000\nx[1,3]=1.000000\nx[1,4]=0.000000\nx[1,5]=2.100000\nx[1,6]=0.000000\nx[1,7]=0.000000\nx[1,8]=0.000000\nx[1,9]=0.000000\nx[2,0]=0.000000\nx[2,1]=0.000000\nx[2,2]=0.000000\nx[2,3]=3.500000\nx[2,4]=0.000000\nx[2,5]=0.000000\nx[2,6]=0.000000\nx[2,7]=0.000000\nx[2,8]=0.000000\nx[2,9]=0.000000\nx[3,0]=0.000000\nx[3,1]=0.000000\nx[3,2]=0.000000\nx[3,3]=2.000000\nx[3,4]=0.000000\nx[3,5]=0.000000\nx[3,6]=0.000000\nx[3,7]=0.000000\nx[3,8]=0.000000\nx[3,9]=0.000000\nx[4,0]=0.000000\nx[4,1]=0.000000\nx[4,2]=0.000000\nx[4,3]=0.000000\nx[4,4]=0.000000\nx[4,5]=0.000000\nx[4,6]=0.000000\nx[4,7]=0.000000\nx[4,8]=0.000000\nx[4,9]=0.000000\nx[5,0]=0.000000\nx[5,1]=0.000000\nx[5,2]=0.000000\nx[5,3]=0.000000\nx[5,4]=0.000000\nx[5,5]=0.000000\nx[5,6]=0.000000\nx[5,7]=0.000000\nx[5,8]=0.000000\nx[5,9]=0.000000\nx[6,0]=0.000000\nx[6,1]=0.000000\nx[6,2]=0[Taichi] Starting on arch=arm64\n.000000\nx[6,3]=0.000000\nx[6,4]=0.000000\nx[6,5]=0.000000\nx[6,6]=0.000000\nx[6,7]=0.000000\nx[6,8]=0.000000\nx[6,9]=0.000000\nx[7,0]=0.000000\nx[7,1]=0.000000\nx[7,2]=0.000000\nx[7,3]=0.000000\nx[7,4]=0.000000\nx[7,5]=0.000000\nx[7,6]=0.000000\nx[7,7]=0.000000\nx[7,8]=0.000000\nx[7,9]=0.000000\nx[8,0]=0.000000\nx[8,1]=0.000000\nx[8,2]=0.000000\nx[8,3]=0.000000\nx[8,4]=0.000000\nx[8,5]=0.000000\nx[8,6]=0.000000\nx[8,7]=0.000000\nx[8,8]=0.000000\nx[8,9]=0.000000\nx[9,0]=0.000000\nx[9,1]=0.000000\nx[9,2]=0.000000\nx[9,3]=0.000000\nx[9,4]=0.000000\nx[9,5]=0.000000\nx[9,6]=0.000000\nx[9,7]=0.000000\nx[9,8]=0.000000\nx[9,9]=0.000000\n(10, 10)\n")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-python"},"import taichi as ti\nti.init()\nx = ti.Vector.field(3,ti.f32)\nsnode = ti.root.dense(ti.ij,(10,10))\nsnode.place(x)\n# same as \n# x = ti.field(ti.f32, (10,10))\n\nprint(x.shape)\n\n\nx[1,3] = ti.Vector([1,2,3])\nx[1,5] = ti.Vector([1,2,3])\nx[2,3] = ti.Vector([1,2,3])\nx[3,3] = ti.Vector([1,2,3])\n\[email protected]\ndef test():\n for i,j in x:\n print('x[{},{}]'.format(i,j),end='\\t')\n print(x[i,j])\n \ntest()\n")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},"x[0,0] [0.000000, 0.000000, 0.000000]\nx[0,1] [0.000000, 0.000000, 0.000000]\nx[0,2] [0.000000, 0.000000, 0.000000]\nx[0,3] [0.000000, 0.000000, 0.000000]\nx[0,4] [0.000000, 0.000000, 0.000000]\nx[0,5] [0.000000, 0.000000, 0.000000]\nx[0,6] [0.000000, 0.000000, 0.000000]\nx[0,7] [0.000000, 0.000000, 0.000000]\nx[0,8] [0.000000, 0.000000, 0.000000]\nx[0,9] [0.000000, 0.000000, 0.000000]\nx[1,0] [0.000000, 0.000000, 0.000000]\nx[1,1] [0.000000, 0.000000, 0.000000]\nx[1,2] [0.000000, 0.000000, 0.000000]\nx[1,3] [1.000000, 2.000000, 3.000000]\nx[1,4] [0.000000, 0.000000, 0.000000]\nx[1,5] [1.000000, 2.000000, 3.000000]\nx[1,6] [0.000000, 0.000000, 0.000000]\nx[1,7] [0.000000, 0.000000, 0.000000]\nx[1,8] [0.000000, 0.000000, 0.000000]\nx[1,9] [0.000000, 0.000000, 0.000000]\nx[2,0] [0.000000, 0.000000, 0.000000]\nx[2,1] [0.000000, 0.000000, 0.000000]\nx[2,2] [0.000000, 0.000000, 0.000000]\nx[2,3] [1.000000, 2.000000, 3.000000]\nx[2,4] [0.000000, 0.000000, 0.000000]\nx[2,5] [0.000000, 0.000000, 0.000000]\nx[2,6] [0.00[Taichi] Starting on arch=arm64\n0000, 0.000000, 0.000000]\nx[2,7] [0.000000, 0.000000, 0.000000]\nx[2,8] [0.000000, 0.000000, 0.000000]\nx[2,9] [0.000000, 0.000000, 0.000000]\nx[3,0] [0.000000, 0.000000, 0.000000]\nx[3,1] [0.000000, 0.000000, 0.000000]\nx[3,2] [0.000000, 0.000000, 0.000000]\nx[3,3] [1.000000, 2.000000, 3.000000]\nx[3,4] [0.000000, 0.000000, 0.000000]\nx[3,5] [0.000000, 0.000000, 0.000000]\nx[3,6] [0.000000, 0.000000, 0.000000]\nx[3,7] [0.000000, 0.000000, 0.000000]\nx[3,8] [0.000000, 0.000000, 0.000000]\nx[3,9] [0.000000, 0.000000, 0.000000]\nx[4,0] [0.000000, 0.000000, 0.000000]\nx[4,1] [0.000000, 0.000000, 0.000000]\nx[4,2] [0.000000, 0.000000, 0.000000]\nx[4,3] [0.000000, 0.000000, 0.000000]\nx[4,4] [0.000000, 0.000000, 0.000000]\nx[4,5] [0.000000, 0.000000, 0.000000]\nx[4,6] [0.000000, 0.000000, 0.000000]\nx[4,7] [0.000000, 0.000000, 0.000000]\nx[4,8] [0.000000, 0.000000, 0.000000]\nx[4,9] [0.000000, 0.000000, 0.000000]\nx[5,0] [0.000000, 0.000000, 0.000000]\nx[5,1] [0.000000, 0.000000, 0.000000]\nx[5,2] [0.000000, 0.000000, 0.000000]\nx[5,3] [0.000000, 0.000000, 0.000000]\nx[5,4] [0.000000, 0.000000, 0.000000]\nx[5,5] [0.000000, 0.000000, 0.000000]\nx[5,6] [0.000000, 0.000000, 0.000000]\nx[5,7] [0.000000, 0.000000, 0.000000]\nx[5,8] [0.000000, 0.000000, 0.000000]\nx[5,9] [0.000000, 0.000000, 0.000000]\nx[6,0] [0.000000, 0.000000, 0.000000]\nx[6,1] [0.000000, 0.000000, 0.000000]\nx[6,2] [0.000000, 0.000000, 0.000000]\nx[6,3] [0.000000, 0.000000, 0.000000]\nx[6,4] [0.000000, 0.000000, 0.000000]\nx[6,5] [0.000000, 0.000000, 0.000000]\nx[6,6] [0.000000, 0.000000, 0.000000]\nx[6,7] [0.000000, 0.000000, 0.000000]\nx[6,8] [0.000000, 0.000000, 0.000000]\nx[6,9] [0.000000, 0.000000, 0.000000]\nx[7,0] [0.000000, 0.000000, 0.000000]\nx[7,1] [0.000000, 0.000000, 0.000000]\nx[7,2] [0.000000, 0.000000, 0.000000]\nx[7,3] [0.000000, 0.000000, 0.000000]\nx[7,4] [0.000000, 0.000000, 0.000000]\nx[7,5] [0.000000, 0.000000, 0.000000]\nx[7,6] [0.000000, 0.000000, 0.000000]\nx[7,7] [0.000000, 0.000000, 0.000000]\nx[7,8] [0.000000, 0.000000, 0.000000]\nx[7,9] [0.000000, 0.000000, 0.000000]\nx[8,0] [0.000000, 0.000000, 0.000000]\nx[8,1] [0.000000, 0.000000, 0.000000]\nx[8,2] [0.000000, 0.000000, 0.000000]\nx[8,3] [0.000000, 0.000000, 0.000000]\nx[8,4] [0.000000, 0.000000, 0.000000]\nx[8,5] [0.000000, 0.000000, 0.000000]\nx[8,6] [0.000000, 0.000000, 0.000000]\nx[8,7] [0.000000, 0.000000, 0.000000]\nx[8,8] [0.000000, 0.000000, 0.000000]\nx[8,9] [0.000000, 0.000000, 0.000000]\nx[9,0] [0.000000, 0.000000, 0.000000]\nx[9,1] [0.000000, 0.000000, 0.000000]\nx[9,2] [0.000000, 0.000000, 0.000000]\nx[9,3] [0.000000, 0.000000, 0.000000]\nx[9,4] [0.000000, 0.000000, 0.000000]\nx[9,5] [0.000000, 0.000000, 0.000000]\nx[9,6] [0.000000, 0.000000, 0.000000]\nx[9,7] [0.000000, 0.000000, 0.000000]\nx[9,8] [0.000000, 0.000000, 0.000000]\nx[9,9] [0.000000, 0.000000, 0.000000]\n(10, 10)\n")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-python"},"import taichi as ti\nti.init()\nx = ti.field(ti.f32)\nsnode = ti.root.pointer(ti.ij,(10,10))\nsnode.place(x)\n# print(x.shape)\n\nx[1,3] = 1.3\nx[1,5] = 1.6\nx[2,3] = 1.4\nx[3,3] = 1.0\n\[email protected]\ndef test():\n for i,j in x:\n print('x[{},{}]={}'.format(i,j,x[i,j]))\n \ntest()\n")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},"x[1,3]=1.300000\nx[1,5]=1.600000\nx[2,3]=1.400000\nx[3,3]=1.000000\n[Taichi] Starting on arch=arm64\n")))}d.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.