Skip to content

mksoska/open-source-development-course-hw02-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Simple Vector implementation in python

Very simple vector implementation supporting basic operations.

Usage

from ossdev import Vector, Matrix
a = Vector([0, 1, 2, 3])
print(a)

m = Matrix.ident(4)
print(m)
print(m + m)

Operations: (Supported verctor-based operations)

  • Addition with a scalar: a + 1
  • Vector addition: a + b
  • Vector comparison: a >/>=/</<=/==/!= b compares vectors according to their length
  • Vector negation: neg a is equals to mutiplying vector by (-1)
  • Reversed vector: reverse a reverses the order of vector coordinates
  • Subtraction with a scalar: a - 1
  • Vector subtraction: a - b
  • Multiplication:
    • scalar * vector
    • row-vector * col-vector
    • col-vector * row-vector

Matrix operations:

  • Addition

  • Bitwise XOR on every coordinate: a ^ 3 returns vector with XORed coords

  • Vector length: len a

  • Vector modification - modifies a verctor's coordinates

Installation

pip install -U --no-cache .

About

Second homework of the Open source development course (part 1)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Shell 0.4%