#include <stdio.h>
int
main()
{
char
myArray[] = {1, 2, 7, 12, 0, 3, 6, 2, 2, 0, 1, 0, 11, 7, 0, 13, 0, 15, 2, 3, 3, 3, 0, 1, 2, 1, 10, 9, 7, 0, 12, 12, 0};
int
nrows = 0, ncols = 0, len =
sizeof
(myArray) /
sizeof
(myArray[0]);
//initialize number of rows and columns to zero
int
curr_cols = 0;
for
(
int
i = 0; i < len; i++)
{
curr_cols += 1;
if
(myArray[i] == 0)
{
if
(ncols < curr_cols)
{
ncols = curr_cols;
//update number of columns if current rows columns are more
}
nrows += 1;
//increment row count for every zero encountered
curr_cols = 0;
//reset current column size after each row
}
}
char
myMatrix[nrows][ncols];
int
k = 0;
for
(
int
i = 0; i < nrows; i++)
{
for
(
int
j = 0; j < ncols; j++)
{
myMatrix[i][j] = 0;
//initialize all elements to zero
}
}
int
r = 0, c = 0;
for
(
int
i = 0; i < len; i++)
{
myMatrix[r][c] = myArray[i];
//copy elements from array
c += 1;
if
(myArray[i] == 0)
{
r += 1;
//go to next row after 0
c = 0;
//go to first column
}
}
//printing the matrix for testing
for
(
int
i = 0; i < nrows; i++)
{
for
(
int
j = 0; j < ncols; j++)
{
printf
(
" %d "
, myMatrix[i][j]);
}
printf
(
"\n"
);
}
}
char myArray [] = {1,2,7,12,0,3,6,2,2,0,1,0,11,7,0,13,0,15,2,3,3,3,0,1,2,1,10,9,7,0,12,12,0} Construct a set of instructions that will arrange the given array into matrix form where values after ‘0’ will be added to a new row. Prior to the construction
(Applied Algebra
Construct a standard array for the (5, 3) code given by the generator matrix: G-0 1011 Hint: It should hove 4 rows and 8 columns
Construct a standard array for the (5, 3) code given by the generator matrix: G-0 1011 Hint: It should hove 4 rows and 8 columns
IT a) If one row in an echelon form for an augmented matrix is [o 0 5 o 0 b) A vector bis a linear combination of the columns of a matrix A if and only if the c) The solution set of Ai-b is the set of all vectors of the formu +vh d) The columns of a matrix A are linearly independent if the equation A 0has If A and Bare invertible nxn matrices then A- B-'is the...
1.5.7 Describe all solutions of Ax = 0 in parametric vector form, where A is row equivalent to the given matrix 1 2 -2 6 0 0 1 -4 7 3 tx
1.5.7 Describe all solutions of Ax = 0 in parametric vector form, where A is row equivalent to the given matrix 1 2 -2 6 0 0 1 -4 7 3 tx
Linear algebra
Consider the matrix C 1 2 4 -1 C-3 1 2 -6 8 1 0 0 (a) Find a basis for Row(C) that consists entirely from rows of C. (b) Use Gram-Schmidt process to construct an orthonormal set from the rows of C.
Consider the matrix C 1 2 4 -1 C-3 1 2 -6 8 1 0 0 (a) Find a basis for Row(C) that consists entirely from rows of C. (b) Use Gram-Schmidt process to construct...