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

    printbr(Array(B:dim()))
    $\left[\begin{array}{cc} 3& 3\end{array}\right]$
    GOOD
    time: 0.077000ms
    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: 2.079000ms
      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: 1.186000ms
      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.195000ms
      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.105000ms
        stack: size: 0

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

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

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

                assert(A[4] == var'a''^z')
                GOOD time: 0.030000ms
                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.065000ms
                  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.155000ms
                    stack: size: 0

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

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

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



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

                              A2['^i'] = B'^i'()
                              GOOD time: 1.537000ms
                              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.131000ms
                              stack: size: 0

                                assertEq(A2[1], A[1])
                                ${{ a} ^t} = {{ a} ^t}$
                                GOOD
                                time: 0.060000ms
                                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.061000ms
                                  stack: size: 0

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

                                      assertEq(A2[4], B[3])
                                      ${{ b} ^z} = {{ b} ^z}$
                                      GOOD
                                      time: 0.074000ms
                                      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: 0.403000ms
                                        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: 0.660000ms
                                          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: 0.332000ms
                                            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: 0.864000ms
                                              stack: size: 0


                                                B = Tensor('^ij', function(i,j) return var'b'('^'..coords[i+1].name..' '..coords[j+1].name) end)
                                                GOOD time: 0.403000ms
                                                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.258000ms
                                                  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: 0.986000ms
                                                    stack: size: 0


                                                      A['^ij'] = B'^ij'()
                                                      GOOD time: 5.739000ms
                                                      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: 0.316000ms
                                                      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.107000ms
                                                        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.105000ms
                                                          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: 0.256000ms
                                                            stack: size: 0


                                                              C = Tensor('^i', function(i) return var'c'('^'..coords[i+1].name) end)
                                                              GOOD time: 0.074000ms
                                                              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.071000ms
                                                                stack: size: 0


                                                                  A['^ti'] = C'^i'()
                                                                  GOOD time: 2.607000ms
                                                                  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: 0.333000ms
                                                                  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.224000ms
                                                                    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.117000ms
                                                                      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: 0.295000ms
                                                                        stack: size: 0


                                                                          A['^it'] = B'^ix'()
                                                                          GOOD time: 2.856000ms
                                                                          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: 0.263000ms
                                                                          stack: size: 0

                                                                            assertEq(A[1][1], var'a''^tt')
                                                                            ${{{ a} ^t} ^t} = {{{ a} ^t} ^t}$
                                                                            GOOD
                                                                            time: 0.069000ms
                                                                            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.115000ms
                                                                              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.101000ms
                                                                                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: 0.384000ms
                                                                                  stack: size: 0


                                                                                    A['^tt'] = 2
                                                                                    GOOD time: 1.506000ms
                                                                                    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.231000ms
                                                                                    stack: size: 0

                                                                                      assertEq(A[1][1], Constant(2))
                                                                                      ${2} = {2}$
                                                                                      GOOD
                                                                                      time: 0.038000ms
                                                                                      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.122000ms
                                                                                        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.112000ms
                                                                                          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: 0.305000ms
                                                                                            stack: size: 0


                                                                                              A['^ij'] = 1
                                                                                              GOOD time: 3.897000ms
                                                                                              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: 0.173000ms
                                                                                              stack: size: 0

                                                                                                assertEq(A[1][1], Constant(2))
                                                                                                ${2} = {2}$
                                                                                                GOOD
                                                                                                time: 0.026000ms
                                                                                                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.071000ms
                                                                                                  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.077000ms
                                                                                                    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: 0.236000ms
                                                                                                      stack: size: 0