Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a way to checking if two n-dimensional "matrices" are equal without writing a loop? (n>2)

    I am writing code that involves three dimensional spatial data.

    I need to check if two 3D matrices, which represent values at (x,y,z) spatial locations, are equal.

    If use an associative array to handle the 3 dimensions, it seems like I need to use a loop.

    The simple example below illustrates the issue for a one-dimensional associative array.

    Code:
    : A=asarray_create("real",1)
    
    : 
    : B=asarray_create("real",1)
    
    : 
    : asarray(A,1,42)
    
    : 
    : asarray(B,1,42)
    
    : 
    : A==B
      0
    
    : 
    : a=asarray(A,1)
    
    : 
    : b=asarray(B,1)
    
    : 
    : a==b
      1
    Last edited by Joshua Benjamin Miller; 12 Mar 2019, 07:00. Reason: making the code easier to follow.
Working...
X