Skip to content

feat: resize PlainVector and SecureVector - #123

Open
Tom-Finke wants to merge 7 commits into
feat-extend-main-arithmetic-operationsfrom
resize-vectors
Open

Tom-Finke wants to merge 7 commits into
feat-extend-main-arithmetic-operationsfrom
resize-vectors

Conversation

@Tom-Finke

Copy link
Copy Markdown
Collaborator

Implements #94

@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/SecureArithmetic.jl 100.00% <ø> (ø)
src/openfhe.jl 96.04% <100.00%> (+0.19%) ⬆️
src/unencrypted.jl 98.73% <100.00%> (+0.08%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tom-Finke
Tom-Finke marked this pull request as ready for review October 21, 2026 13:08
@Tom-Finke

Copy link
Copy Markdown
Collaborator Author

Unit tests failing with DimensionMismatch: new dimensions (20,) must be consistent with array length 19.
This is due to a bug that only happens, when an array with 1 ciphertext that is not completely filled (length smaller than capacity), is resized to an array that needs at least 3 ciphertext. What happens is, that the ciphertext gets copied two times. Then, the new length gets set on the first and last ciphertext, but not those in between. Thus, the middle ciphertexts have a the same length as the first ciphertext initially had, instead of the full batch size.

@Tom-Finke
Tom-Finke changed the base branch from main to feat-extend-main-arithmetic-operations November 11, 2026 17:23
@Tom-Finke
Tom-Finke added this pull request to stack #133 November 11, 2026 17:24
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results: SecureArithmetic Matrix Multiplication

Warning: Benchmark run exited with status 1.

Summary

FHE Params Matrix Size Mode Wall Time (ms) Alloc #Mult #Rotate Result Level
d15_n2048 4×4 secure_secure 632.5 1.4 MiB 116 84 9
d15_n2048 4×4 secure_plain 230.7 530.8 KiB 50 30 5
d15_n2048 4×4 plain_secure 430.5 1.0 MiB 92 60 9
d15_n2048 4×4 * 4×1 secure_secure 152.4 309.4 KiB 26 18 5
d15_n2048 4×4 * 4×1 secure_plain 50.5 106.8 KiB 11 6 4
d15_n2048 4×4 * 4×1 plain_secure 100.4 213.8 KiB 20 12 5
d15_n2048 8×8 secure_secure 2177.9 6.1 MiB 492 364 15
d15_n2048 8×8 secure_plain 876.3 2.2 MiB 198 126 9
d15_n2048 8×8 plain_secure 1396.8 4.5 MiB 380 252 15
d15_n2048 8×8 * 8×1 secure_secure 308.2 719.9 KiB 58 42 8
d15_n2048 8×8 * 8×1 secure_plain 103.0 246.1 KiB 23 14 8
d15_n2048 8×8 * 8×1 plain_secure 204.0 515.5 KiB 44 28 7
d15_n2048 16×16 * 16×1 plain_secure 389.0 1.2 MiB 92 60 9
d15_n2048 32×32 secure_secure 31729.2 102.9 MiB 6016 5022 11
d15_n2048 32×32 secure_plain 7291.4 36.6 MiB 1056 1023 1
d15_n2048 32×32 plain_secure 23034.4 126.0 MiB 6016 4030 11
d15_n2048 32×32 * 32×1 secure_secure 931.2 3.1 MiB 188 155 11
d15_n2048 32×32 * 32×1 secure_plain 223.1 1.1 MiB 33 31 1
d15_n2048 32×32 * 32×1 plain_secure 705.9 3.8 MiB 188 124 11
d10_128c 4×4 secure_secure 7239.9 21.1 MiB 116 84 9
d10_128c 4×4 secure_plain 2804.0 7.5 MiB 50 30 5
d10_128c 4×4 plain_secure 4859.5 15.1 MiB 92 60 9
d10_128c 4×4 * 4×1 secure_secure 1824.8 4.5 MiB 26 18 5
d10_128c 4×4 * 4×1 secure_plain 608.2 1.5 MiB 11 6 4
d10_128c 4×4 * 4×1 plain_secure 1202.7 3.0 MiB 20 12 5
d10_128c 8×8 secure_plain 9977.4 31.7 MiB 198 126 9
d10_128c 8×8 * 8×1 secure_secure 3513.9 10.5 MiB 58 42 8
d10_128c 8×8 * 8×1 secure_plain 1191.1 3.5 MiB 23 14 8
d10_128c 8×8 * 8×1 plain_secure 2348.5 7.1 MiB 44 28 7
d10_128c 16×16 * 16×1 plain_secure 4235.2 15.3 MiB 92 60 9

Runs Without a Result

18 of 48 runs did not produce a result.

FHE Params Matrix Size Mode Error
d15_n2048 16×16 secure_secure SetLevel(): The current multiplicative depth [15] is insufficient; increase it.
d15_n2048 16×16 secure_plain SetLevel(): The current multiplicative depth [15] is insufficient; increase it.
d15_n2048 16×16 plain_secure SetLevel(): The current multiplicative depth [15] is insufficient; increase it.
d15_n2048 16×16 * 16×1 secure_secure SetLevel(): The current multiplicative depth [15] is insufficient; increase it.
d15_n2048 16×16 * 16×1 secure_plain SetLevel(): The current multiplicative depth [15] is insufficient; increase it.
d10_128c 8×8 secure_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 8×8 plain_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 16×16 secure_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 16×16 secure_plain SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 16×16 plain_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 16×16 * 16×1 secure_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 16×16 * 16×1 secure_plain SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 32×32 secure_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 32×32 secure_plain SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 32×32 plain_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 32×32 * 32×1 secure_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 32×32 * 32×1 secure_plain SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
d10_128c 32×32 * 32×1 plain_secure SetLevel(): The current multiplicative depth [10] is insufficient; increase it.
Full results (all columns)
fhe_params,matrix_size,mode,status,error,wall_time_s,alloc_bytes,eval_add_count,eval_add_time_s,eval_sub_count,eval_sub_time_s,eval_mult_count,eval_mult_time_s,eval_rotate_count,eval_rotate_time_s,eval_negate_count,eval_negate_time_s,resize_count,resize_time_s,result_level
d15_n2048,4×4,secure_secure,ok,,0.632503451,1471456,81,0.024152923,12,0.00996616,116,0.187709954,84,0.331602108,0,0.0,24,0.000694045,9
d15_n2048,4×4,secure_plain,ok,,0.230667672,543488,30,0.01319065,0,0.0,50,0.05260032,30,0.127877219,0,0.0,24,0.002363768,5
d15_n2048,4×4,plain_secure,ok,,0.430514492,1080160,69,0.023500594,12,0.009980707,92,0.104864372,60,0.222162873,0,0.0,24,0.007233227,9
d15_n2048,4×4 * 4×1,secure_secure,ok,,0.152366044,316800,18,0.006153616,3,0.002118964,26,0.047102272,18,0.079386014,0,0.0,6,0.000256434,5
d15_n2048,4×4 * 4×1,secure_plain,ok,,0.05047537,109360,6,0.003038345,0,0.0,11,0.011500568,6,0.027859863,0,0.0,6,0.000684989,4
d15_n2048,4×4 * 4×1,plain_secure,ok,,0.100386442,218976,15,0.005983199,3,0.00212352,20,0.025014192,12,0.05191919,0,0.0,6,0.001917749,5
d15_n2048,8×8,secure_secure,ok,,2.177935786,6374048,357,0.079169959,56,0.036817994,492,0.617415548,364,1.10124032,0,0.0,80,0.001742582,15
d15_n2048,8×8,secure_plain,ok,,0.876298853,2282112,126,0.0500657,0,0.0,198,0.208389818,126,0.47144816,0,0.0,80,0.005154641,9
d15_n2048,8×8,plain_secure,ok,,1.39680242,4699552,301,0.075624896,56,0.036743813,380,0.331152002,252,0.657230864,0,0.0,80,0.028298693,15
d15_n2048,8×8 * 8×1,secure_secure,ok,,0.308157922,737200,42,0.013375241,7,0.00541977,58,0.093413759,42,0.155705514,0,0.0,10,0.000327434,8
d15_n2048,8×8 * 8×1,secure_plain,ok,,0.103000109,252000,14,0.006147643,0,0.0,23,0.02463231,14,0.055385397,0,0.0,10,0.000750337,8
d15_n2048,8×8 * 8×1,plain_secure,ok,,0.204021486,527888,35,0.012495708,7,0.00544593,44,0.050957366,28,0.100530029,0,0.0,10,0.003731373,7
d15_n2048,16×16,secure_secure,error,SetLevel(): The current multiplicative depth [15] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d15_n2048,16×16,secure_plain,error,SetLevel(): The current multiplicative depth [15] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d15_n2048,16×16,plain_secure,error,SetLevel(): The current multiplicative depth [15] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d15_n2048,16×16 * 16×1,secure_secure,error,SetLevel(): The current multiplicative depth [15] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d15_n2048,16×16 * 16×1,secure_plain,error,SetLevel(): The current multiplicative depth [15] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d15_n2048,16×16 * 16×1,plain_secure,ok,,0.388964909,1295392,75,0.023534742,15,0.011060615,92,0.09509899,60,0.185639079,0,0.0,18,0.007216384,9
d15_n2048,32×32,secure_secure,ok,,31.72919755,107880080,4991,1.308809506,992,0.689906876,6016,7.361634103,5022,16.456240747,0,0.0,1088,0.026800722,11
d15_n2048,32×32,secure_plain,ok,,7.291355503,38428144,1023,0.077138728,0,0.0,1056,0.228660911,1023,4.735269844,0,0.0,1088,0.037272555,1
d15_n2048,32×32,plain_secure,ok,,23.03443864,132160448,4991,1.303223309,992,0.646465855,6016,5.308935378,4030,10.722448655,0,0.0,1088,0.462603407,11
d15_n2048,32×32 * 32×1,secure_secure,ok,,0.931170645,3265728,155,0.040764976,31,0.020140699,188,0.217754431,155,0.474772234,0,0.0,34,0.001199034,11
d15_n2048,32×32 * 32×1,secure_plain,ok,,0.223121331,1112304,31,0.002334506,0,0.0,33,0.007214266,31,0.14416211,0,0.0,34,0.001533494,1
d15_n2048,32×32 * 32×1,plain_secure,ok,,0.705949539,4024688,155,0.04079668,31,0.020186232,188,0.165554798,124,0.328741726,0,0.0,34,0.014431772,11
d10_128c,4×4,secure_secure,ok,,7.239857776,22115296,81,0.274973237,12,0.119711657,116,2.099705146,84,3.674309546,0,0.0,24,0.005504051,9
d10_128c,4×4,secure_plain,ok,,2.803975037,7916288,30,0.162184697,0,0.0,50,0.648673985,30,1.496677959,0,0.0,24,0.027826659,5
d10_128c,4×4,plain_secure,ok,,4.859466503,15825760,69,0.265311511,12,0.118513003,92,1.191723945,60,2.339314707,0,0.0,24,0.094282081,9
d10_128c,4×4 * 4×1,secure_secure,ok,,1.824809408,4740480,18,0.075463823,3,0.025582437,26,0.555613661,18,0.932657023,0,0.0,6,0.0015653,5
d10_128c,4×4 * 4×1,secure_plain,ok,,0.60815446,1583920,6,0.036908813,0,0.0,11,0.142166745,6,0.323347177,0,0.0,6,0.007004786,4
d10_128c,4×4 * 4×1,plain_secure,ok,,1.202689838,3168096,15,0.073105917,3,0.025694654,20,0.302692412,12,0.597826043,0,0.0,6,0.023719026,5
d10_128c,8×8,secure_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,8×8,secure_plain,ok,,9.977377028,33247872,126,0.55880878,0,0.0,198,2.358899179,126,5.080425279,0,0.0,80,0.058519396,9
d10_128c,8×8,plain_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,8×8 * 8×1,secure_secure,ok,,3.5139057,11059120,42,0.15264606,7,0.063950191,58,1.031655298,42,1.723150727,0,0.0,10,0.001886624,8
d10_128c,8×8 * 8×1,secure_plain,ok,,1.191141218,3692640,14,0.069591447,0,0.0,23,0.28563798,14,0.609380306,0,0.0,10,0.007450774,8
d10_128c,8×8 * 8×1,plain_secure,ok,,2.348529686,7409168,35,0.143281551,7,0.0631769,44,0.577585408,28,1.103724923,0,0.0,10,0.046862788,7
d10_128c,16×16,secure_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,16×16,secure_plain,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,16×16,plain_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,16×16 * 16×1,secure_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,16×16 * 16×1,secure_plain,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,16×16 * 16×1,plain_secure,ok,,4.235237288,16040992,75,0.239927361,15,0.118711727,92,0.974254231,60,1.917828573,0,0.0,18,0.0964101,9
d10_128c,32×32,secure_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,32×32,secure_plain,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,32×32,plain_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,32×32 * 32×1,secure_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,32×32 * 32×1,secure_plain,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1
d10_128c,32×32 * 32×1,plain_secure,error,SetLevel(): The current multiplicative depth [10] is insufficient; increase it.,0.0,0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,-1

Benchmarks run with OMP_NUM_THREADS=1 on ubuntu-latest.

added unit test to test that all slots are initialized values after resize

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant