Skip to content

Commit

Permalink
Merge pull request elibensasson#5 from rex4539/fix-typos
Browse files Browse the repository at this point in the history
Fix typos in various files
  • Loading branch information
MichaelRiabzev authored Mar 15, 2018
2 parents 05977e2 + 2f3a93e commit a783f5d
Show file tree
Hide file tree
Showing 78 changed files with 224 additions and 224 deletions.
2 changes: 1 addition & 1 deletion algebra/FFT/src/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void Element::do_FFT_step(const Element& factor,Element* a, Element* b, const in
// thus there are only 8 possibilities for each polynomial.
// Moreover, the product of any such option by 1 + x + x^3 + x^4 is a polynomial
// of degree oat most 2+4=6,
// and in particular, defined by it's first byte.
// and in particular, defined by its first byte.
// We use a precomputed lookup table to compute the required reductions:
//
// xmmCarry1[ 64: 0] = ( ( ( (factor * a[0]) div x^64 ) * ( 1 + x + x^3 + x^4 ) (div x^64) ) * x^64 ) (mod Irr(x))
Expand Down
4 changes: 2 additions & 2 deletions algebra/FFT/src/FFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void FFT::AlgFFT(Polynomial* P, len_t p_len)const{
#endif // #ifdef __GPU
// Use this for debug, print out of the polynomial
// std::cout << "here in Matan's ALGFFT:" << std::endl;
// Polynomials::printPolynomial(*P,8);//temp added for debuging ARIEL
// Polynomials::printPolynomial(*P,8);//temp added for debugging ARIEL
}

void FFT::AlgIFFT(Element* P){
Expand All @@ -224,7 +224,7 @@ void FFT::AlgIFFT(Element* P){

}
/*
* Allocating Version of the FFT Algoirthm
* Allocating Version of the FFT Algorithm
*/
void FFT::AlgFFT(const Polynomial* P, len_t p_len, Element** res){
if(p_len > (1UL<<this->basis.getSize()))
Expand Down
4 changes: 2 additions & 2 deletions algebra/FFT/src/FFT.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FFT {
*/
Basis basis;
/*
* This is the series of bases over which the polynomial is actually recusrively evaluated.
* This is the series of bases over which the polynomial is actually recursively evaluated.
*/
Basis* bases;
/*
Expand Down Expand Up @@ -75,7 +75,7 @@ class FFT {
Chunk** gpu_exp;
Chunk** gpu_i_exp;
/*
* This is the chunk that is used for the last phase, every even element in the chunk contains lastD+lastShift, every odd one will contains only lastD.
* This is the chunk that is used for the last phase, every even element in the chunk contains lastD+lastShift, every odd one will contain only lastD.
*/
Chunk linear_mul;
Chunk ilinear_mul;
Expand Down
16 changes: 8 additions & 8 deletions algebra/FFT/src/GPU_FFT.cu
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ void GPU_FFT::taylorExpansion_gpu(const FFT* fft, Chunk* d_chunk_P, len_t p_len
/*
* Input:
* 1) d_chunk_p - The polynomial on device's memory.
* 2) p_len - number of chunks in d_cunnk_p.
* 2) p_len - number of chunks in d_chunk_p.
* 3) chunk_idx - the chunk current thread has to deal with.
* 4) in_chunk_idx - the number of the cell the current thread deals with.
* 5) t_dim - The dim of the original (input) subpolynomial.
Expand Down Expand Up @@ -1135,7 +1135,7 @@ __device__ void InTB_postMulShrink( Chunk * const d_a,
* The state of d_a[1] is unknown at the end.
*
* 1) d_a - the chunk the mult.
* 2) in_chunk_idx - Is thread index % Chunk::elemets_in_chunk
* 2) in_chunk_idx - Is thread index % Chunk::elements_in_chunk
*/
__device__ void InTB_Mult(Chunk* const d_a, const idx_t in_chunk_idx){
Chunk::clmul_by_chunk(*d_a,d_a[1],in_chunk_idx,d_a);
Expand All @@ -1148,7 +1148,7 @@ __device__ void InTB_Mult(Chunk* const d_a, const idx_t in_chunk_idx){
* 2) exp - pointer to the exponents to multiply (global mem).
* 3) dim - dimension of multiexponentiation.
* 4) idx - thread index.
* 5) chunkIdx - idx/Chunk::elemets_in_chunk.
* 5) chunkIdx - idx/Chunk::elements_in_chunk.
* 6) in_chunk_idx - idx%Chunk::elements_in_chunk.
*/
__device__ void InTB_MultiExp( Chunk* const d_a,
Expand Down Expand Up @@ -1406,10 +1406,10 @@ __device__ void InTB_WFromUV_inChunk( Chunk* const d_a,
const idx_t in_chunk_idx,
const len_t half_d_a_len){
/*
* 1)backup the WHOLE cell.
* 1)Backup the WHOLE cell.
* 2)Multiply by subspace chunk (will nullify lower top).
* 3)Xor by it self when shifting right subspace-times.
* 4) Xor the load.
* 3)Xor by itself when shifting right subspace-times.
* 4)Xor the load.
*/
chunk_cell_t load[4];
/*
Expand Down Expand Up @@ -1687,7 +1687,7 @@ k_gpuFFT_InTB(Chunk* const d_a, Chunk** subspaces, Chunk** exps, len_t dim, cons
}
}
/*
* This is the inverse FFT imnplementation
* This is the inverse FFT implementation
*/

void GPU_FFT::ifft_gpu(const FFT* const fft,Polynomial* P){
Expand Down Expand Up @@ -1864,7 +1864,7 @@ void GPU_FFT::itaylorExpansion_gpu(const FFT* fft, Chunk* d_chunk_P, len_t p_len
/*
* Input:
* 1) d_chunk_p - The polynomial on device's memory.
* 2) p_len - number of chunks in d_cunnk_p.
* 2) p_len - number of chunks in d_chunk_p.
* 3) chunk_idx - the chunk current thread has to deal with.
* 4) in_chunk_idx - the number of the cell the current thread deals with.
* 5) t_dim - The dim of the original (input) subpolynomial.
Expand Down
2 changes: 1 addition & 1 deletion algebra/FFT/src/Polynomials.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Polynomials {
public:
/*
* Calculates the Taylor Expansion of p at (x^2-x).
* Given a polynomial f(x) of deg 2^(k+1) calcuating the taylor expansion of f(x)
* Given a polynomial f(x) of deg 2^(k+1) calculating the taylor expansion of f(x)
* at (x^2-x) is finding m=2^k polynomials h_0(x),...,h_(m-1)(x), each of degree <= 2.
* Such that:
* f(x)= h_0(x)*(x^2-x)^0+ h_1(x)*(x^2-x)^1+....+h_(m-1)(x)*(x^2-x)^(m-1).
Expand Down
6 changes: 3 additions & 3 deletions algebra/algebralib-tests/FFT_UTEST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST(Algebra,novelFFT_single){
const unsigned short basisSize = 10;
const size_t polyDeg = (1<<basisSize);

//construct the basis (just the standard basis)
//construct the basis (just the standart basis)
elementsSet_t basisUnordered = getStandartBasis(basisSize);
vector<FieldElement> orderedBasis;
for(const auto& b : basisUnordered) orderedBasis.push_back(b);
Expand Down Expand Up @@ -131,7 +131,7 @@ TEST(Algebra,novelFFT_multiple){
const size_t numPolys = 2;//5;
const size_t numCosets = 1;//3;

//construct the basis (just the standard basis)
//construct the basis (just the standart basis)
elementsSet_t basisUnordered = getStandartBasis(basisSize);
vector<FieldElement> orderedBasis;
for(const auto& b : basisUnordered) orderedBasis.push_back(b);
Expand Down Expand Up @@ -196,7 +196,7 @@ TEST(Algebra,FFT_LDE){
vals.push_back(generateRandom());
}

//comput the LDE
//compute the LDE
vector<FieldElement> LDE_res = LDE(vals, orderedBasis_src, shift_src, orderedBasis_dst, shift_dst);

//compute the reference
Expand Down
4 changes: 2 additions & 2 deletions algebra/algebralib-tests/FieldElement_UTEST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using Algebra::invertPointwise;
using std::vector;

/**
* A function to test that field elements comparisonf
* A function to test that field elements comparison
* function (for stl collections usage)
* works
*/
Expand Down Expand Up @@ -104,4 +104,4 @@ TEST(Algebra,elementInvertVector){
}
}

} //anonimus namespace
} //anonymous namespace
2 changes: 1 addition & 1 deletion algebra/algebralib-tests/LinearizedPolynomials_UTEST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ TEST(Algebra, linearizedPolynomialConstructor){



} //anonimus namespace
} //anonymous namespace
10 changes: 5 additions & 5 deletions algebra/algebralib-tests/UnivariatePolynomialGeneral_UTEST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ TEST(Algebra,UniPolyInterpulation){

//construct basis superset
//This set will contain the basis
//which will be exactly the first linearly undependant
//which will be exactly the first linearly independent
//elements the iterator will go over
elementsSet_t basis_supset;
for(int i=0; i<basisMaxSize; i++){
Expand All @@ -168,11 +168,11 @@ TEST(Algebra,UniPolyInterpulation){
//construct evaluation map for the vector space
//spanned by the basis (each coefficient is 0 or 1)
//
//while constructing the mapping, remove linearly dependant
//while constructing the mapping, remove linearly dependent
//elements from the basis set
//do it by in every step looking at the next element
//in the basis super set, if this element has already
//an evaluation than it is dependant with the previous
//an evaluation than it is dependent with the previous
//elements, and will be skipped.
//Otherwise, the element will be added to the basis set,
//and we will find a random evaluation for all the elements
Expand All @@ -194,7 +194,7 @@ TEST(Algebra,UniPolyInterpulation){
//otherwise, add to basis, and expand the mapping
basis.insert(belem);
for(const auto& point : mapping){
//The if is just so we wont get into an infinite loop
//The if is just so we won't get into an infinite loop
if(mapping.count(point.first + belem) == 0){
mapping[point.first + belem] = generateRandom();
}
Expand All @@ -215,4 +215,4 @@ TEST(Algebra,UniPolyInterpulation){
}
}

} //anonimus namespace
} //anonymous namespace
2 changes: 1 addition & 1 deletion algebra/algebralib/headers/algebraLib/ErrorHandling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Algebra{
#endif

/**
* The ErrorHandling class containimplements the functionality of displaying the content of error
* The ErrorHandling class contains and implements the functionality of displaying the content of error
* messages (including content of call stack when error happened), and exiting the program.
*/
class ErrorHandling {
Expand Down
4 changes: 2 additions & 2 deletions algebra/algebralib/headers/algebraLib/FieldElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ inline FieldElement power(const FieldElement& a, long e)
/**
* @brief An order on field elements
* This exists only in order to be able to keep
* field elements in an STL set, hance the order
* field elements in an STL set, hence the order
* is arbitrary, as long as it really is an order.
* In this case lexicographically, representing each
* FieldElement as vector of bytes
Expand Down Expand Up @@ -196,7 +196,7 @@ std::vector<FieldElement> getStandartOrderedBasis(const unsigned short basisSize
* Let "numToWrite" = \f$ 2^0 b_0 + 2^1 b_1 + \dots + 2^k b_k \f$
* Lets name "shift" as S , and "numBits" as N
*
* This functions generated the field element that
* These functions generated the field element that
* as a polynomial over GF(2) might be represented as:
* \f$ x^{s} b_0 + x^{s+1} b_1 + \dots x^{s+n-1} b_{n-1} \f$
**/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Algebra {
class LinearizedPolynomial : public AffinePolynomial{

public:
/** Class Constructor - Assignes the given coefficient array to the newly created polynomial.
/** Class Constructor - Assigns the given coefficient array to the newly created polynomial.
Assigns the constant factor of the poly to be 0.
*/
LinearizedPolynomial(std::vector<FieldElement> coefficients) :AffinePolynomial(coefficients, zero()){};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class UnivariatePolynomialInterface : public PolynomialInterface {
virtual FieldElement eval(const FieldElement& x)const = 0;

/**
* @brief evaluates a polynomial over a givven space (represented by a ordered basis and affine shift)
* @brief evaluates a polynomial over a given space (represented by a ordered basis and affine shift)
* @return the evaluation as a vector, element number \f$ \sum_{i=0}^n b_i \cdot 2^i \f$ represents
* the value at the point \f$ shift + \sum_{i=0}^n (basis element)_i \cdot 2^i \f$
*/
Expand Down
2 changes: 1 addition & 1 deletion algebra/algebralib/headers/algebraLib/SelectorSum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace Algebra{
vector<FieldElement> getSelectorVals(const vector<FieldElement>& x)const;
vector <CircuitPolynomial> constraints;
vector<VarIndex_t> selectorVars;
varSet selectorVariables;//need to store this in addition to one above is to be able to implememnt the getUsedVariables method - needed for SelectorSum class to
varSet selectorVariables;//need to store this in addition to one above is to be able to implement the getUsedVariables method - needed for SelectorSum class to
//inside CircuitPolynomial
vector<long> selectorToConstraint; //v[i] tells us what constraint S_i should multiply
vector<bool> selectorRelevant; //v[i] tells us if i'th selector S_i really used in this polynomial
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* A class for special linearized polynomials - subspace polynomials - that split into distinct roots
The main addition in this clase is a constructor that takes as input a set of elements,
The main addition in this class is a constructor that takes as input a set of elements,
and returns the subspace poly whose roots are exactly the linear span of this set
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class UnivariatePolynomialGeneral : public DivisorPolynomial {
FieldElement eval(const FieldElement& x)const;

/**
* @brief evaluates a polynomial over a givven space (represented by a ordered basis and affine shift)
* @brief evaluates a polynomial over a given space (represented by a ordered basis and affine shift)
* @return the evaluation as a vector, element number \f$ \sum_{i=0}^n b_i \cdot 2^i \f$ represents
* the value at the point \f$ shift + \sum_{i=0}^n (basis element)_i \cdot 2^i \f$
*/
Expand Down Expand Up @@ -115,9 +115,9 @@ class UnivariatePolynomialGeneral : public DivisorPolynomial {

/**
* @brief Let this polynomial be \f$a \in \mathbb{F}[x]\f$, and the parameter be \f$b \in \mathbb{F}[x]\f$
* than by the devision theorem there exists \f$ q,r \in \mathbb{F}[x] \f$ such that \f$ \deg r < \deg a \f$
* than by the division theorem there exists \f$ q,r \in \mathbb{F}[x] \f$ such that \f$ \deg r < \deg a \f$
* and \f$ b = aq + r \f$.
* This method return \f$q\f$
* This method returns \f$q\f$
*/
std::unique_ptr<UnivariatePolynomialInterface> divideByMe(const UnivariatePolynomialInterface& dividend)const;

Expand Down
4 changes: 2 additions & 2 deletions algebra/algebralib/headers/algebraLib/novelFFT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ namespace Algebra{
///
/// This algorithm has O(n \log n ) time complexity, with very low constants
/// It is very easy to use to evaluate many polynomials at one shot over the same space.
/// It's additional space complexity is less then the evaluation size.
/// It's additional space complexity is less than the evaluation size.
///
/// As this algorithm uses special polynomial basis,
/// it first transforms coefficients over the standard basis to coefficients
/// for the special basis, this is done by evaluation (using Matans FFT) and
/// IFFT using the nofel IFFT algorithm.
/// IFFT using the novel IFFT algorithm.
///
/// The coefficients in the special basis are kept for future evaluation.
///
Expand Down
2 changes: 1 addition & 1 deletion algebra/algebralib/headers/algebraLib/variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class VariableArray;
typedef FieldElement FElem;
typedef long VarIndex_t;
typedef ::std::vector<Variable> VariableArrayContents;
typedef Variable FlagVariable; //Holds variable whos purpose is to be populated with a boolean value, Field(0) or Field(1)
typedef Variable FlagVariable; //Holds variable whose purpose is to be populated with a boolean value, Field(0) or Field(1)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion algebra/algebralib/src/FFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <algorithm>
#include <cstring>

/// Important : all this assumes Matans irredusible is used for the context field
/// Important : all this assumes Matans irreducible is used for the context field

namespace Algebra{
using std::vector;
Expand Down
12 changes: 6 additions & 6 deletions algebra/algebralib/src/SelectorSum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <algebraLib/ErrorHandling.hpp>
namespace Algebra{

//useful auxilary method to eval by assignment when only have eval by vector
//useful auxiliary method to eval by assignment when only have eval by vector

vector<FieldElement> assignmentToVector(const Algebra::VariableAssignment& assignment){
vector<FieldElement> retVal(assignment.size() * 2);
Expand Down Expand Up @@ -35,7 +35,7 @@ namespace Algebra{
}
}

//if selectorRelevant vector not given as input,assume all selectors are relevant
//if selectorRelevant vector not given as input, assume all selectors are relevant
SelectorSum::SelectorSum(const vector<CircuitPolynomial>& constraints, const vector<Variable>& selectorVariableVector, const vector<long>& selectorToConstraint) :
constraints(constraints),
selectorToConstraint(selectorToConstraint),
Expand All @@ -51,7 +51,7 @@ namespace Algebra{
selectorVariables.insert(selectorVariableVector[i]);
}
for (unsigned int i = 0; i < selectorToConstraint.size();i++)
selectorRelevant.push_back(true);//if selectorRelevant vector not given as input,assume all selectors are relevant
selectorRelevant.push_back(true);//if selectorRelevant vector not given as input, assume all selectors are relevant

}

Expand Down Expand Up @@ -84,7 +84,7 @@ namespace Algebra{
ALGEBRALIB_FATAL("Not implemented");
}

//the need for this method has to do with different selectors having same P_i, as explaing in top of hpp file
//the need for this method has to do with different selectors having same P_i, as explained in top of hpp file
vector<FieldElement> SelectorSum::getConstraintCoeffs(const vector<FieldElement>& x)const{
vector<FieldElement> selectorVals = getSelectorVals(x);
vector<FieldElement> coeffs;
Expand Down Expand Up @@ -114,7 +114,7 @@ namespace Algebra{
long curLength = 2;

for (auto i = 1; i < selectorVarNum; i++){// in principle can do last iteration of loop separately to avoid rounding up selectorNum to a power of 2
for (auto j = 0; j < curLength; j++){//copying the current vector.Then Mult each element of first copy by newVar +1, each element of second copy by newVar
for (auto j = 0; j < curLength; j++){//copying the current vector. Then Mult each element of first copy by newVar +1, each element of second copy by newVar
//doing it in a `crooked' way to do just mult by newVar, and not also the mult by newVar +1
selectorVals[j + curLength] = selectorVals[j] * x[selectorVars[i]];
selectorVals[j] += selectorVals[j + curLength];
Expand Down Expand Up @@ -198,7 +198,7 @@ namespace Algebra{
for (unsigned int i = 0; i < selectorVars.size(); i++)
selectorVars[i] = old2New[selectorVars[i]];

varSet newSelectorVariables;//this somehwat silly intermiedate variable, is because (at least VS) compiler insists there is problem when using auto& below
varSet newSelectorVariables;//this somewhat silly intermediate variable, is because (at least VS) compiler insists there is problem when using auto& below
for (auto var : selectorVariables){
var.setNewIndex(old2New[var.getIndex()]);
newSelectorVariables.insert(var);
Expand Down
2 changes: 1 addition & 1 deletion algebra/algebralib/src/SubspacePolynomial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Algebra{
}


//Initialzing as the subspace poly of the space {0} - which is x
//Initializing as the subspace poly of the space {0} - which is x
coefficients.push_back(one());
FieldElement c, eiPower;
unsigned int i = 0, j;
Expand Down
Loading

0 comments on commit a783f5d

Please sign in to comment.