From b85542d283c583869b86dda0ef51fcbe7385a222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Wed, 8 Jan 2025 00:22:42 +0100 Subject: [PATCH] Fix catenation for >= 3d arrays (#198) --- testdata/binary_matrix.ivy | 7 +++++++ value/matrix.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/testdata/binary_matrix.ivy b/testdata/binary_matrix.ivy index 882c3c5e..084bb537 100644 --- a/testdata/binary_matrix.ivy +++ b/testdata/binary_matrix.ivy @@ -520,6 +520,13 @@ x = (2 3 rho iota 10); y=x; y[1;1]=0; x===x; x!==x; x===y; x!==y 7 8 9 33 10 11 12 44 +(2 2 3 rho iota 12) , 10*(2 2 3 rho iota 12) + 1 2 3 10 20 30 + 4 5 6 40 50 60 + + 7 8 9 70 80 90 + 10 11 12 100 110 120 + (2 2 3 rho iota 12) ,% 11*(2 3 rho iota 10) 1 2 3 4 5 6 diff --git a/value/matrix.go b/value/matrix.go index 0483a759..b10992a1 100644 --- a/value/matrix.go +++ b/value/matrix.go @@ -600,7 +600,7 @@ func (x *Matrix) catenate(y *Matrix) *Matrix { // list, list setShape(x, y.shape[len(y.shape)-1]) data = make([]Value, x.data.Len()+y.data.Len()) - xsize, ysize := x.ElemSize(), y.ElemSize() + xsize, ysize := x.shape[len(x.shape)-1], y.shape[len(y.shape)-1] copyElems(xsize, xsize, ysize, ysize) case x.Rank() == y.Rank()+1 && sameShape(x.shape[:len(x.shape)-1], y.shape):