Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These are the matrices for m1 and m2. So I am currently stuck on the matrix transpose m1( or m2) function. I've tried a few

image text in transcribedimage text in transcribed

image text in transcribed These are the matrices for m1 and m2.

So I am currently stuck on the "matrix transpose m1( or m2)" function. I've tried a few solutions and looking around online, but most of the examples use 3rd party features that are restricted in this assignment.

Also, If it is at all possible, I need assistance on where to go with the "matrix mean m1 (or m2)" function and how to read the lines while looping through the values in the matrix.

Thank you!

You will be using bash builtins and Unix utilities to complete the assignment. Some commands to read up on are while, cat, read, expr, cut, head , tail, wc, and sort. Your script must be called simply "matrix". The general format of the matrix command is: matrix OPERATION CARGUMENT]... Refer to man(1) (You can do this with the commandman 1 man) for an explanation of the conventional notation regarding command syntax, to understand the line above. Note that many terminals render italic font style as an underline: matrix OPERATION [ARGUMENT]... Specifications Your program must perform the following operations: dims, transpose, mean, add, and multiply. Usage is as follows: matrix dims [MATRIX] matrix transpose [MATRIX] matrix mean [MATRIX] matrix add MATRIX_LEFT MATRIX_RIGHT matrix multiply MATRIX LEFT MATRIX RIGHT The dims, transpose, and mean operations should either perform their respective operations on the file named MATRIX, or on a matrix provided via stdin. The add and multiply operations do not need to process input via stdin. dims should print the dimensions of the matrix as the number of rows, followed by a space, then the number of columns. transpose should reflect the elements of the matrix along the main diagonal. Thus, an MxN matrix will become an NxM matrix and the values along the main diagonal will remain unchanged. mean should take an MxN matrix and return an 1xN row vector, where the first element is the mean of column one, the second element is the mean of column two, and so on. matrix transpose (MATRIX Prints error message to stderr, nothing to stdout and return value != 0 if: Argument count is greater than 1 (e.g. "matrix transpose ml m2). Argument count is 1 but the file named by argument 1 is not readable (e.g. matrix transpose no_such_file). Otherwise, prints the transpose of the input, in a valid matrix format to stdout, nothing to stderr, and returns 0. matrix mean (MATRIX] Prints error message to stderr, nothing to stdout and return value != 0 if: Argument count is greater than 1 (e.g. matrix mean ml m2). Argument count is 1 but the file named by argument 1 is not readable (e.g. "matrix mean no_such_file). Otherwise, prints a row vector mean of the input matrix, in a valid matrix format to stdout, nothing to stderr, and returns 0. All values must round to the nearest integer, with ***.5 values rounded away from zero. os1 - 996$ cat m1 1 17 44 1223 64 os1 - 997$ cat m2 1 17 85 - 44 9966 42

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logics For Databases And Information Systems

Authors: Jan Chomicki ,Gunter Saake

1st Edition

1461375827, 978-1461375821

More Books

Students also viewed these Databases questions