code: def tridiagonal_compact_filter(x):
      diagonals = ivy.array(x)
      dim = diagonals[0].shape[0]
      diagonals[[0, -1], [-1, 0]] = 0
      dummy_idx = [0, 0]
      indices = ivy.array(
          [
              [(i, i + 1) for i in range(dim - 1)] + [dummy_idx],
              [(i, i) for i in range(dim)],
              [dummy_idx] + [(i + 1, i) for i in range(dim - 1)],
          ]
      )
      matrix = ivy.scatter_nd(
          indices, diagonals, ivy.array([dim, dim]), reduction="replace"
      )
      return tridiagonal_matrix_filter(matrix)
  
imports: import numpy
  from hypothesis import assume, strategies
  import sys
  import ivy
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_frontend_test, assert_all_close
  from ivy_tests.test_ivy.test_functional.test_core.test_linalg import _get_dtype_value1_value2_axis_for_tensordot
  from ivy_tests.test_ivy.helpers.hypothesis_helpers.general_helpers import matrix_is_stable
  from ivy_tests.test_ivy.test_functional.test_core.test_linalg import _matrix_rank_helper
label_desc: Use image node_id 41 for calling a global function with example usage: tridiagonal_compact_filter(x) and returns: tridiagonal_matrix_filter