Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

matrix_is_symmetric

By Daniel · January 1, 2009

Returns the whether some matrix M is symmetric, i.e., equivalent to its transpose. M should be a ds_grid filled with real entries.

/* matrix_is_symmetric(M)
 *
 * Returns the whether some matrix M is symmetric, i.e., equivalent to its
 * transpose. M should be a ds_grid filled with real entries.
 */

var start, i, j;

start = ds_grid_width(argument0) - 1;

for (i = 0; i < start; i += 1)
  for (j = 0; j <= i; j += 1)
    if (ds_grid_get(argument0, j, start - i + j) !=
        ds_grid_get(argument0, start - i + j, j))
      return false;

return true;

Categories: Mathematics

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement