Fast vector arithmetic over GF(3) Kris Coolsaet Department of Applied Mathematics and Computer Science, Ghent University, Belgium Fq10 – 12/07/2011.

Slides:



Advertisements
Similar presentations
© 2005 Microchip Technology Incorporated. All Rights Reserved. Slide 1 NUM 1019 Numerical Methods on the PIC Micro.
Advertisements

Cyclic Code.
Mathematics of Cryptography Part II: Algebraic Structures
Error Control Code.
Arithmetic Intro Computer Organization 1 Computer Science Dept Va Tech February 2008 © McQuain Algorithm for Integer Division The natural (by-hand)
2’s Complement Arithmetic (remember it’s a fixed length system)
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Binary Addition Rules Adding Binary Numbers = = 1
Congruence class arithmetic. Definitions: a ≡ b mod m iff a mod m = b mod m. a  [b] iff a ≡ b mod m.
Introduction to Vectors March 2, What are Vectors? Vectors are pairs of a direction and a magnitude. We usually represent a vector with an arrow:
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
Binary Numbers.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
8.3a-Vectors Terms Operations Practice Problems.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Outline Variables 1.
Mathematics of Cryptography Part I: Modular Arithmetic
Chapter 7 Arithmetic Operations and Circuits Binary Arithmetic Addition –When the sum exceeds 1, carry a 1 over to the next-more-significant column.
Part.7.1 Copyright 2007 Koren & Krishna, Morgan-Kaufman FAULT TOLERANT SYSTEMS Part 7 - Coding.
AN ORTHOGONAL PROJECTION
Combinatorial Algorithms Reference Text: Kreher and Stinson.
Length Reduction in Binary Transforms Oren Kapah Ely Porat Amir Rothschild Amihood Amir Bar Ilan University and Johns Hopkins University.
Error Control Code. Widely used in many areas, like communications, DVD, data storage… In communications, because of noise, you can never be sure that.
MIMO continued and Error Correction Code. 2 by 2 MIMO Now consider we have two transmitting antennas and two receiving antennas. A simple scheme called.
Linear Feedback Shift Register. 2 Linear Feedback Shift Registers (LFSRs) These are n-bit counters exhibiting pseudo-random behavior. Built from simple.
Complexity 20-1 Complexity Andrei Bulatov Parallel Arithmetic.
Hamming codes. Golay codes.
Operators & Expressions
1 How to Multiply Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. integers, matrices, and polynomials.
Addition Multiplication Subtraction Division. 1.If the signs are the same, add the numbers and keep the same sign = = If the.
Number Systems and Computer Arithmetic Winter 2014 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
Hardware Implementations of Finite Field Primitives
ELEC692 VLSI Signal Processing Architecture Lecture 12 Numerical Strength Reduction.
Arithmetic for Computers Chapter 3 1. Arithmetic for Computers  Operations on integers  Addition and subtraction  Multiplication and division  Dealing.
More Binary Arithmetic - Multiplication
David Kauchak CS 52 – Spring 2017
Hamming codes. Golay codes.
CS480 Cryptography and Information Security
Modulo-2 Digital coding uses modulo-2 arithmetic where addition becomes the following operations: 0+0= =0 0+1= =1 It performs the.
CSE 220 – C Programming Expressions.
Mathematical Background: Extension Fields
Network Security Design Fundamentals Lecture-13
CS480 Cryptography and Information Security
Digital Systems and Number Systems
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Congruence class arithmetic
Boolean Algebra, Bitwise Operations
Instructor: David Ferry
King Fahd University of Petroleum and Minerals
Matrix arithmetic: addition, subtraction and scalar multiplication
Chapter 11 © 2011, The McGraw-Hill Companies, Inc.
CPU Design & Computer Arithmetic
Modular Arithmetic and Change of Base
Cyclic Code.
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
Section 10.3 Modular Arithmetic
Generating QR Codes from Oracle Database - Appendix
Operators In Java Programming By Rajanikanth B.
Cryptology Design Fundamentals
Number Systems.
OPERATORS in C Programming
عنوان درس نام استاد
Section 9.3 Modular Arithmetic.
OPERATORS in C Programming
Presentation transcript:

Fast vector arithmetic over GF(3) Kris Coolsaet Department of Applied Mathematics and Computer Science, Ghent University, Belgium Fq10 – 12/07/2011

Basic idea Use bit-parallellism of CPU to do up to 64 computations at the same time Represent each element of F 3 with 2 bits Binary operations simulate operations on F 3 Notation (binary): b 1 + b 2 bitwise addition = exclusive or b 1 b 2 bitwise multiplication = and b 1 | b 2 bitwise or

Benchmarks Execution speed compared to standard methods that use arithmetic modulo 3 Programmed in C On a 64 bit processor (On a 32 bit processor you lose a factor of 2 when vector lengths are > 32)

Benchmark 1 Compute the rank of a square matrix

Benchmark 2 Compute the Hamming distance between two code words

Benchmark 3 Compute the dot product of two vectors

Benchmark 4 Generate all elements in a subspace spanned by 8 given vectors

Bit representation Element v of F 3 represented as (v 1,v 2 ) of F 2 x F 2 0 as (1,1) 1 as (0,1) 2 as (1,0) Vectors of F 3 n represented as pairs of words v v1v1 v2v

Some basic operations Negation if r = -v then r 1 =v 2 r 2 =v 1 Multiplication (elementwise) if r = v w then r 1 =v 1 w 2 | v 2 w 1 r 2 =v 1 w 1 | v 2 w 2 needs 6 binary operations

Addition and subtraction Addition r 1 = (v 2 + w 2 ) | (v 1 + v 2 + w 1 ) = (v 2 + w 2 ) | (v 1 + w 1 + w 2 ) r 2 = (v 1 + w 1 ) | (v 1 + v 2 + w 2 ) = (v 1 + w 1 ) | (v 2 + w 1 + w 2 ) needs 6 binary operations Subtraction r 1 = (v 2 + w 1 ) | (v 1 + v 2 + w 2 ) = (v 2 + w 1 ) | (v 1 + w 1 + w 2 ) r 2 = (v 1 + w 2 ) | (v 1 + v 2 + w 1 ) = (v 1 + w 2 ) | (v 2 + w 1 + w 2 ) Combined Needs only 10 operations

Dot product Shift right Cop y Mask Subtract binary 1Remainder after division by 3 weightmod3(v i ): number of 1-bits in v i modulo 3

Dot product Multiply v, w elementwise (6 operations) Sum of the elements of the result r = weightmod3(r 2 )- weightmod3(r 1 ) 3 divisions: (b mod 3 – a mod 3 + 3) mod 3 Better (2a + b) mod 3

Weight / Hamming distance Shift right Cop y Mask (ternary) weight of v = (binary) weight of v 1 + v Subtract binary Shift right Mask Add binary Continue: shift by 4 and add, shift by 8...

Iterate over 3 n vectors subtract Each step takes 3 operations

64 = Assume length ≤ 32 Represent v as two words (v 1,v 2 ), (v 2,v 1 ) Addition (v 1,v 2 )+(w 1,w 2 ) → (t 1,t 2 ) (t 1,t 2 )+(v 2,v 1 ) → (u 1,u 2 ) (t 2,t 1 ) | (u 1,u 2 ) → (r 1,r 2 ) 5 operations instead of 6

Other structures Similar tricks should work for vectors over other small structures Field of 4 elements (trivial?) Ring Z/4Z Field of 5,7 elements (fast enough?) Relevant combinations of binary operations can be found by (exhaustive) computer search

Thank you