Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
lbeckman314 13b8d99284 Update Jenkinsfile. pirms 10 mēnešiem
example_matrices updated README pirms 2 gadiem
helper_scripts organized files pirms 2 gadiem
.build.sh Update Jenkinsfile. pirms 10 mēnešiem
.gitignore updated gitignore pirms 2 gadiem
Jenkinsfile Update Jenkinsfile. pirms 10 mēnešiem
LICENSE Create LICENSE pirms 2 gadiem
README.md updated build file and readme pirms 1 gada
mBig1 Clean files. pirms 10 mēnešiem
mBig2 Clean files. pirms 10 mēnešiem
mSmall1 Clean files. pirms 10 mēnešiem
mSmall2 Clean files. pirms 10 mēnešiem
matriz.man updated build file and readme pirms 1 gada
matriz.png updated build file and readme pirms 1 gada
matriz.sh updated build file and readme pirms 1 gada
p1grading_result cs344: updated matrix pirms 2 gadiem
p1gradingscript organized files pirms 2 gadiem

README.md

matriz

This program adds, multiplies, transposes, and averages matrices! in action here.



Installation

For an example of installation, see here.

0. Prerequisites

bash :: for running the script.

git :: for a quick git clone.

If you have a propensity against git, check out the alternative installation. In which case wget or curl can be helpful for downloading the necessary files. gpg and sha256sum can be used to verify the integrity of the files.

If you are running Windows, the above utilities will be packaged in any of the following: babun, cmder, or Linux Subsystem for Windows. Take your pick! : )

The above utilities should be installed (or readily available) if you are running a Unix derivative (such as Linux, macOS, or any of the BSD’s).

1. Quickstart

# clone the git repo
git clone https://git.liambeckman.com/cgit/matriz

# enter directory
cd matriz

# allow the script to execute
chmod u+x matriz.sh

# run the script
./matriz.sh add m1 m1


Uninstallation

0. Delete the directory/folder.

rm -rfI matriz



Documentation

(Run man -l matriz.man while in the directory for a basic man page for matriz.)

matriz takes four arguments: add, average, multiply, and transpose. matriz input (either with files or standard input) must be integers, either positive or negative, separated by white space. Non-numeric characters (including blank elements) will throw an error. Output will be tab-delimited elements.



add

takes two matrices of dimensions `row × col` and `row × col` and produces a sum matriz of dimesions `row × col`. To add two matrices, run `./matriz.sh add m1 m2` where `m1` and `m2` are matriz files.
$ cat mI1
1   2   3   4
5   6   7   8

$ ./matriz.sh add m1 m1
2	4	6	8
10	12	14	16



mean

takes one matriz of dimension `row × col` and averages each of it's columns. Produces an average matriz of dimensions `1 × col`. To add two matrices, run `./matriz.sh transpose m1 ` where `m1` is a matriz file.
$ cat m1
1   2   3   4
5   6   7   8

$ ./matriz.sh mean m1
3	4	5	6



multiply

takes two matrices of dimensions `row₁ × col₁` and `row₂ × col₂` and produces a sum matriz of dimesions `row₁ × col₂`. col₁ must be eqaul to row₂. To add two matrices, run `./matriz.sh multiply m1 m2` where `m1` and `m2` are matriz files.
$ cat m1
1   2   3   4
5   6   7   8

$ cat m2
1	5
2	6
3	7
4	8

$ ./matriz.sh multiply m1 m2
30	70
70	174



transpose

takes one matriz and moves element at position `row × col` to position `col × row`. To add two matrices, run `./matriz.sh transpose m1` where `m1` is a matriz file.
$ cat m1
1   2   3   4
5   6   7   8

$ ./matriz.sh transpose m1
1	5
2	6
3	7
4	8




Examples of valid and invalid matrices:

m4 is a valid matrix

$ cat m4

1   2   3
4   5   6
7   8   9
10  11  12


m5 is an invalid matrix: non-numeric character at position (1, 3).

$ cat m5

1   2   A
4   5   6
7   8   9
10  11  12




m6 is a valid matrix

$ cat m6

1   2
2   3
3   4
4   5


m7 is an invalid matrix: blank character at position (2, 1)

$ cat m7

1   2
    3
3   4
4   5




m8 is a valid matrix

$ cat -A m8

1   2   3$


m9 is an invalid matrix: trailing tab in first row

$ cat m9

1   2   3    $




Alternative Installation

0. Download

Click the tar.gz or zip buttons at the top of the page to download a tar.gz or .zip compressed directory.

Or copy and paste the following command into the terminal to have it download it for you!

wget http://www.liambeckman.com/pkgs/matriz/matriz.tar.gz

# or if you prefer curl:
# curl http://www.liambeckman.com/pkgs/matriz/matriz.tar.gz -o matriz.tar.gz

Optional (but recommended): verify file integrity

#-------------------------------#
# RECIEVE GPG KEYS
#-------------------------------#

gpg --keyserver pgp.mit.edu --recv-keys AC1CC079

#-------------------------------#
# RECIEVE SHA256SUMS
#-------------------------------#

wget http://www.liambeckman.com/pkgs/matriz/sha256sums.txt{,.asc}
# or if you prefer curl:
# curl http://www.liambeckman.com/pkgs/matriz/sha256sums.txt{,.asc} -o sha256sums.txt -o sha256sums.txt.asc

#-------------------------------#
# VERIFY SHA256SUMS
#-------------------------------#

gpg --verify sha256sums.txt.asc

# gpg: Signature made Tue Oct 31 11:11:11 2017 PDT using RSA key ID AC1CC079
# gpg: Good signature from "liam beckman ("I only want to live in peace, plant potatoes, and dream!" -Tove Jansson) <lbeckman314@gmail.com>" [unknown]

#-------------------------------#
# VERIFY FILE INTEGRITY
#-------------------------------#

sha256sum -c sha256sums.txt

# matriz.tar.gz: OK
# matriz.zip: OK

#-------------------------------#
# OPTIONALLY REMOVE PUBLIC KEY
#-------------------------------#

# to remove my public key from your public key ring, simply
gpg --delete-key AC1CC079

1. Extract

tar -zxvf matriz.tar.gz
# or if you downloaded the zip file
# unzip matriz.zip

2. Compile and run

cd matriz

chmod u+x matriz
./matriz add m1 m1


Uninstallation

0. Delete the directory/folder.

rm -rfI matriz