This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
forked from ldsec/drynx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: #6
- Loading branch information
Showing
12 changed files
with
186 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package operations | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
const minInputSize = 1 | ||
const minEncodedSize = 1 | ||
|
||
// Min computes the accumulation of values in a column. | ||
type Min struct{ Range } | ||
|
||
// MarshalID is the Operation's ID. | ||
func (Min) MarshalID() [8]byte { | ||
ret := [8]byte{} | ||
copy(ret[:], []byte("dr.op.mi")) | ||
return ret | ||
} | ||
|
||
// MarshalBinary returns nil. | ||
func (Min) MarshalBinary() ([]byte, error) { | ||
return nil, nil | ||
} | ||
|
||
// UnmarshalBinary does nothing. | ||
func (Min) UnmarshalBinary([]byte) error { | ||
return nil | ||
} | ||
|
||
// ExecuteOnProvider encodes. | ||
func (s Min) ExecuteOnProvider(loaded [][]float64) ([]float64, error) { | ||
if len(loaded) != minInputSize { | ||
return nil, errors.New("unexpected number of columns") | ||
} | ||
|
||
// TODO | ||
//converted := floatsToInts(loaded[0]) | ||
//min := libdrynxencoding.ExecuteMinOnProvider(converted) | ||
|
||
return []float64{float64(0)}, nil | ||
} | ||
|
||
// ExecuteOnClient decodes. | ||
func (s Min) ExecuteOnClient(aggregated []float64) ([]float64, error) { | ||
if len(aggregated) != minEncodedSize { | ||
return nil, errors.New("unexpected size of aggregated vector") | ||
} | ||
|
||
// TODO | ||
//return []float64{float64(libdrynxencoding.ExecuteMinOnClient(floatsToInts(aggregated)))}, nil | ||
return nil, nil | ||
} | ||
|
||
// GetInputSize returns 1. | ||
func (Min) GetInputSize() uint { | ||
return minInputSize | ||
} | ||
|
||
// GetEncodedSize returns 1. | ||
func (Min) GetEncodedSize() uint { | ||
return minEncodedSize | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package neutralizers | ||
|
||
import ( | ||
"github.com/ldsec/drynx/lib" | ||
"github.com/ldsec/drynx/lib/provider" | ||
) | ||
|
||
type minimumResultsSize struct { | ||
minimum uint | ||
} | ||
|
||
// NewMinimumResultsSize creates a Neutralizer vetting only when len(results) >= minimum | ||
func NewMinimumResultsSize(minimum uint) provider.Neutralizer { | ||
return minimumResultsSize{minimum} | ||
} | ||
|
||
func (rs minimumResultsSize) Vet(_ libdrynx.Query, results [][]float64) bool { | ||
return uint(len(results)) >= rs.minimum | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.