answersLogoWhite

0

Provided both matrices are mutable, two matrices A and B can be swapped like any other two items: create temporary storage to store a copy of A, then assign B to A, and finally assign the temporary copy of the previous version of A to B.

Note that in the C Programming language, matrices cannot be assigned to each as such. One implementation of this algorithm might operate on the basis of references (pointers), and can thus swap two matrix references by swapping two pointers in the manner detailed above. Implementations wishing to actually transfer the data held in one matrix to another would use a library function such as memcpy() to transfer data.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How do you use swap mod on enter the matrix?

Type f2222546


How are the inverse matrix and identity matrix related?

If an identity matrix is the answer to a problem under matrix multiplication, then each of the two matrices is an inverse matrix of the other.


How do you multiply two metrix without array?

A matrix IS an array so it is impossible to multiply a matrix without array. The answer to the multiplication of two matrices need not be an array. If the first matrix is a 1xn (row) matrix and the second is an nx1 (column) matrix, then their multiple is a 1x1 matrix which can be considered a scalar.


A two-dimensional array of elements arranged in rows and columns is a?

matrix


Definition of commutative matrix?

Commutative Matrix If A and B are the two square matrices such that AB=BA, then A and B are called commutative matrix or simple commute.


Two formats you may choose from when creating a format task organization?

Matrix is one of the two formats used when creating a format task organization.


How can I multiply two 2x2 matrices?

To multiply two 2x2 matrices, you need to multiply corresponding elements in each row of the first matrix with each column of the second matrix, and then add the products. The resulting matrix will also be a 2x2 matrix.


What is a 1x2 matrix?

It is a matrix with 1 row and two columns: something like (x, y).


What is the use of matrix in data structures?

Nothing, but a two dimensional array can be used to represent a matrix.


How is the order of a matrix found?

The order of a matrix is another way of saying the dimensions of of a matrix. For a two dimensional matrix, the order could be 2 by 2, or 3 by 3, or 32 by 64.


Swap of two numbers with xor?

void swap (int *a, int *b) { *a ^= *b; *b ^= *a; *a ^= *b; return; }


What is 2 by 2 in matrix?

A 2x2 matrix has two rows (horizontal) and two columns (vertical). Ex: [1 0] [0 1]