B = Tensor('^ij', function(i,j) return var'b'('^'..coords[i+1].name..' '..coords[j+1].name) end)
GOOD time: 1.647000ms
stack: size: 0

    printbr(Array(B:dim()))
    $\left[\begin{array}{cc} 3& 3\end{array}\right]$
    GOOD
    time: 0.317000ms
    stack: size: 0


      printbr(B'^ix'())
      $\overset{i\downarrow}{\left[\begin{matrix} {{ b} ^x} ^x \\ {{ b} ^y} ^x \\ {{ b} ^z} ^x\end{matrix}\right]}$
      GOOD
      time: 7.112000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      printbr(Array(B'^ix'():dim()))
      $\left[\begin{array}{c} 3\end{array}\right]$
      GOOD
      time: 4.502000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      rank-1 subtensor assignment

      A is from the txyz chart, so it will have 4 elements accordingly

      A = Tensor('^a', function(a) return var'a'('^'..coords[a].name) end)
      GOOD time: 0.523000ms
      stack: size: 0

        printbr('A = '..A)
        A = $\overset{a\downarrow}{\left[\begin{matrix} { a} ^t \\ { a} ^x \\ { a} ^y \\ { a} ^z\end{matrix}\right]}$
        GOOD
        time: 0.291000ms
        stack: size: 0

          assert(A[1] == var'a''^t')
          GOOD time: 0.190000ms
          stack: size: 0

            assert(A[2] == var'a''^x')
            GOOD time: 0.287000ms
            stack: size: 0

              assert(A[3] == var'a''^y')
              GOOD time: 0.078000ms
              stack: size: 0

                assert(A[4] == var'a''^z')
                GOOD time: 0.048000ms
                stack: size: 0

                  B is from the xyz chart, so it will have 3 elements accordingly

                  B = Tensor('^i', function(i) return var'b'('^'..coords[i+1].name) end)
                  GOOD time: 0.350000ms
                  stack: size: 0

                    printbr('B = '..B)
                    B = $\overset{i\downarrow}{\left[\begin{matrix} { b} ^x \\ { b} ^y \\ { b} ^z\end{matrix}\right]}$
                    GOOD
                    time: 0.893000ms
                    stack: size: 0

                      assert(B[1] == var'b''^x')
                      GOOD time: 0.082000ms
                      stack: size: 0

                        assert(B[2] == var'b''^y')
                        GOOD time: 0.058000ms
                        stack: size: 0

                          assert(B[3] == var'b''^z')
                          GOOD time: 0.259000ms
                          stack: size: 0



                            A2 = A:clone()
                            GOOD time: 0.150000ms
                            stack: size: 0

                              A2['^i'] = B'^i'()
                              GOOD time: 5.331000ms
                              stack: size: 7
                              • Init
                              • Prune
                              • Expand
                              • Prune
                              • Factor
                              • Prune
                              • Tidy

                              printbr('A2 = '..A2)
                              A2 = $\overset{a\downarrow}{\left[\begin{matrix} { a} ^t \\ { b} ^x \\ { b} ^y \\ { b} ^z\end{matrix}\right]}$
                              GOOD
                              time: 0.548000ms
                              stack: size: 0

                                assertEq(A2[1], A[1])
                                ${{ a} ^t} = {{ a} ^t}$
                                GOOD
                                time: 0.136000ms
                                stack: size: 0
                                  B uses the xyz chart so B.x is B[1]
                                  assertEq(A2[2], B[1])
                                  ${{ b} ^x} = {{ b} ^x}$
                                  GOOD
                                  time: 0.304000ms
                                  stack: size: 0

                                    assertEq(A2[3], B[2])
                                    ${{ b} ^y} = {{ b} ^y}$
                                    GOOD
                                    time: 0.292000ms
                                    stack: size: 0

                                      assertEq(A2[4], B[3])
                                      ${{ b} ^z} = {{ b} ^z}$
                                      GOOD
                                      time: 0.264000ms
                                      stack: size: 0

                                        assertEq(A2, Tensor('^a', A[1], B[1], B[2], B[3]))
                                        ${\overset{a\downarrow}{\left[\begin{matrix} { a} ^t \\ { b} ^x \\ { b} ^y \\ { b} ^z\end{matrix}\right]}} = {\overset{a\downarrow}{\left[\begin{matrix} { a} ^t \\ { b} ^x \\ { b} ^y \\ { b} ^z\end{matrix}\right]}}$
                                        GOOD
                                        time: 1.170000ms
                                        stack: size: 0

                                          rank-2 subtensor assignment


                                          A = Tensor('^ab', function(a,b) return var'a'('^'..coords[a].name..' '..coords[b].name) end)
                                          GOOD time: 2.572000ms
                                          stack: size: 0

                                            printbr('A = '..A)
                                            A = $\overset{a\downarrow b\rightarrow}{\left[\begin{array}{cccc} {{ a} ^t} ^t& {{ a} ^t} ^x& {{ a} ^t} ^y& {{ a} ^t} ^z\\ {{ a} ^x} ^t& {{ a} ^x} ^x& {{ a} ^x} ^y& {{ a} ^x} ^z\\ {{ a} ^y} ^t& {{ a} ^y} ^x& {{ a} ^y} ^y& {{ a} ^y} ^z\\ {{ a} ^z} ^t& {{ a} ^z} ^x& {{ a} ^z} ^y& {{ a} ^z} ^z\end{array}\right]}$
                                            GOOD
                                            time: 2.276000ms
                                            stack: size: 0

                                              for i=1,4 do for j=1,4 do assertEq(A[i][j], var'a'('^'..coords[i].name..coords[j].name)) end end
                                              ${{{ a} ^t} ^t} = {{{ a} ^t} ^t}$
                                              ${{{ a} ^t} ^x} = {{{ a} ^t} ^x}$
                                              ${{{ a} ^t} ^y} = {{{ a} ^t} ^y}$
                                              ${{{ a} ^t} ^z} = {{{ a} ^t} ^z}$
                                              ${{{ a} ^x} ^t} = {{{ a} ^x} ^t}$
                                              ${{{ a} ^x} ^x} = {{{ a} ^x} ^x}$
                                              ${{{ a} ^x} ^y} = {{{ a} ^x} ^y}$
                                              ${{{ a} ^x} ^z} = {{{ a} ^x} ^z}$
                                              ${{{ a} ^y} ^t} = {{{ a} ^y} ^t}$
                                              ${{{ a} ^y} ^x} = {{{ a} ^y} ^x}$
                                              ${{{ a} ^y} ^y} = {{{ a} ^y} ^y}$
                                              ${{{ a} ^y} ^z} = {{{ a} ^y} ^z}$
                                              ${{{ a} ^z} ^t} = {{{ a} ^z} ^t}$
                                              ${{{ a} ^z} ^x} = {{{ a} ^z} ^x}$
                                              ${{{ a} ^z} ^y} = {{{ a} ^z} ^y}$
                                              ${{{ a} ^z} ^z} = {{{ a} ^z} ^z}$
                                              GOOD
                                              time: 5.038000ms
                                              stack: size: 0


                                                B = Tensor('^ij', function(i,j) return var'b'('^'..coords[i+1].name..' '..coords[j+1].name) end)
                                                GOOD time: 2.089000ms
                                                stack: size: 0

                                                  printbr('B = '..B)
                                                  B = $\overset{i\downarrow j\rightarrow}{\left[\begin{array}{ccc} {{ b} ^x} ^x& {{ b} ^x} ^y& {{ b} ^x} ^z\\ {{ b} ^y} ^x& {{ b} ^y} ^y& {{ b} ^y} ^z\\ {{ b} ^z} ^x& {{ b} ^z} ^y& {{ b} ^z} ^z\end{array}\right]}$
                                                  GOOD
                                                  time: 0.526000ms
                                                  stack: size: 0

                                                    for i=1,3 do for j=1,3 do assertEq(B[i][j], var'b'('^'..spatialCoords[i].name..spatialCoords[j].name)) end end
                                                    ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                    ${{{ b} ^x} ^y} = {{{ b} ^x} ^y}$
                                                    ${{{ b} ^x} ^z} = {{{ b} ^x} ^z}$
                                                    ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                    ${{{ b} ^y} ^y} = {{{ b} ^y} ^y}$
                                                    ${{{ b} ^y} ^z} = {{{ b} ^y} ^z}$
                                                    ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                    ${{{ b} ^z} ^y} = {{{ b} ^z} ^y}$
                                                    ${{{ b} ^z} ^z} = {{{ b} ^z} ^z}$
                                                    GOOD
                                                    time: 1.575000ms
                                                    stack: size: 0


                                                      A['^ij'] = B'^ij'()
                                                      GOOD time: 30.046000ms
                                                      stack: size: 7
                                                      • Init
                                                      • Prune
                                                      • Expand
                                                      • Prune
                                                      • Factor
                                                      • Prune
                                                      • Tidy

                                                      printbr('A = '..A)
                                                      A = $\overset{a\downarrow b\rightarrow}{\left[\begin{array}{cccc} {{ a} ^t} ^t& {{ a} ^t} ^x& {{ a} ^t} ^y& {{ a} ^t} ^z\\ {{ a} ^x} ^t& {{ b} ^x} ^x& {{ b} ^x} ^y& {{ b} ^x} ^z\\ {{ a} ^y} ^t& {{ b} ^y} ^x& {{ b} ^y} ^y& {{ b} ^y} ^z\\ {{ a} ^z} ^t& {{ b} ^z} ^x& {{ b} ^z} ^y& {{ b} ^z} ^z\end{array}\right]}$
                                                      GOOD
                                                      time: 1.320000ms
                                                      stack: size: 0

                                                        for j=1,4 do assertEq(A[1][j], var'a'('^t'..coords[j].name)) end
                                                        ${{{ a} ^t} ^t} = {{{ a} ^t} ^t}$
                                                        ${{{ a} ^t} ^x} = {{{ a} ^t} ^x}$
                                                        ${{{ a} ^t} ^y} = {{{ a} ^t} ^y}$
                                                        ${{{ a} ^t} ^z} = {{{ a} ^t} ^z}$
                                                        GOOD
                                                        time: 0.490000ms
                                                        stack: size: 0

                                                          for i=1,4 do assertEq(A[i][1], var'a'('^'..coords[i].name..'t')) end
                                                          ${{{ a} ^t} ^t} = {{{ a} ^t} ^t}$
                                                          ${{{ a} ^x} ^t} = {{{ a} ^x} ^t}$
                                                          ${{{ a} ^y} ^t} = {{{ a} ^y} ^t}$
                                                          ${{{ a} ^z} ^t} = {{{ a} ^z} ^t}$
                                                          GOOD
                                                          time: 0.487000ms
                                                          stack: size: 0

                                                            for i=1,3 do for j=1,3 do assertEq(A[i+1][j+1], var'b'('^'..spatialCoords[i].name..spatialCoords[j].name)) end end
                                                            ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                            ${{{ b} ^x} ^y} = {{{ b} ^x} ^y}$
                                                            ${{{ b} ^x} ^z} = {{{ b} ^x} ^z}$
                                                            ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                            ${{{ b} ^y} ^y} = {{{ b} ^y} ^y}$
                                                            ${{{ b} ^y} ^z} = {{{ b} ^y} ^z}$
                                                            ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                            ${{{ b} ^z} ^y} = {{{ b} ^z} ^y}$
                                                            ${{{ b} ^z} ^z} = {{{ b} ^z} ^z}$
                                                            GOOD
                                                            time: 1.158000ms
                                                            stack: size: 0


                                                              C = Tensor('^i', function(i) return var'c'('^'..coords[i+1].name) end)
                                                              GOOD time: 0.274000ms
                                                              stack: size: 0

                                                                printbr('C = '..C)
                                                                C = $\overset{i\downarrow}{\left[\begin{matrix} { c} ^x \\ { c} ^y \\ { c} ^z\end{matrix}\right]}$
                                                                GOOD
                                                                time: 0.485000ms
                                                                stack: size: 0


                                                                  A['^ti'] = C'^i'()
                                                                  GOOD time: 9.960000ms
                                                                  stack: size: 7
                                                                  • Init
                                                                  • Prune
                                                                  • Expand
                                                                  • Prune
                                                                  • Factor
                                                                  • Prune
                                                                  • Tidy

                                                                  printbr('A = '..A)
                                                                  A = $\overset{a\downarrow b\rightarrow}{\left[\begin{array}{cccc} {{ a} ^t} ^t& { c} ^x& { c} ^y& { c} ^z\\ {{ a} ^x} ^t& {{ b} ^x} ^x& {{ b} ^x} ^y& {{ b} ^x} ^z\\ {{ a} ^y} ^t& {{ b} ^y} ^x& {{ b} ^y} ^y& {{ b} ^y} ^z\\ {{ a} ^z} ^t& {{ b} ^z} ^x& {{ b} ^z} ^y& {{ b} ^z} ^z\end{array}\right]}$
                                                                  GOOD
                                                                  time: 1.250000ms
                                                                  stack: size: 0

                                                                    for j=1,3 do assertEq(A[1][j+1], var'c'('^'..spatialCoords[j].name)) end
                                                                    ${{ c} ^x} = {{ c} ^x}$
                                                                    ${{ c} ^y} = {{ c} ^y}$
                                                                    ${{ c} ^z} = {{ c} ^z}$
                                                                    GOOD
                                                                    time: 0.861000ms
                                                                    stack: size: 0

                                                                      for i=1,4 do assertEq(A[i][1], var'a'('^'..coords[i].name..'t')) end
                                                                      ${{{ a} ^t} ^t} = {{{ a} ^t} ^t}$
                                                                      ${{{ a} ^x} ^t} = {{{ a} ^x} ^t}$
                                                                      ${{{ a} ^y} ^t} = {{{ a} ^y} ^t}$
                                                                      ${{{ a} ^z} ^t} = {{{ a} ^z} ^t}$
                                                                      GOOD
                                                                      time: 0.441000ms
                                                                      stack: size: 0

                                                                        for i=1,3 do for j=1,3 do assertEq(A[i+1][j+1], var'b'('^'..spatialCoords[i].name..spatialCoords[j].name)) end end
                                                                        ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                                        ${{{ b} ^x} ^y} = {{{ b} ^x} ^y}$
                                                                        ${{{ b} ^x} ^z} = {{{ b} ^x} ^z}$
                                                                        ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                                        ${{{ b} ^y} ^y} = {{{ b} ^y} ^y}$
                                                                        ${{{ b} ^y} ^z} = {{{ b} ^y} ^z}$
                                                                        ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                                        ${{{ b} ^z} ^y} = {{{ b} ^z} ^y}$
                                                                        ${{{ b} ^z} ^z} = {{{ b} ^z} ^z}$
                                                                        GOOD
                                                                        time: 1.390000ms
                                                                        stack: size: 0


                                                                          A['^it'] = B'^ix'()
                                                                          GOOD time: 13.881000ms
                                                                          stack: size: 7
                                                                          • Init
                                                                          • Prune
                                                                          • Expand
                                                                          • Prune
                                                                          • Factor
                                                                          • Prune
                                                                          • Tidy

                                                                          printbr('A = '..A)
                                                                          A = $\overset{a\downarrow b\rightarrow}{\left[\begin{array}{cccc} {{ a} ^t} ^t& { c} ^x& { c} ^y& { c} ^z\\ {{ b} ^x} ^x& {{ b} ^x} ^x& {{ b} ^x} ^y& {{ b} ^x} ^z\\ {{ b} ^y} ^x& {{ b} ^y} ^x& {{ b} ^y} ^y& {{ b} ^y} ^z\\ {{ b} ^z} ^x& {{ b} ^z} ^x& {{ b} ^z} ^y& {{ b} ^z} ^z\end{array}\right]}$
                                                                          GOOD
                                                                          time: 1.018000ms
                                                                          stack: size: 0

                                                                            assertEq(A[1][1], var'a''^tt')
                                                                            ${{{ a} ^t} ^t} = {{{ a} ^t} ^t}$
                                                                            GOOD
                                                                            time: 0.382000ms
                                                                            stack: size: 0

                                                                              for j=1,3 do assertEq(A[1][j+1], var'c'('^'..spatialCoords[j].name)) end
                                                                              ${{ c} ^x} = {{ c} ^x}$
                                                                              ${{ c} ^y} = {{ c} ^y}$
                                                                              ${{ c} ^z} = {{ c} ^z}$
                                                                              GOOD
                                                                              time: 0.427000ms
                                                                              stack: size: 0

                                                                                for i=1,3 do assertEq(A[i+1][1], var'b'('^'..spatialCoords[i].name..'x')) end
                                                                                ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                                                ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                                                ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                                                GOOD
                                                                                time: 0.435000ms
                                                                                stack: size: 0

                                                                                  for i=1,3 do for j=1,3 do assertEq(A[i+1][j+1], var'b'('^'..spatialCoords[i].name..spatialCoords[j].name)) end end
                                                                                  ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                                                  ${{{ b} ^x} ^y} = {{{ b} ^x} ^y}$
                                                                                  ${{{ b} ^x} ^z} = {{{ b} ^x} ^z}$
                                                                                  ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                                                  ${{{ b} ^y} ^y} = {{{ b} ^y} ^y}$
                                                                                  ${{{ b} ^y} ^z} = {{{ b} ^y} ^z}$
                                                                                  ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                                                  ${{{ b} ^z} ^y} = {{{ b} ^z} ^y}$
                                                                                  ${{{ b} ^z} ^z} = {{{ b} ^z} ^z}$
                                                                                  GOOD
                                                                                  time: 1.234000ms
                                                                                  stack: size: 0


                                                                                    A['^tt'] = 2
                                                                                    GOOD time: 6.390000ms
                                                                                    stack: size: 7
                                                                                    • Init
                                                                                    • Prune
                                                                                    • Expand
                                                                                    • Prune
                                                                                    • Factor
                                                                                    • Prune
                                                                                    • Tidy

                                                                                    printbr('A = '..A)
                                                                                    A = $\overset{a\downarrow b\rightarrow}{\left[\begin{array}{cccc} 2& { c} ^x& { c} ^y& { c} ^z\\ {{ b} ^x} ^x& {{ b} ^x} ^x& {{ b} ^x} ^y& {{ b} ^x} ^z\\ {{ b} ^y} ^x& {{ b} ^y} ^x& {{ b} ^y} ^y& {{ b} ^y} ^z\\ {{ b} ^z} ^x& {{ b} ^z} ^x& {{ b} ^z} ^y& {{ b} ^z} ^z\end{array}\right]}$
                                                                                    GOOD
                                                                                    time: 0.722000ms
                                                                                    stack: size: 0

                                                                                      assertEq(A[1][1], Constant(2))
                                                                                      ${2} = {2}$
                                                                                      GOOD
                                                                                      time: 0.163000ms
                                                                                      stack: size: 0

                                                                                        for j=1,3 do assertEq(A[1][j+1], var'c'('^'..spatialCoords[j].name)) end
                                                                                        ${{ c} ^x} = {{ c} ^x}$
                                                                                        ${{ c} ^y} = {{ c} ^y}$
                                                                                        ${{ c} ^z} = {{ c} ^z}$
                                                                                        GOOD
                                                                                        time: 0.792000ms
                                                                                        stack: size: 0

                                                                                          for i=1,3 do assertEq(A[i+1][1], var'b'('^'..spatialCoords[i].name..'x')) end
                                                                                          ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                                                          ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                                                          ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                                                          GOOD
                                                                                          time: 0.599000ms
                                                                                          stack: size: 0

                                                                                            for i=1,3 do for j=1,3 do assertEq(A[i+1][j+1], var'b'('^'..spatialCoords[i].name..spatialCoords[j].name)) end end
                                                                                            ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                                                            ${{{ b} ^x} ^y} = {{{ b} ^x} ^y}$
                                                                                            ${{{ b} ^x} ^z} = {{{ b} ^x} ^z}$
                                                                                            ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                                                            ${{{ b} ^y} ^y} = {{{ b} ^y} ^y}$
                                                                                            ${{{ b} ^y} ^z} = {{{ b} ^y} ^z}$
                                                                                            ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                                                            ${{{ b} ^z} ^y} = {{{ b} ^z} ^y}$
                                                                                            ${{{ b} ^z} ^z} = {{{ b} ^z} ^z}$
                                                                                            GOOD
                                                                                            time: 1.359000ms
                                                                                            stack: size: 0


                                                                                              A['^ij'] = 1
                                                                                              GOOD time: 9.737000ms
                                                                                              stack: size: 7
                                                                                              • Init
                                                                                              • Prune
                                                                                              • Expand
                                                                                              • Prune
                                                                                              • Factor
                                                                                              • Prune
                                                                                              • Tidy

                                                                                              printbr('A = '..A)
                                                                                              A = $\overset{a\downarrow b\rightarrow}{\left[\begin{array}{cccc} 2& { c} ^x& { c} ^y& { c} ^z\\ {{ b} ^x} ^x& 1& 1& 1\\ {{ b} ^y} ^x& 1& 1& 1\\ {{ b} ^z} ^x& 1& 1& 1\end{array}\right]}$
                                                                                              GOOD
                                                                                              time: 1.292000ms
                                                                                              stack: size: 0

                                                                                                assertEq(A[1][1], Constant(2))
                                                                                                ${2} = {2}$
                                                                                                GOOD
                                                                                                time: 0.146000ms
                                                                                                stack: size: 0

                                                                                                  for j=1,3 do assertEq(A[1][j+1], var'c'('^'..spatialCoords[j].name)) end
                                                                                                  ${{ c} ^x} = {{ c} ^x}$
                                                                                                  ${{ c} ^y} = {{ c} ^y}$
                                                                                                  ${{ c} ^z} = {{ c} ^z}$
                                                                                                  GOOD
                                                                                                  time: 0.827000ms
                                                                                                  stack: size: 0

                                                                                                    for i=1,3 do assertEq(A[i+1][1], var'b'('^'..spatialCoords[i].name..'x')) end
                                                                                                    ${{{ b} ^x} ^x} = {{{ b} ^x} ^x}$
                                                                                                    ${{{ b} ^y} ^x} = {{{ b} ^y} ^x}$
                                                                                                    ${{{ b} ^z} ^x} = {{{ b} ^z} ^x}$
                                                                                                    GOOD
                                                                                                    time: 0.971000ms
                                                                                                    stack: size: 0

                                                                                                      for i=1,3 do for j=1,3 do assertEq(A[i+1][j+1], Constant(1)) end end
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      ${1} = {1}$
                                                                                                      GOOD
                                                                                                      time: 1.768000ms
                                                                                                      stack: size: 0