Programming in C
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
bartleby

Videos

Textbook Question
Book Icon
Chapter 7, Problem 12E

A matrix M with i rows, j columns can be transposed into a matrix N having j rows and i columns by simply setting the value of Na,b equal to the value of Mb,a for all relevant values of a and b.

  1. a. Write a function t that takes as an argument a 4 × 5 matrix and a 5 × 4 matrix. Have the function transpose the 4 × 5 matrix and store the results in the 5 × 4 matrix. Also write a m routine to test the function.
  2. b. Using variable-length arrays, rewrite the t function developed in exercise 12a to take the number of rows and columns as arguments, and to transpose the matrix of the specified dimensions.
Blurred answer
Students have asked these similar questions
C'ZT Write a function that takes one input, a matrix X. Your function should modify X and return the modified version of X as an output. Assuming that X has m rows and n columns: When m is equal to n, modified X should be the same as X. When m is greater than n, the modified version of X should be m x m. New columns should be added to the right of the original columns of X, with each new element having a value that is one less than the element in the column to the left. For example, the matrix: 2 3 4 6 Would become: 2321 4 65 4 8987 1210 When n is greater than m, the modified version of X should be n x n. New rows should be added to the bottom of the original rows of X, with each new element having a value that is one more than the element in the row above it. For example, the matrix: 2345 468 10 Would become 2345 4 6 1e 3791L G8 10 12
R Programming - Rmarkdown: 1. Given two vectors x and y of equal length, in one line of code (in the function body), write a function find_max_logical() that will output a single logical vector that is TRUE at the indices where the maximum values in x and y are. For example, given the below vectors: x <- c(Inf, 3, 2, 6, 99) y <- c(12, 1, 0, 40, 5) # You should return (without manually creating the vector with c()) c(TRUE, FALSE, FALSE, TRUE, FALSE) # Noting that Inf and 40 are the max values of x and y respectively, ## at the 1st index of x and the 4th index of y. Please test your functions on the following test inputs in your submission: # test case 1: x = c(Inf, 3, 2, 6, 99), y = c(12, 1, 0, 40, 5) # test case 2: x = 1:5, y = 1:5 # test case 3: x = c(1, 4, 9), y = c(1, 4, 2)
2. Write a program to take input a 4 X 4 matrix using a user defined function and print the output as follows: Input: 1 2 4 5 6. 7 1 3 4 5 6. Output: 7 5 11 13 15 13 9 1 3 11 7 9 11 9. The value of every jh column of any ith row of the 2d-array is added with the value of next column of ith row. If the jh column represents the last column of the 2-d array, add the jh column's item with the value of first column (where j = 0) of the inputted 2-d array.

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License